Below is question 16 from chapter III of Lang's Real and Functional Analysis:
For $a\in \Bbb R$ let $f_a(x)=e^{iax}e^{-x^2}$. Prove that any function $\varphi$ which is $C^\infty$ and has compact support on $\Bbb R$ can be uniformly approximated by elements of the space generated by the functions $f_a$ over $\Bbb C$. [Hint: If $\psi$ is a function vanishing outside a compact set, and $N$ is a large integer, let $\psi_N$ be an extension on $[-N,N]$ to $\Bbb R$ by periodicity. Use the partial sums of a Fourier series to approximate such an extension of $\varphi(x)e^{x^2}$, and then multiply by $e^{-x^2}$.]
I have trouble following the hint given. My understanding is that by first approximating $\varphi(x)e^{x^2}$ then multiplying by $e^{-x^2}$ (or any $C^\infty$ function that tends to $0$ at infinity, according to the book), we can ensure the approximants approach $0$ uniformly outside $[-N,N]$, but what about inside $[-N,N]$? What I mean is even we have got a sequence of functions approximating $\varphi_N$, it is not what the question asking for since the original function $\phi$ is not periodic. Can someone elaborate on that hint? Thanks in advance.
P.S. I know basic facts about Fourier series (I learnt them from baby Rudin) and I am aware of the Stone-Weierstrass Theorem.
Thanks for reuns's hint, I think I've figured it out. Instead of $e^{-x^2}$, let's work with general $h(x)$ that is $C^\infty$, strictly postive and tends to zero as $x$ approaches infinity. Without loss of generality, we can assume $h(x)$ is strictly increasing in $\Bbb R^{\le 0}$ and strictly decreasing in $\Bbb R^{\ge 0}$. As written in reun's answer, let's look at the Fourier series of $\sum_n \frac{1}{h(x-nT)} \varphi (x-nT)$ (which is essentially the periodic extension of $\frac{\varphi (x)}{h(x)}$), we are able find $P_k(x)$ generated by $f_a$ such that $\left|P_k(x)- \sum_n \frac{1}{h(x-nT)} \varphi (x-nT)\right|<\epsilon$. Multiplying both sides by $h(x)$, we get $$\left|h(x)P_k(x)- \sum_n \frac{h(x)}{h(x-nT)} \varphi (x-nT)\right|<A\epsilon\quad (*)$$ where $A$ is the least upper bound of $h(x)$. Assume the support $K$ of $\varphi$ lies within $[m,M]$, then for $n>0$, we have $\left|\frac{h(x)}{h(x-nT)} \varphi (x-nT)\right|\leq \left|\frac{h(m+nT)}{h(M)} \sup(\varphi(x))\right|\to0$ as $T\to \infty$. Similarly, this is also true for $n<0$ by a similar argument. The only exception is when $n=0$, whose corresponding summand is equal to $\varphi(x)$. Thus, letting $T\to\infty$ in (*), we get $\left|h(x)P_k(x)-\phi(x)\right|\le A\epsilon$. QED