Here is my homework. $f\in L([a,b]),\epsilon>0$.Prove that exist a step function $S(x)$ such that $\int_{a}^{b}|f(x)-S(x)|dx<\epsilon$ My method:
Assume that $f$ is non-negative, or we will discuss $f_{+}$ and $f_{-}$ of $f$.
Since we can find a continuous function $h(x)$ s.t. $\int_{a}^{b}|f(x)-h(x)|dx<\epsilon$ So,we just need to find $S(x)$,s.t. $\int_{a}^{b}|S(x)-h(x)|dx<\epsilon$ Obviously,$h(x)$ is Riemann integral,for the $\epsilon$ above, there exist a partition of $[a,b]$\, a = x_0 < x_1 < x_2 < \cdots < x_n = b\,$,$\exists\xi_{i}\in(x_{i-1},x_i)$,s.t. $|\int_{a}^{b}h(x)dx-\sum_{i=1}^{n}h(\xi_{i})(x_{i}-x_{i-1})|<\epsilon$ That is $\int_{a}^{b}|h(x)-\frac{1}{b-a}\sum_{i=1}^{n}h(\xi_{i})(x_{i}-x_{i-1})|dx<\epsilon$ Then we find the step function $S(x)$ $S(x)=\frac{1}{b-a}\sum_{i=1}^{n}h(\xi_{i})(x_{i}-x_{i-1})$$ At the interval $(x_{i-1},x_i)$,we have find a constant $\frac{h(\xi_{i})}{b-a}$