Constructing a sequence of test functions whose convergence is uniform Let $f$ be a continuous function vanishing at $+\infty$ and $-\infty$. Construct a sequence of functions in the space of infinitely times differentiable functions on $\Bbb R$ with compact support so that this sequence converges uniformly to $f$.
Thanks for any help.
 A: There are many ways to do this, but there is one really concrete way of constructing smooth approximations to a function. This way is called mollification. You can see the Wikipedia article on the subject for more details. I will summarize the most important points here:


*

*We need a smooth function called a mollifier. First, it is compactly supported, smooth, positive, and has integral over $\mathbb{R}$ equal to $1$; let us label this function $\varphi(x)$. We also want it to be the case that the rescaling $\varphi_{\epsilon}(x): \epsilon^{-1} \varphi(x/\epsilon)$ approaches the Dirac delta function $\delta(x)$ as $\epsilon \rightarrow 0$. This last condition gives us the intuition for what a mollifier is: it is a smooth approximation to the Dirac delta function. A standard, explicit mollifier (also the one used on the Wikipedia page) is given by first taking
$$ g(x) = \begin{cases} e^{1/(1 - |x|^2)} & |x| < 1 \\ 0 & |x | \ge 1
\end{cases}$$
and then setting $\varphi(x) = g(x)/(\int g \, dx)$ to normalize.

*Let us recall what the Dirac delta function does: it is really a distribution, not a function, and it obeys the property that $\delta \ast f = f$. This motivates the following strategy: we will instead use the rescaled mollifier $\varphi_{\epsilon}$ as a surrogate for $\delta$, and we will look at the convolution $\varphi_{\epsilon} \ast f$. Of course, then $\varphi_{\epsilon} \ast f \neq f$, but we will get something very close. Furthermore, the function $\varphi_{\epsilon} \ast f$ is smooth because $\varphi_{\epsilon}$ is smooth. This gives us a way to smoothly approximate any function $f$, by considering its mollification $\varphi_{\epsilon} \ast f$, and taking $\epsilon > 0$ small.

*We are looking for a sequence of approximations to $f$ that are compactly supported, so taking mollifications of $f$ is not sufficient. Instead, let us consider the functions $f_n(x) = f \cdot \chi_{[-n,n]}$; these are just the function $f$, chopped off at the endpoints $|x| = n$. Now we can mollify these functions, and we can check that mollifying $f_n$ yields a smooth, compactly supported function, since $f_n$ and $\varphi_{\epsilon}$ are both compactly supported. Now, to get one whole sequence that simultaneously converges to $f$ and is compactly supported and smooth, we can also pick $\epsilon = 1/n$, so then we get the sequence of approximations
$$ \{ \varphi_{1/n} \ast f_n \}$$
Some remarks: If you haven't seen this approach, it would be, in my opinion, quite challenging to think of it. But I cannot think of any less general way of doing it, for your problem. Also, notice that while I've given you the full method, I've not proven anything, so if what you're doing is a homework exercise, you'll need to prove many things, namely that (1) a mollification is in fact smooth, and (2) these approximations will converge uniformly.
