Motivation for the Fourier series

For $L>0$, we define the vector space $V$ be the set of "nice" functions $f: \R\to\C$ that are $L$-periodic, i.e. $f(\theta + L) = f(\theta)$ for all $\theta$.

Equip $V$ with an inner product $$ \begin{align*} \langle f,g\rangle = \int_{0}^{L} f(\theta)\overline{g(\theta)} \d \theta. \end{align*} $$

Note that if we define for each $n\in\Z$, $$ \begin{align*} e_n(\theta) = e^{2\pi in\theta/L}, \end{align*} $$ then we have $e_n\in V$ and $$ \begin{align*} \langle e_n, e_m\rangle = \int_{0}^{L} e^{2\pi i(n-m)\theta/L} \d \theta = L\delta_{nm}. \end{align*} $$ So $\set{e_n}$ is an orthogonal set in $V$ and $\|e_n\|^2 = L$. Is this a basis?

If we can write some $f\in V$ in the form $$ \begin{align*} f(\theta) = \sum_{n\in\Z} \hat f_n e_n(\theta), \end{align*} $$ then taking inner products of $f$ with $e_m$ gives $$ \begin{align*} \int_{0}^{L} f(\theta) e^{-2\pi im\theta/L} \d \theta &= \langle f,e_m\rangle \\ &= \sum_{n\in\Z} \hat f_n \langle e_n, e_m\rangle \\ &= \sum_{n\in\Z} \hat f_n L \delta_{nm} \\ &= L \hat f_m. \end{align*} $$ Therefore $$ \begin{align*} \hat f_n = \frac{1}{L} \int_{0}^{L} f(\theta) e^{-2\pi i n \theta/L} \d \theta \end{align*} $$ which is the Fourier coefficients.