# Simple function approximation of a function in $L^p$

I know that, in general, that any function $f \in L^p(X,\mathcal{M},\mu)$ can be approximated arbitrarily well by a simple function $\sum_{k=1}^n \lambda_k \chi_{E_k}$ where $a_k \in \mathbb{C}, E_k \in \mathcal{M}$.

My question concerns the special case $X=[a,b]\subset \mathbb{R}$ equipped with the Borel $\sigma$-algebra and the Lebesgue measure. Is it then possible to approximate a function $f\in L^p([a,b])$ arbitrarily well with simple functions of the form $\sum_{k=1}^m \alpha_k \chi_{A_k}$ where each $A_k$ is an interval?

Yes, it is possible, if $p<\infty$. It should be evident that it is enough to show that you can approximate a simple function by step functions (i.e. simple functions made only with characteristic functions of disjoint intervals). In order to do this, it is enough to show that the characteristic of a measurable set of finite measure can be approximated by step functions. Take a measurable set $A$ with $\mu(A)<+\infty$; by regularity, we can find an open set $U\supset A$ such that $\mu(U\setminus A)<\epsilon$ and by a well known result in topology, $U$ can be written as a countable union of disjoint intervals: $$U=\bigcup_{n=0}^\infty I_n$$ so, we can find $N$ such that $$\mu\left(\bigcup_{n> N} I_n\right)<\epsilon\;.$$ Hence, we define $$h(x)=\sum_{n=0}^N\chi_{I_n}(x)$$ and we have $$\|h(x)-\chi_A(x)\|_p\leq(2\epsilon)^{1/p}\;.$$ So, the step functions are dense among the simple functions, which in turn are dense in $L^p$.
If $p=\infty$, the result no longer holds: take a measurable set $A$ such that $0<\mu(A\cap I)<\mu(I)$ for every interval $I$, then $\chi_A$ is at a positive distance from every step function.
• For $p = \infty$: the existence of such an $A$ is not obvious and maybe deserves to be proved. Commented May 1, 2020 at 18:15
• Yeah, it's not obvious (math.stackexchange.com/questions/57317/…) and it's also a classical "hard" exercise in measure theory. However, it's not strictly needed here: you can also consider, in $[0,1]$, the union of intervals $[1/2^{2n+1}, 1/2^{2n}]$ and its characteristic function won't be approximated by step functions. Or you could consider the fact that, in $L^\infty([a,b])$, step functions are dense in the continuous functions and the continuous functions are a closed subspace or $L^\infty([a,b])$. Commented May 3, 2020 at 9:47