Why this set is dense in $C_0(\mathbb{R})$?
Let $C_0=\{f~|~ f:\mathbb{R}\to\mathbb{R}, \textrm{$f$ is continuous},\lim\limits_{\vert x\vert \to\infty}f(x)=0\}$
$A=\{f~|~f(x)=p(x)e^{-x^2}, \textrm{$p(x)$ is polynomials}\}$
Why $A$ is dense in $C_0$?
The topology induced by the supremum metric $d(f,g)=\sup\limits_{x\in\mathbb{R}}|f(x)-g(x)|$.
Solution 1:
Well, functional analysis provides very natural set up for dealing with this question.
We will prove the same for $$A_{c(x)}:= \left \{p(x) e^{-c(x)} \right\}$$ Where $c(x)$ is a fixed even degree polynomial with positive leading coefficient and of degree $\ge 2$ and $p(x)$ is any polynomial.
Note that we need to prove that $A_{c(x)}$ is dense in $C_0 (\mathbb R)$. Else, by the Hahn-Banach Theorem, there would exist a nonzero functional $\mathcal{K}$ which would be zero on $A_{c(x)}$.
By Riesz–Markov–Kakutani representation theorem (referring to Rudin, Real and Complex analysis), $\ \mathcal{K}(f) = \int_{\mathbb R} f \, \text{d} \mu$ for some real measure $\mu$. Thus $\int_{\mathbb R} p(x) e^{-c(x)} \, \text{d} \mu = 0$ for every polynomial $p(x)$. Writing $\mu$ as $\mu_1 - \mu_2$ where $\mu_1, \mu_2$ are positive finite measures we have $\int_{\mathbb R} p(x) e^{-c(x)} \, \text{d} \mu_1 = \int_{\mathbb R} p(x) e^{-c(x)} \, \text{d} \mu_2$.
Define the measure $\nu_i := \int_{\mathbb R} e^{-c(x)} \text{d} \mu_i $ for $i= 1,2$. Then we have $\int_{\mathbb R} p(x) \text{d} \nu_1 = \int_{\mathbb R} p(x) \text{d} \nu_2 $ for every polynomial $p(x)$. (*)
Now Define $ \Phi_i(z) := \int _{\mathbb R} e^{zt} \, \text{d} \nu_i (t)$ for $z \in \mathbb C$ and $i=1,2$. It is easy to check that $\Phi_1, \Phi_2$ are entire functions (Here you actually use that $c(x)$ is in fact an even degree polynomial of degree $\ge 2$ with positive leading coefficient.).
Now by (*) we have $\Phi_1 ^{(n)} (0) = \Phi_2 ^{(n)} (0) $ for all $n \ge 0$. So their power series representations are identical, hence they are identical as functions, i.e., $\Phi_1(z) = \Phi_2(z)$.
So in particular, for any $s \in \mathbb R$, $\Phi_1( i s) = \Phi_2 (is)$, i.e., $ \int _{\mathbb R} e^{ist} \, \text{d} \nu_1 (t) = \int _{\mathbb R} e^{ist} \, \text{d} \nu_2 (t)$. This implies that $\nu_1 = \nu_2$ (by Inversion theorem), which implies $\mu_1 = \mu_2$.
Therefore $\mu = 0$, so the functional $\mathcal K$ must be zero, contrary to our assumption. This completes the proof.