Is the following set dense in $L^2$? Lately I was talking to a friend of mine and we came up with the following question

Denote by $\mathcal{P}$ the set of all real valued polynomial functions. Is the set
  $$ \{ p(x) e^{- \alpha \vert x \vert} \ : \ p\in \mathcal{P}, \ \alpha \in \mathbb{R}_{>0} \} $$
  dense in $L^2(\mathbb{R} ,\mathbb{R})?$

My feeling is that it should be true. I was thinking about using the Stone-Weierstrass, however, I cannot control the $L^2$-norm of the polynomial function outside the compact set. Clearly it is finite (the exponential decay beats the polynomial growth), but it is not clear to me whether one can choose it to be small.
 A: Yes, the answer is affirmative. It is equivalent to

$\{p(x)e^{-|x|} : p\in\mathcal{P}\}$ is dense in $L^2(\Bbb{R},\Bbb{R})$.

In our context of Hilbert spaces, we need to show that
$$L_0 = \left\{f\in L^2(\Bbb{R}) : (\forall n\in\Bbb{Z}_{\geq 0})\ \int_{\Bbb{R}}x^n e^{-|x|}f(x)\,dx=0\right\}$$
consists of $f\equiv 0$ only. Here and below, all functions are complex-valued.
Let $\Lambda=\{\lambda\in\Bbb{C} : |\Re\lambda|<1\}$; for $f\in L^2(\Bbb{R})$, the function
$$B_f(\lambda)=\int_{\Bbb{R}}e^{-|x|+\lambda x}f(x)\,dx$$
is analytic in $\Lambda$ (differentiation is admissible under the integral sign). Further, for any $n\in\Bbb{Z}_{\geq 0}$ we have $B_f^{(n)}(0)=\displaystyle\int_{\Bbb{R}}x^n e^{-|x|}f(x)\,dx$ and, therefore, $f\in L_0$ if and only if $B_f\equiv 0$.
Now let $f\in L_0$ and $g\in L^1(\Bbb{R})$ (fixme... much less is enough, see comments). Then
$$0=\int_{\Bbb{R}}g(\lambda)B_f(i\lambda)\,d\lambda=\int_{\Bbb{R}}e^{-|x|}\hat{g}(x)f(x)\,dx,\quad\hat{g}(x)=\int_{\Bbb{R}}e^{i\lambda x}g(\lambda)\,d\lambda.$$
Thus, $e^{-|x|}f(x)$ is orthogonal to $\{\hat{g} : g\in L^1(\Bbb{R})\}$. This space is dense in $L^2(\Bbb{R})$ because, e.g., it contains all continuous piecewise linear finite functions obtained from
$$\hat{g}_0(x) = \max\{0,1-|x|\} \impliedby g_0(\lambda)=\frac{2}{\pi}\left(\frac{\sin\lambda/2}{\lambda}\right)^2$$
using linear combinations and shifts; $\hat{g}_1(x)=\hat{g}(x+a)\impliedby g_1(\lambda)=e^{i\lambda a}g(\lambda)$.
(I'm sure I've duplicated some known facts about integral transforms. Thus, it might be good to replace some parts of the above with references to these...)
A: There is a stronger conclusion.  Every function $f(x)$ continuous on $\mathbb{R}$ and tending to $0$ at $\pm \infty$ can be approximated uniformly by a sequence of the form $p_n(x)e^{-|x|},$ where $p_n(x)$ are polynomials.
This can be proved using Stone-Weierstrass theorem, but requires some effort.
The above can be used to solve your problem. It suffices to consider the case $\alpha=2.$ Let $f(x)$ be a continuous and vanishing at $\infty.$ Then
$$\|p_n(x)e^{-2|x|}-f(x)e^{-|x|}\|_2 \le \|p_n(x)e^{-|x|}-f(x)\|_\infty \|e^{-|x|}\|_2=   \|p_n(x)e^{-|x|}-f(x)\|_\infty. $$
The functions of the form $f(x)e^{-|x|}$ are dense in $L^2(\mathbb{R})$ as they contain continuous functions with bounded support.
