TITLE: Continuous functions on $[0,1]$ is dense in $L^p[0,1]$ for $1\leq p< \infty$
QUESTION [26 upvotes]: I tried to show that the continuous functions on $[0,1]$ are dense in $L^p[0,1]$ for $ 1 \leq p< \infty $ 
by using Lusin's theorem.
I proceeded as follows..
By using Lusin's theorem, for any $f \in L^p[0,1]$, for any given $ \epsilon $ $ > $ 0, there exists a closed set $ F_\epsilon $ such that $ m([0,1]- F_\epsilon) < \epsilon$
and $f$ restricted to $F_\epsilon$ is continuous.
Using Tietze's extension theorem, extend $f$ to a continuous function $g$ on $[0,1]$.
We claim that $\Vert f-g\Vert_p $ is sufficiently small.
$$
\Vert f-g\Vert_p ^p = \displaystyle \int_{[0,1]-F_\epsilon} |f(x)-g(x)|^p dx 
$$
$$ 
\leq \displaystyle \int_{[0,1]-F_\epsilon} 2^p (|f(x)|^p + |g(x)|^p) dx 
$$
 now using properties of $L^p$ functions, we can make first part of our integral sufficiently small. furthermore, since $g$ is conti on $[0,1]$, $g$ has an upper bound $M$, so that second part of integration also become sufficiently small.
I thought I solved problem, but there was a serious problem.. our choice of g is dependent of $\epsilon$ , so constant $M$ is actually dependent of $\epsilon$, so it is not guaranteed that second part of integration becomes 0 as $\epsilon $ tends to 0.
I think if our choice of extension can be chosen further specifically, for example, by imposing $g \leq f$ such kind of argument would work. Can anyone help to complete my proof here?

REPLY [4 votes]: Fix $p\text{ , and }1\leq p\lt \infty.$
By using Lusin's theorem, for any $f \in L^p[0,1]$, for any given $ \epsilon $ $ > $ 0, there exists a closed set $ F_\epsilon $ such that $ m([0,1]- F_\epsilon) < \epsilon$
and $f$ restricted to $F_\epsilon$ is continuous.
Using Tietze's extension theorem, extend $f$ to a continuous function $g$ on $[0,1]$.
Note that $f\equiv g$ on $F_\epsilon$, so we only need to take care of the integral on $[0,1]- F_\epsilon$.
Continuous function is always integrable on $[0,1]$, so $g^p$ is integrable on $[0,1]$. 
Since $|f(x)-g(x)|^p \leq 2^p (|f(x)|^p + |g(x)|^p)$ and $f \in L^p[0,1],$ 
we know $\int_{[0,1]}|f(x)-g(x)|^p \lt \infty, i.e. |f(x)-g(x)|^p$ is integrable on $[0,1].$
By the proposition I post, $ \int_{[0,1]-F_\epsilon}|f(x)-g(x)|^p \to 0 $ when $m([0,1]- F_\epsilon)\to 0.$ 
Note that $\epsilon \to 0 \Rightarrow m([0,1]- F_\epsilon)\to 0$ (Since $m([0,1]- F_\epsilon \lt \epsilon$)
For each $\epsilon \gt 0$, we can find a corresponding continuous function $g_\epsilon, $ and $\Vert f-g_\epsilon \Vert \to 0$ when $\epsilon \to 0$.
So, $C([0,1])$ is dense in $L^p[0,1]$.
Reference: The proposition is from the Real Analysis,4th Ed, written by Royden and Fitzpatrick.