# Simple Function Approximation Question

Assume $E\subseteq [a,b]$ is a measurable set.

Using the following fact: For any $\epsilon>0$, there are finitely many disjoint closed intervals $\{[a_i, b_i]\}_{i=1}^N$ in $[a,b]$ such that $$|\{x\in [a,b]:\chi_E\neq\chi_{\bigcup [a_i, b_i]}\}|<\epsilon.$$

(This fact is proved in an earlier question "Inner Approximation" by Finite Disjoint Closed Intervals)

Using the fact above, how do we show that if $f\geq 0$ is integrable on $[a,b]$, there exists a simple function $g=\sum_{i=1}^k\alpha_i\chi_{[a_{i-1}, a_i]}$ with $\alpha_i\geq 0$, $a_0=a<a_1<\dots<a_k=b$ such that $$\int_a^b |f-g|\,dx<\epsilon$$?

What I know is that $f$ can be written as the limit of a sequence of increasing, measurable simple functions. Just very confused on how to put the proof together.

Thanks for any help.

I have attempted a solution. Comments are greatly welcomed.

Assume $f\geq 0$ is integrable on $[a,b]$. Let $E=\{f<\infty\}$ which is measurable. Note that $|[a,b]\setminus E|=0$ since $f$ is integrable.

There exists a simple function $h=\sum_{i=1}^M\alpha_i\chi_{E_i}$ where $E=\bigcup_{i=1}^M E_i$ and $E_i$ are disjoint and measurable, such that $|f-h|<\frac{\epsilon}{2|E|}$ on $E$.

For each $E_i$, $1\leq i\leq M$, there exists finite disjoint closed intervals $\{[a_j^{(i)}, b_j^{(i)}]\}_{j=1}^{N(i)}$ such that $$|\{x\in[a,b]:\chi_{E_i}\neq\chi_{\bigcup[a_j, b_j]}\}|<\frac{\epsilon}{2M\alpha_i}.$$

Define $g_i=\sum_{j=1}^N\alpha_j\chi_{[a_j, b_j]}$.

Then $$\int_{E_i} |h-g_i|\,dx\leq|\{\chi_{E_i}\neq\chi_{\bigcup[a_j, b_j]}\}|\cdot\alpha_i<\frac{\epsilon}{2M}.$$

Let $g=\sum_{i=1}^M g_i$. Finally, \begin{align*} \int_a^b |f-g|\,dx&=\int_E |f-g|\,dx\\ &\leq\int_E |f-h|\,dx+\int_E |h-g|\,dx\\ &<\frac{\epsilon}{2|E|}\cdot|E|+\sum_{i=1}^M\int_{E_i}|h-g_i|\,dx\\ &=\frac{\epsilon}{2}+M\cdot\frac{\epsilon}{2M}\\ &=\frac{\epsilon}{2}+\frac{\epsilon}{2}=\epsilon. \end{align*}