The following is a question from Ryden's Real Analysis.
Let $f$ be a measurable function on $E$ that is finite a.e. on $E$ and $m(E)<\infty$. For each $\epsilon>0$, show that there is a measurable set $F$ contained in $E$ and a sequence $(g_n)$ of simple functions on $E$ such that $(g_n)\to f$ uniformly on $F$ and $m(E\setminus F)<\epsilon$.
What follows is my attempt.
Let $\epsilon>0$. By a previous problem there exists a measurable subset $F$ of $E$ such that $f$ is bounded on $F$ and $m(E\setminus F)<\epsilon$. Since $f$ is measurable there exists a sequence of simple functions $(g_n)$ such that for each $n\in\mathbb{N},$ $|g_n(x)|\leq|g_{n+1}(x)|$ and $\lim_n g_n(x)=f(x)$ for each $x\in E$. Then $(g_n)$ is bounded on $F$ i.e. there exists $M>0$ such that $|g_n|\leq M$ on $F$ for each $n\in\mathbb{N}$.
This is all I can see and I don't understand how to proceed. I wanted to check if "$|g_n|\leq M$ on $F$ for each $n\in\mathbb{N}$" implies $g_n\to f$ uniformly on $F$- wishful thinking- but I'm still stuck. Please help. Thanks
If $f$ is a bounded non-negative function (say by $N\in\mathbb N$), then defining $$g_n:=\sum_{i=0}^{N2^n-1}i2^{-n}\mathbf 1\left\{i2^{-n}\lt f\leqslant \left(i+1\right)2^{-n}\right\},$$ we get a sequence of simple functions such that $\left|g_n\left(x\right)-f\left(x\right)\right|\leqslant 2^{-n}$ for any $x$.