Density of $C^\infty(\mathbb{R}^n)$ in $C^0(\mathbb{R}^n)$ This could be well-known, but I cannot come up with a rigorous proof. I want to prove density of $C^\infty(\mathbb{R}^n)$ in the continuous functions $C^0(\mathbb{R}^n)$ in the following sense: given a continuous function $f$, I want to select a smooth function $g$ such that $\sup |f - g|$ is as small as we want. All the tricks I can think of either deal with a compact setting, or continuous functions vanishing at infinity. Thanks!
 A: Let $f:\mathbb{R}^n \to \mathbb{R}$ be continuous.
Choose a partition of unity $\{\phi_k\}_{k=1}^{\infty}$ on $\mathbb{R}^n$ which is subordinate to some locally finite family $\{U_k\}_{k=1}^{\infty}$ of precompact open sets which covers $\mathbb{R}^n$.
Let $\epsilon>0$. Then for all $k$, there exists a $C^{\infty}$ function $g_k$ such that $\sup_{x \in \text{supp } \phi_k} |f(x)-g_k(x)|<\epsilon\cdot 2^{-k}$ (we can do this because the support of $\phi_k$ is compact for all $k$, and we know that it's true in the compact case).
Let $g = \sum_k g_k\phi_k$. Then $g$ is $C^{\infty}$, because locally it is the finite sum of $C^{\infty}$ functions.
Since $\sum_k \phi_k=1$, we have that for all $x \in \mathbb{R}^n$,
$$|f(x)-g(x)| = \bigg|\sum_k f(x)\phi_k(x) - g_k(x)\phi_k(x)\bigg| \leq \sum_k |f(x)-g_k(x)|\cdot |\phi_k(x)| \leq \sum_k \epsilon \cdot 2^{-k} = \epsilon$$ Thus $\sup_{x \in \mathbb{R}^n} |f(x)-g(x)|\leq \epsilon$ and $g$ is $C^{\infty}$, as desired.
Actually, this would work on any manifold (not just $\mathbb{R}^n$), I think.
