I want to prove that if $f:\mathbb{R}\to\mathbb{R}$ is Lebesgue-integrable, then for every $\epsilon >0$ there exists $g:\mathbb{R}\to\mathbb{R}$ continuous such that $\displaystyle\int_{\mathbb{R}}|f-g|<\epsilon$ (I will write the integral simply $\displaystyle\int|f-g|$).
I already know how to approximate $f$ by simple functions.
Now, in the following link:
Finding simple, step, and continuous functions to satisfy Lebesgue integral conditions
The author of the chosen answer proves that for the characteristic function $[E ]$ and $\epsilon >0$, there is a continuous function $\phi:\mathbb{R}\to [0,1]$ such that $\displaystyle\int |[ E]-\phi|<\epsilon$, but he uses the regularity which is only valid if $E$ is of finite measure.
Is this still valid if $E$ isn't of finite measure? Or at least, I'm trying to do the case when $E$ is $\sigma$-finite, because I'm interested when $E=\mathbb{R}$.
Any suggestion? Thanks.
Best Answer
Consider $\mathbb{R}=\bigcup_i [-i,+i]$.
1st ingredient:
For all $i\geq 1$, find continuous $g_i$ supported on $[-i,+i]$ s.t. $\int_{[-i,+i]} \left|f-g_i \right| < \frac{1}{i}$.
This is possible thanks to the proof in the link you provided.
2nd ingredient:
Now since $f:\mathbb{R}\rightarrow\mathbb{R}$ is Lebesgue-integrable, $\int_{\mathbb{R}-[-i,+i]}|f|\rightarrow0$ as $i\rightarrow\infty$.
Can you conclude the argument using those ingredients?