Dense set in $L^2([0,1])$ I would like to prove that the set $$D=\{f\in C^2([0,1])\mid f(0)=f(1)=0\}$$
is dense in the space $L^2([0,1])$. How you got any suggestion to start proving this?
 A: Hint: it is enough to show that every step function is in the closure of $D$. For that, it is enough to show that every indicator function is.
A: Note that $e_n(t) = e^{2 \pi i n t}$ forms a Schauder basis of $L^2[0,1]$
and each $e_n$ is smooth.
Note that $\phi_n(t) = (1-(1-t)^n)(1-t^n)$ is smooth, $|\phi_n(t)| \le 1$,
$\phi_n(0) = \phi_n(1) = 0$ and $\phi_n(t) \to 1_{(0,1)}(t)$ for all $t$.
Then for any $f \in L^2[0,1]$, the dominated convergence theorem shows 
that $\|f-\phi_n f\| \to 0$.
Choose $f$ and $\epsilon>0$, then there is some $g \in \operatorname{sp} \{ e_n \}$ such that $\|f-g\| < { \epsilon \over 2}$, and by choosing $n$
large enough, we have $\|g-\phi_n g\| < { \epsilon \over 2}$. Then
$\|f-\phi_ng\| < \epsilon$, and $\phi_n g$ is smooth and $\phi_n (0)g(0) = \phi_n (1)g(1) = 0$, hence $\phi_ng \in D$.
A: Continuous functions on $[0,1]$ are dense in $L^2[0,1].$ Such functions are uniform limits of polynomials on $[0,1].$ Thus polynomials are dense in $L^2[0,1].$ Let $P$ be a polynomial. Then
$$f_n(x) = \begin{cases} P(x)\exp (-1/[nx(1-x)]) &0<x<1\\ 0& x=0,1\end{cases}$$
are $C^\infty$ functions that vanish at the endpoints. We have $|f_n| \le |P|$ for each $n,$ and $f_n \to P$ pointwise a.e. (actually the convergence is uniform on compact subsets of $(0,1)$). Hence $f_n \to P$ in $L^2[0,1],$ and we have your result.
