# Is it possible to write any bounded continuous function as a uniform limit of smooth functions

Is $C^\infty(\mathbb{R})\subset C_b(\mathbb{R})$ dense? I.e. is any continuous bounded function $f:\mathbb{R}\to\mathbb{R}$ the uniform limit of smooth functions?

On any bounded interval this is true since by Stone-Weierstrass polynomials are smooth and dense in the continuous functions. I guess the result is still true for $\mathbb{R}$ but I don't know how to prove it. Since I don't have any integrability conditions on $f$ the technique of convoluting with mollifiers is probably not applicable.

-
What about convoluting the approximating smooth functions on intervals $[n,n+1]$? – Berci May 19 '13 at 10:06

Given continuous $f$ and $\epsilon>0$, find for each $n\in\mathbb Z$ a smooth approximation $g_n\colon [n-1,n+1]\to\mathbb R$ with $\left\lVert f|_{[n-1,n+1]}-g_n\right\rVert_\infty<\epsilon$. Glue these together with a smooth partition of one.
For example: Start with a smooth function $\phi\colon[0,1]\to [0,1]$ with $\phi(x)=1$ for $x\le\frac13$ and $\phi(x)=0$ for $x\ge \frac23$. Then $$g(x):=\phi(x-\lfloor x\rfloor)g_{\lfloor x\rfloor}(x)+(1-\phi(x-\lfloor x\rfloor))g_{\lceil x\rceil}(x)$$ is smooth (the trick is that $g(x)=g_n(x)$ if $|x-n|<\frac13$) and at each $x$ we have $|f(x)-g(x)|<\epsilon$ because it is a convex combination. Therefore, $\lVert f-g\rVert_\infty<\epsilon$.