The Schwartz Class is dense in $L^p$ Is there any hint to prove that for every 
$1 \le p < \infty $ the Schwartz Class is dense in $L^p$?
Thanks so much.
 A: Hint:
Step 1. For every $f\in L^p$, and every $\varepsilon>0$, there exists an $M>0$,
such that
$$
\|\,f-\chi_{[-M,M]\,}f\|_{L^p}<\varepsilon,
$$ 
where $\chi_A$ is the characteristic function of $A$. Set $g=\chi_{[-M,M]\,}f$.
Set 2. Let now $K_t(x)=(\pi t)^{1/2}\mathrm{e}^{-x^2/t}$, $t>0$, and define $g_t=g*K_t$.
Then
$$
\lim_{t\searrow 0}\|g_t-g\|_{L^p}=0,
$$
and $g_t\in\mathscr S$, for all $t>0$.
A: Let me consider the case $1<p<\infty$.
Hint: $C_c^\infty(\mathbb{R}^n)\subset\mathcal{S}(\mathbb{R}^n)$ + Hahn-Banach Theorem + du Bois-Reymond Lemma.
Details:

 Let $1<p<\infty$ and $C_c^\infty(\Omega)$ be the space of all compactly supported smooth functions $u:\Omega\subset\mathbb{R}^n\to\mathbb{R}$. Let $\phi:L^p(\Omega)\to\mathbb{R}$ be a continuous linear functional such that \begin{align}\phi(u)=0,\qquad\forall\ u\in C_c^\infty(\Omega).\tag{1}\end{align} Then, by the Riesz representation theorem, there exists $v\in L^{p'}(\Omega)$ such that \begin{align}\phi(f)=\int_\Omega fv\;dx,\quad\forall\ f\in L^p(\Omega).\tag{2}\end{align} Then, by $(1)$, \begin{align}\int_\Omega fv\;dx=\phi(f)=0,\quad\forall\ f\in C_c^\infty(\Omega).\tag{3}\end{align} By the du Bois-Reymond Lemma, it follows from $(3)$ that $v=0$ in $L^{p'}(\Omega)$. Thus, by $(2)$, \begin{align}\phi(f)=\int_\Omega f\cdot 0\;dx=0,\quad\forall\ f\in L^p(\Omega).\end{align} So, by (a corollary of) the Hahn-Banach Theorem, $C_0^\infty(\Omega)$ is dense in $L^p(\Omega)$. 

The case $p=1$ (and other approach  for the case $1<p<\infty$) can be found in the Brezis book.
A: Let $f$ be a continuous function with compact support. Because such functions are dense in $L^p, 1\le p <\infty,$ it's enough to show $f$ can be approximated by Schwartz functions in all of these $L^p$ spaces.
Suppose $f$ is supported in $[-a,a].$ Let $\epsilon>0.$ By Weierstrass, there is a polynomial $q$ such that $|q-f|<\epsilon$ in $[-a,a].$
Define the functions
$$\begin {cases}\varphi_n(t) = \exp (1/[n(t^2-a^2)]),& t\in (-a,a)\\ 0, & |t| \ge a\\ \end {cases}$$
Each $\varphi_n$ is positive on $(-a,a)$ with support $[-a,a].$  We also have $\varphi_n \in C^\infty(\mathbb R),$ bounded by $1$ everywhere, and $\varphi_n \to\chi_{(-a,a)}$ pointwise everywhere. Of course each $\varphi_n$ is in the Schwartz space.
Now $q\varphi_n$ extends to be in $C_c^\infty(\mathbb R)$ in the obvious way. Thus
$$\int_{\mathbb R}|q\varphi_n - f|^p = \int_{-a}^a |q\varphi_n - f|^p \le 2^{p-1}\left (\int_{-a}^a |q\varphi_n - q|^p + \int_{-a}^a |q-f|^p\right ).$$
If $n$ is large enough, the last integral is less than $2a\epsilon^p,$  and this is enough for what we want.
