Orthonormal basis for $\mathcal{L}^2([0,1])$ $\textbf{Theorem:}$ The orthonormal family $\{e_n(x):\, n\in\mathbb{N}\}$, where $e_n(x)=e^{2\pi inx}$, is a basis for $\mathcal{L}^2([0,1])$.
In this case, $\{e_n(x):\, n\in\mathbb{N}\}$ being a basis would mean that any $f\in\mathcal{L}^2([0,1])$ can be written in the form
$$f=\sum^\infty_{k=0} \hat{f}(k)e_k(x)$$
where $$\hat{f}(k)=\langle f,e_k\rangle =\int_{[0,1]} f(x)\overline{e_k(x)} \ \text{d}x$$
I am attempting to get a solution in which we can say
$$\left\vert\left\vert f-\sum^k_{k=0}\hat{f}(k)e_k(x)\right\vert\right\vert\rightarrow 0 \ \ \text{as} \ \ n\rightarrow \infty$$
via Parsevals and Plancheral Identities, but I have been unable to do so.
Any hints please?
 A: This is an old question, but it's not an uncommon exercise, so I think that it's worth having an approach sketched. 
The orthonormal basis for $L^2([0,1])$ is given by elements of the form $e_n=e^{2\pi i nx},$ with $n\in\mathbb{Z}$ (not in $\mathbb{N}$). Clearly, this family is an orthonormal system with respect to $L^2$, so let's focus on the basis part. One of the easiest ways to do this is to appeal to the Stone-Weierstrass theorem. Here are the general steps:
Consider the set $\mathcal{A}$ consisting of all finite linear combinations of elements $e_n$, where $n$ ranges over $\mathbb{Z}$ (i.e. the linear span). This is clearly a subspace of the continuous functions on $[0,1]$. Show that


*

*$\mathcal{A}$ forms a unital sub-algebra over $\mathbb{C}$. That is, show that if $f,g\in\mathcal{A}$ and $c\in\mathbb{C},$ then $cf,\ f+g,\ fg, 1\in \mathcal{A}$.

*$\mathcal{A}$ separates points. That is, show that if $x,y\in [0,1]$ with $x\neq y,$ then there exists $f_{xy}\in \mathcal{A}$ so that $f_{xy}(x)\neq f_{xy}(y).$

*$\mathcal{A}$ is self-adjoint. That is, show that if $f\in\mathcal{A}$, then $\bar{f}\in \mathcal{A}.$
None of these steps are particularly hard, using the properties $e^{2\pi i nx}e^{2\pi i mx}=e^{2\pi i (n+m)x}$ and $\overline{e^{2\pi i nx}}=e^{-2\pi i n x}.$ Stone-Weierstrass will tell you that the linear span is dense in continuous functions, which you can extend to density in $L^2$ (using that continuous functions are dense in $L^2$). This tells you that this orthonormal system is, indeed, an orthonormal basis for $L^2.$ 
