Elegant proof that $L^2([a,b])$ is separable

The sub-$\mathbb Q$-vector space generated by the characteristic functions of intervals with rational end-points is countable and dense.


The set of functions $\{e_n\colon n\in\mathbb{Z}\}$ given by $$e_n(x) = \exp\left(2\pi in\frac{x-a}{b-a}\right)$$ is dense in $C[a,b]$ by the Stone-Weierstrass Theorem.* Since $C[a,b]$ is dense in $L^2[a,b]$, it follows that $\{e_n\colon n \in \mathbb{Z}\}$ is dense in $L^2[a,b]$.

*Technically speaking, they're dense in the space of continuous functions normalized so that $f(a) = f(b) = 1$. However, this doesn't really matter as we can always look at $[a-\epsilon, b+\epsilon]$ instead.