First of all, recall that $$ f(x)\sim a_0+\sum_{n=1}^{\infty}\left(a_n\cos\frac{n\pi x}L+b_n\sin\frac{n\pi x}L\right),\tag{1} $$ where, by orthogonality principles, $$\begin{align} a_0&=\frac1{2L}\int_{-L}^Lf(x)\,dx,\\ a_n&=\frac1L\int_{-L}^Lf(x)\cos\frac{n\pi x}L\,dx,\\ b_n&=\frac1L\int_{-L}^Lf(x)\sin\frac{n\pi x}L\,dx. \end{align}$$ Now, recall Euler's formulas: $$ \cos\theta=\frac{e^{i\theta}+e^{-i\theta}}2,\qquad\text{and}\qquad\sin\theta=\frac{e^{i\theta}-e^{-i\theta}}{2i}. $$ It follows that we can rewrite equation $(1)$ as follows: $$ f(x)\sim a_0+\frac12\sum_{n=1}^{\infty}(a_n-ib_n)e^{\frac{n\pi ix}L}+\frac12\sum_{n=1}^{\infty}(a_n+ib_n)e^{-\frac{n\pi ix}L}. $$ Now, let's change the index of summation in the first term from $n$ to $-n$: $$ f(x)\sim a_0+\frac12\sum_{n=-1}^{-\infty}(a_{-n}-ib_{-n})e^{-\frac{n\pi ix}L}+\frac12\sum_{n=1}^{\infty}(a_n+ib_n)e^{-\frac{n\pi ix}L}. $$ It follows from the definition of $a_n$ and $b_n$ that $a_{-n}=a_n$ and $b_{-n}=-b_n$. Therefore, if we let $$\begin{align} c_0&=a_0,\\ c_n&=\frac{a_n+ib_n}2, \end{align}$$ we will have the following Fourier series: $$ f(x)\sim\sum_{n=-\infty}^{\infty}c_ne^{-\frac{in\pi x}{L}}, $$ where the coefficients are $$ c_n=\frac1{2L}\int_{-L}^Lf(x)e^{\frac{in\pi x}L}\,dx. $$
Complex Form of Fourier Series
I will talk about Fourier transforms in the next entry. To do so, I will first introduce a way to convert our Fourier series currently defined in terms of sines and cosines into Fourier series defined in terms of complex exponentials.