Show that a set of functions is dense in $L^2(0,2)$ Show that a set of functions 
$$A=\{f\in C^0([0,2]):\ f(0)=f(1)=f(2)=0\}$$
is dense in $L^2(0,2)$.
I know the following theorem: Let $1\le p<\infty$, $\ \Omega\ $ be an open set of $\mathbb{R}^n$. Then continuous functions with compact support are dense in $L^p(\Omega)$.
In my case the functions are defined on $[0,2]$ that is closed. The definition of support is
$$supp\ f:=\overline{\{x\in X : f(x)\ne 0\}}$$
that is a closed set.
Now for a function in $A$ I can write the support like this (tell me any mistakes)
$$supp\ f=\overline{(0,1)\cup (1,2)}$$
that I think it's equal to $[0,2]$. Can I apply the previous theorem being my domain closed? Or maybe there is a different way to solve this?
 A: Consider 
$$B=\{f\in C^0((0,2)):\ f(1)=0 \text{ and } \lim\limits_{x \to 0^+} f(x) = \lim\limits_{x \to 2^-} f(x) =0\}.$$
You have to prove that $B$ is dense in $L^2((0,2))$.
For that, it is sufficient to prove that any continuous function $g$ with compact support included in $(0,2)$ is the limit in $L^2((0,2))$ of $g \cdot f_n$, where $f_n \in B$ is defined by
$$f_n(x)=
\begin{cases}
nx & 0 < x \le 1/n\\
1 & 1/n \le x \le 1-1/n\\
n(1-x) & 1-1/n \le x \le 1\\
n(x-1) & 1\le x \le 1+1/n\\
1 & 1+1/n \le x \le 2-1/n\\
n(2-x)& 2-1/n \le x <2
\end{cases}$$ for $n \ge 3$.
Drawing the graph of $f_n$ will help you to understand the background idea!
This is also using the fact that for $\mathcal F \subseteq \mathcal G \subseteq H$, if $\mathcal F$ is dense in $\mathcal G$ and $\mathcal G$ is dense in $\mathcal H$, then $\mathcal F$ is dense in $\mathcal H$.
A: It's enough to show $A$ is dense in $C[0,2]$ in the $L^2$ metric. So let $f\in C[0,2],$ with $M=\max_{[0,2]}|f|.$ For $n=1,2,\dots,$ set
$$f_n(x) = f(x)d(x,\{0,1,2\})^{1/n}.$$
Then each $f_n \in A.$ Furthermore $f_n \to f$ pointwise on $[0,2]\setminus \{0,1,2\}.$ We want to show
$$\tag 1\int_0^2 |f_n-f|^2\to 0.$$
But this is easy: First, we know $f_n\to f$ a.e. on $[0,2].$ Second, $|f_n|\le M$ for all $n.$ Hence the integrands in $(1)$ are bounded above by $4M^2.$ By the dominated convergence theorem, $(1)$ holds as desired.
