Fourier series and Hilbert spaces
The idea behind Fourier series is to try and express some function on a domain [−L,L] into a sum of complex exponentials of the form $\frac{1}{\sqrt{2L}}e^{2\pi i \ nx/L}$. One of the reasons this is interesting is that the complex exponentials are orthonormal system under the dot product $\int f(x)\overline{g(x)}\ dx$.
One can start by considering the vector space V of all square-integrable functions on [−L,L] – this gives us a vector space with an inner product. Specifically, we're interested in the subspace Vn that is the span of complex exponentials upto n and − n.Then given a vector f in V, we can ask for its projection fn onto Vn.
As the complex exponentials are already orthonormal, it is easy to calculate this projection in their basis:
$$\begin{gathered} {a_k} = \left\langle {f,\frac{1}{\sqrt{2L}}{e^{2\pi i\;nx/L}}} \right\rangle = \int\limits_{ - L}^L {f(x)\frac{e^{ - 2\pi i\;kx/L}}{\sqrt{2L}}dx} \hfill \\ {f_n}(x) = \sum\limits_{|k|\le n} {{a_k}\frac{e^{2\pi i\;kx/L}}{\sqrt{2L}}} \hfill \\ \end{gathered} $$
Notably this implies by Cauchy-Schwarz that:
$${\left| f \right|^2} \geqslant \sum\limits_{|k| \leqslant n} {{{\left| {{a_k}} \right|}^2}} $$
This really just is Cauchy-Schwarz, and is known as Bessel's inequality. If we can show that the Fourier series approaches f, i.e. that ∥f−fn∥ → 0, then it would be obvious that
$${\left| f \right|^2} = \sum\limits_{|k| \in \mathbb{Z}} {{{\left| {{a_k}} \right|}^2}} $$
Which is just the Pythagoras theorem, and is known as *Parseval's theorem*. Obviously, these theorems exist in the general theory of Hilbert spaces.