Dense subspace of the space of functions vanishing at infinity How can I show that the space of smooth functions with compact support, $C^{\infty}_K$, is dense in the space of continuous functions vanishing at infinity equipped with the supremum norm, $(C_0,|| \cdot ||_{\infty})$ ?
I already know that the space of continuous functions with compact support, $C^0_K$, is dense in $C_0$, so it suffices to show that $C^{\infty}_K$ is dense in $C^0_K$.
 A: I'll assume we are talking about functions on the real line. Fix $f\in C_0(\mathbb R)$. The fact that $f$ is $C_0$ allows us to write it as a uniform limit of continuous functions with compact support$^1$. So now we can assume without loss of generality that $f$ is continuous with compact support.
Start with $h_0(x)=\begin{cases}e^{-1/x^2},&\ x>0\\0,&\ x\leq0\end{cases}$.
Next you notice that $h(x)=h_0(x)h_0(1-x)\in C^\infty_K$, with support in $[0,1]$. We can normalize it so that $\int_{\mathbb R} h=1$. Then, for each $\varepsilon>0$, you take
$$
h_\varepsilon(x)=\frac1\varepsilon\,h\left(\frac x\varepsilon\right)
$$
and you note that $\int_{\mathbb R}h_\varepsilon=\int_{\mathbb R}h=1$.
Now form the convolutions
$$
f_\varepsilon(x)=\int_{\mathbb R}f(t)\,h_\varepsilon(x-t)\,dt.
$$
It is not hard to show that because $h_\varepsilon\in C^\infty$ we have $f_\varepsilon\in C^\infty$; and because $f$ and $h_\varepsilon$ have compact support, so does $f_\varepsilon$.
Finally, given $\varepsilon>0$, as $f$ is continuous with compact support, it is uniformly continuous. So given $c>0$ there exists $\delta>0$ such that $|f(x)-f(y)|<c$ if $|x-y|<\delta$. Then
\begin{align*}
|f_\varepsilon(x)-f(x)|&=\left|\int_{\mathbb R} [f(x-t)-f(x)]\,h_\varepsilon(t)\,dt\right|
\leq\int_{\mathbb R} |f(x-t)-f(x)|\,h_\varepsilon(t)\,dt\\
&\leq c\,\int_{|t|<\delta} h_\varepsilon(t)\,dt
+2\|f\|_\infty\,\int_{|t|\geq\delta}h_\varepsilon(t)\,dt\\
&=c
+2\|f\|_\infty\,\int_{|t|\geq\delta}h_\varepsilon(t)\,dt.
\end{align*}
with $\delta$ fixed, the last integral goes to zero as $\varepsilon\to0$ (because the support of $h_\varepsilon$ is contained in $[0,\varepsilon]$). Thus
$$
\limsup_{\varepsilon\to0}|f_\varepsilon(x)-f(x)|\leq c
$$
for all $x$ and all $c>0$. So $\|f_\varepsilon-f\|_\infty\to0$.


*

*Fix $f\in C_0(\mathbb R)$. For each $n\in\mathbb N$ there exists $N>0$ with $|f(x)|<\tfrac1n$ when $|x|>N$. Let $g_n$ be continuous, with $0≤g_n≤1$, $g_n(x)=1$ when $|x|≤N$ and $g_n=0$ when $|x|>N+1$. Then $fg_n\in C_c(\mathbb R)$ and $$|f-fg_n|=|f(1-g_n)|<\tfrac1n,$$ so $fg_n\to f$ uniformly.

A: Hint: use the theorem of stone-weirstrass
