TITLE: Span of functions dense in $L^2$
QUESTION [5 upvotes]: This is an exercise from Werner's Funktionalanalysis. I have to show that the linear span of the functions $f_n(x)=x^ne^{-x^2/2}, n\geq0$ is dense in $L^2(\mathbb{R})$. The book gives the hint to first show that the Fourier transform of $\overline{f(x)}e^{-x^2/2}$ vanishes if  $\langle f,f_n\rangle=0$ for all $n$.
Now I don't see how this knowledge about the Fourier transform would help with the original statement. The $f_n$ obviously don't contain some orthogonal set, so even if I could conclude that $f=0$ from this I couldn't use some maximal orthogonal system argument for Hilbert spaces.
Also, I am unable to actually show the hint because for $f \in L^2(\mathbb{R})$ the formula for the Fourier transform does not hold and most of the nice properties of the Fourier transform I know are only valid for Schwartzfunctions.
So any kind of hint as to how this fits together would be helpful.

REPLY [4 votes]: Let $t\in\Bbb R$. We have for $t\in\Bbb R$ that 
$$\sum_{n=0}^{+\infty}\int_{\Bbb R}f(x)e^{-x^2/2}\frac{(itx)^n}{n!}=0.$$
As for all integer $n$,
$$\left|f(x)e^{-x^2/2}\frac{(itx)^n}{n!}\right|= |f(x)|e^{-x^2/2}\frac{|x|^n|t|^n}{n!},$$
and the RHS is integrable for the product of Lebesgue and counting measure (because for each fixed $t$, $$\sum_{n=0}^{+\infty}|f(x)|e^{-x^2/2}\frac{|x|^n|t|^n}{n!}=|f(x)|\exp\left(-\frac{x^2}2+|x||t|\right)\leqslant 2f(x)^2+2\exp\left(- x^2 +2|x||t|\right)$$), we can switch the integral and the sum, which gives that for all $t\in\Bbb R$, 
$$\int_{\Bbb R}f(x)e^{-x^2/2}e^{itx}dx=0.$$
As $x\mapsto f(x)e^{-x^2/2}$ is integrable, by uniqueness of Fourier transform $f(x)e^{-x^2/2}=0$ almost everywhere, hence $f\equiv 0$.