Aproximating with step functions

33 Views Asked by At

I have to find a sequence of functions $\{g_n\}$ of step functions , given a function $f\in L^1$, such that $\int _{-\infty}^{\infty} |f(x)-g_n(x)|dx \rightarrow 0$.

I tried using the obvious $$ g_n(x) = \sum_{i=n^2}^{n^2} f(i) \chi_[\frac{i}{n},\frac{i+1}{n}]$$

If I consider it in $E_r$ , where $r<f(x)≤r+1$, the error is proportional to $r$ and inversely proportional to $n$, but when I do the integral, it doesn't converge as $n \rightarrow \infty$.

Any ideas how I could solve it?