The Schwartz function and the sobolev space $W^{2,p}$ How do you prove the Schwartz functions in $\mathbb{R}^n$ are dense in the space $W^{2,p}(\mathbb{R}^n)?$
Terrence tao has a version of the proof of 
The space $C_c^{\infty}(\mathbb{R}^d)$ of test function is a dense subspace of $W^{k,p}(\mathbb{R}^d)$, then the fact $\mathcal{S}(\mathbb{R}^d)$ is dense in $L^p(\mathbb{R}^d)$ is a corollary from that. I do not understand his proof. (See lemma2)
enter link description here
 A: The Schwartz space contains in particular $C^\infty_0(\mathbb R^n)$ and $C^\infty_0(\mathbb R^n)$ is by definition dense in $W^{k,p}_0(\mathbb R^n)$. But we have $W^{k,p}_0(\mathbb R^n) = W^{k,p}(\mathbb R^n)$. Thus the Schwartz space is dense in $W^{k,p}(\mathbb R^n)$. 
The fact that $W^{k,p}(\mathbb R^n)= W^{k,p}_0(\mathbb R^n)$ can be found in Adam's Sobolev spaces (Corollary 3.23). The following is part of the proof of Theorem 3.22 in the book. 
Let $f : C^\infty_0(\mathbb R^n)$ be a smooth function so that $0\le f\le 1$ and 
$$f(x) = \begin{cases} 
1 & \text{ when }|x|\le 1 \\
0 & \text{ when }|x|\ge 2, 
\end{cases}$$
For each $\epsilon >0$, let $f_\epsilon(x) = f(\epsilon x)$. Then all derivatives of $f_\epsilon$ by bounded independent of $\epsilon <1$. 
For all $u\in W^{k,p}(\mathbb R^n)$, consider $u_\epsilon = uf_\epsilon$. Then using the product rule, we have 
$$\|u-u_\epsilon\|_{W^{k,p}(\mathbb R^n)} \le C \|u\|_{W^{k,p}(\Omega_\epsilon)},$$
where $\Omega_\epsilon = \{x\in \mathbb R^n : |x| \ge 1/\epsilon\}$. As $\epsilon\to 0$, the right hand side converges to $0$. Thus $u $ can be approximated by elements $u_\epsilon$ with compact support. Using mollifiers, this $u_\epsilon$ can be approximated by elements in $C^\infty_0(\mathbb R^n)$. Thus $C^\infty_0(\mathbb R^n)$ is dense in $W^{k,p}(\mathbb R^n)$. 
In general it is not true that $W^{k,p}_0(\Omega) = W^{k,p}(\Omega)$.
