Approximation of a Riemann integrable function w continuous function in the L2 metric

Let f be a function that is Riemann integrable. Prove there exists a piece-wise linear continuous function g such that . The given hint was construct g with a suitable partition of [b,a]. Given define when

Here is what I have so far.

So on an interval [ ] either or

So for a given partition P , Let be the sup and be the inf of the interval .

Let h = |f-g| , for an arbitrary partition resulting from integrating f, let be the sup for the function h over the interval . Now . is the sup and is the inf of f over the interval . is the sup and the inf of g over the interval . Now combined with and

Because f is Riemann integrable :

Let

Once again because f is Riemann integrable : where

Let . Construct the function g out of the partition P in piece-wise linear manner as decribed above. Let N be the number of points in P, it has at most has n + (n' -2) points and in the partition .

Let B , let be such a number that and

Therefore

partitions P of [a,b]. is the upper sum of the partition.

Please let me know where I went wrong or if this whole approach is wrong.

can someone let me know of any good readings about Lp spaces and motivation for the Lp metric's construction.