Orthonormal basis for $L^2(\mathbb{R})$ by Hermite Polynomials Consider $L^2(\mathbb{R})$ as an Hilbert space with inner product $(\cdot ,\cdot)$. Define
$$\psi_n(x)=e^{-\frac{x^2}{2}}H_n(x),$$
where $H_n(x)$ is the Hermite Polynomials. How do you show that $\{\psi_n(x)\}$ is a orthogonal basis for $L^2(\mathbb{R})$? (We can make it orthonormal by normalize it).
I showed $(\psi_i,\psi_j)=0$ for all $i\neq j$. To conclude the $\{\psi_n(x)\}$ forms a basis. We need to show that $\text{span}(\psi_n(x))$ is a dense subset of $L^2$. How do we prove that?
 A: As you say, you need to prove that
$$
\overline{\text{span}(\psi_n(x))} = L^2(\mathbb{R}).
$$
For that, it suffices to prove that if $f\in L^2(\mathbb{R})$ satisfies
$$
(f, \psi_n) = 0,
$$
for all $n$, then $f = 0$.
Note that the linear span of Hermite polynomials is equal to the linear span of all polynomials (look at the degrees of Hermite polynomials), so it's enough to prove that
$$
\int_{\mathbb{R}} f(x) x^n e^{-x^2/2} dx = 0, \; \forall n\geq 0, \Rightarrow f \equiv 0.
$$
Now, use that the set of continuous functions with compact support is dense in $L^2(\mathbb{R})$, and by Weierstrass theorem, you can approximate a continuous function on a compact domain uniformly by polynomials. Then, take a sequence of continuous functions with compact support $\{g_n\}$ such that
$$
g_n \rightarrow f\cdot e^{-x^2/2} \ \ \ \in L^2(\mathbb R)
$$
and, for each $g_n$, a sequence of polynomials $P_{n,m}$ such that
$$
P_{n,m} \cdot I_{[supp(g_n)]} \rightarrow g_n \quad \text{(uniformly in $m$)},
$$
where $I_{[supp(g_n)]}$ is the indicatrix of the support of $g_n$. Now consider
$$
A_{n,m} = \int \left(P_{n,m}(x) \cdot I_{[supp(g_n)]}(x) - f(x)e^{-x^2/2}\right) \cdot f(x) e^{-x^2/2} dx.$$
By the triangular inequality and choosing $m(n)$ large enough for each $n$, we have
$$A_{n,m(n)} \rightarrow 0, \quad \text{as }n\to \infty,$$
but also
$$
A_{n,m(n)} \rightarrow -\int f(x)^2 e^{-x^2} dx, \quad \text{as }n \to \infty.
$$
Then
$$
0 = -\int f(x)^2 e^{-x^2} dx \Rightarrow f \equiv 0
$$
which concludes the argument.
