# Why are continuous functions not dense in $L^\infty$?

Why are the continuous functions not dense in $L^\infty$?

I mean both concretely (i.e. a counter example) and intuitively why is this the case.

Consider $$f(x)=\begin{cases}0&\text{if }x<0\\1&\text{if }x\ge 0.\end{cases}$$ Any continuous $$g$$ with $$\|f-g\|_\infty<\frac 13$$ must have $$g(x) for all $$x<0$$. By continuity, $$g(0)\le \frac13$$, contradicting $$g(0)>f(0)-\frac13=\frac 23$$.
Even if we only require $$|f(x)-g(x)|<\frac13$$ for almost all $$x$$, the argument above still holds (with using continuity on the right as well).
Intuitively, the continuous $$g$$ cannot do the jump at once, it needs some "preparation" and "relaxation".
• In other words, the topology on $L^{\infty}$ is strictly finer than its restriction to $C(\mathbb{R},\mathbb{R})$? – AIM_BLB Mar 18 '20 at 15:37
If a convergent sequence of continuous functions converges uniformly then the limiting function is continuous. Consequently, the only functions which can be approximated to arbitrary accuracy in $L^\infty$ by continuous functions are the continuous functions. In other words, the subspace of $L^\infty$ consisting of continuous functions is closed.
Of course, there are many functions in $L^\infty$ which are not continuous!