How do we know the complex exponentials “span” the set of all real functions?

So, we know if $L^2 (0,2\pi)$ is the space of all $2\pi$ periodic square-integrable functions, ie all functions that have finite energy:

$$\int_0^{2\pi} |f(x)|^2dx < \infty$$

Then those signals can be represented by the infinite sum of complex exponentials:

$$f(x) = \sum_{n=-\infty}^\infty{ c_n e^{inx} }$$

Where each of the $c_n$ are found as their "correlation" with that complex exponential:

$$c_n = \frac{1}{2\pi} \int_0^{2\pi} f(x) e^{-inx} dx$$

This works because $e^{inx}$ with $n= \ldots, -1, 0, 1, \ldots$ is an orthonormal basis of $L^2(0,2\pi)$, so we can represent any function in $L^2(0,2\pi)$ as this sum of the complex exponentials.

My question is, how do we know that the complex exponentials span $L^2$, that space of $2\pi$ square integrable functions?

-
Are you familiar with Stone Weierstrauss? – mixedmath Apr 7 '12 at 0:07
See also: Parseval's identity and Bessel's inequality (equality in Bessel's inequality is equivalent to saying that you have an orthonormal basis). – t.b. Apr 7 '12 at 0:16
Technically it is the closure of the span. – copper.hat Apr 7 '12 at 0:41

Here is one explanation (I will gloss over many technical details, but it should give an idea at least):

Fix some $N$, and consider the subset $S_N$ of $[0,2\pi]$ consisting of the points $0, 2\pi/N, 4\pi/N, \ldots, (N-1)2\pi/N$.

Straightforward linear algebra shows that a function on the finite set $S_N$ can be written uniquely as a linear combination of the exponentials $e^{i n x}$, for $0 \leq n \leq N-1$.

Precisely, if $\phi$ is a function on $S_N$, then $\phi(x) = \sum_{n=0}^{N-1} a_n e^{2\pi i n/N},$ where $$a_n = \dfrac{1}{N}\sum_{n = 0}^{N-1} \phi(x) e^{-2\pi i n/N}.$$

This is finite Fourier theory. We will now show that Fourier theory for functions on $[0,2\pi]$ is a kind of limit of the finite theory.

Suppose now that a continuous function $f$ is orthogonal to every complex exponential, i.e. such that all the $c_n$ vanish. Let $\phi$ be the restriction of $f$ to $S_N$. Since $f$ is continuous, if we take $N$ very large, then it will be nearly constant between the various points of $S_N$, and so the sum computing the $a_n$ for $\phi$ will be very nearly equal to the integral computing the $c_n$ for $f$. But these $c_n = 0$ by assumption, so the $a_n$ for $\phi$ will be very small. Hence $f$ will be very small in value on $S_N$.

Letting $N \to \infty$, the approximation will get better and better, and so, since the union of the $S_N$ is dense in $[0,2\pi]$, we will conclude that in fact $f$ vanishes on $[0,2\pi]$.

Now an interpolation argument, using the fact that continuous functiosn are dense in $L^2$, will show that in fact any $L^2$ function orthogonal to all the $e^{i n x}$ must vanish. Thus the span of the $e^{i n x}$ has zero orthogonal complement in $L^2$, and hence this span must be dense in $L^2$, as required.

-