Approximate $C^{\infty}$ functions by test functions in the Sobolev space norm I am looking for a way to approximate a function $f \in \mathbb{C}^{\infty} \cap H^m(\mathbb{R}^n)$ by test functions such that I approximate $f$ and all of $f's$ $m-$ derivatives in the canonical Sobolev space norm. So given this function $f$, then I am looking for a sequence of test functions $f_n$ with $f \rightarrow f_n$ in the Sobolev space norm. 
 A: The usual way is with cutoff functions.  Let $\phi \in C^\infty_c$ be a smooth compactly supported function which equals 1 on the unit ball, and let $\phi_n(x) = \phi(x/n)$.  Then set $f_n = f \phi_n$.  Now $f_n$ is $C^\infty_c$, converges to $f$ pointwise (indeed $f_n(x) = f(x)$ as soon as $n \ge |x|$), and $|f_n| \le \|\phi\|_{\infty} |f|$ so by dominated convergence $f_n \to f$ in $L^2$.  You can then compute higher derivatives $\partial_\alpha f_n$ (use the product rule) and show that they converge to $\partial_\alpha f$ pointwise and are dominated by appropriate constant multiples of $f$ and its derivatives, all of which are in $L^2$.  (The appropriate constant multiples come from the sup norms of the derivatives of $\phi$).
A typical way to construct $\phi$ is like this.  Set
$$u(t) = \begin{cases} e^{-1/(1-x^2)}, & -1 < x < 1 \\ 0, & \text{otherwise.} \end{cases}$$
It's a straightforward calculus exercise to check that $u$ is $C^\infty_c$.  Now set $$v(t) = \frac{\int_{-\infty}^t u(s)\,ds}{\int_{-\infty}^\infty u(s
)\,ds}.$$
You can check that $v$ is $C^\infty$ (fundamental theorem of calculus), $v = 0$ on $(-\infty, -1]$ and $v=1$ on $[1,+\infty)$.  Finally take $\phi(x) = v(2-|x|^2)$.  Then $\phi$ is $C^\infty$, $\phi(x)=1$ for $|x| \le 1$, and $\phi(x)=0$ for $|x| \ge 2$.
