Why do we call a Fourier series a series of complex exponentials?
Euler's formula is $$e^{{ix}}=\cos x+i\sin x$$
I have recently learned that a periodic function can be decomposed into an infinite series of cosines and sines. However, in the formulas that I've seen, this was a simple sum, without the imaginary number, i.e. $$\sum_{i=0}^{\infty} a_i\cdot \cos(x)+b_i\sin(x)$$
There is no imaginary number here, unlike in the Euler formula where there is an imaginary number in the right hand side.
How then do we justify using complex exponentials in fourier series, given that this adds an imaginary number to a function that is real-valued?
Solution 1:
If the coefficients satisfy a simple relationship, the series will have a real value: since $$ \cos{x} = \frac{e^{ix}+e^{-ix}}{2}, \qquad \sin{x} = \frac{e^{ix}-e^{-ix}}{2i} $$ (this comes from two instances of Euler's formula, for example), we have $$ a_n \cos{nx}+b_n\sin{nx} = a_n \frac{e^{inx}+e^{-inx}}{2} + b_n \frac{e^{inx}-e^{-inx}}{2i} = \frac{a_n-ib_n}{2} e^{inx} + \frac{a_n+ib_n}{2} e^{-inx}. $$ In particular, one coefficient is the complex conjugate of the other. Inverting this, if we have a Fourier series $$ \sum_{n=-\infty}^{\infty} c_n e^{inx}, $$ the series is real if and only if $c_{-n} = c_n^*$ (and we find $a_n = c_n+c_{-n} $, $ b_n = i(c_n-c_{-n}) $ ).
Why would we write it as complex exponentials? Firstly, $\int_{-\pi}^{\pi} e^{inx} f(x) \, dx$ is often easier to calculate than the trigonometric forms, secondly, we only have to do one integral instead of (often) three: one for the constant term, one for the cosine part and one for the sine part, and thirdly, many other important formulae are simpler written in terms of the $c_n$: for example, Parseval/Plancherel is $$ \frac{1}{2\pi}\int_{-\pi}^{\pi} \lvert f(x) \rvert^2 \, dx = \sum_{n=-\infty}^{\infty} \lvert c_n \rvert^2 $$ instead of $$ \frac{1}{2\pi}\int_{-\pi}^{\pi} \lvert f(x) \rvert^2 \, dx = \frac{a_0^2}{4} +\frac{1}{2}\sum_{n=1}^{\infty} a_n^2 + b_n^2 $$
That's not to say the real form doesn't have its uses: if we want to keep everything real, we use it (particularly in applications like solving Laplace's equation, for example), or if the function is clearly odd or even, we only have to calculate one set of coefficients, and the work is effectively halved.
Solution 2:
The Fourier series expansion of a periodic function can be expressed in trigonometric form as
$$f(x) = \frac{a_0}{2}+\sum_{n=1}^{\infty} a_n\cos(nx) + b_n\sin(nx),$$
and we can find the coefficients as below: $$ \int_{-\pi}^{\pi}f(x) = \int_{-\pi}^{\pi}\frac{a_0}{2} dx + \sum_{n=1}^{\infty}a_n \int_{-\pi}^{\pi}\cos(nx) dx +\sum_{n=1}^{\infty}b_n \int_{-\pi}^{\pi}\sin(nx) dx $$
where $\int_{-\pi}^{\pi}\cos(nx) = 0$ and $\int_{-\pi}^{\pi}\sin(nx) = 0$. Then, $$ \implies a_0 = \frac{1}{\pi} \int_{-\pi}^{\pi}f(x)dx.$$
Here, we also can find the formula for $a_n$ and $b_n$ through straightforward calculation as
$$ \int_{-\pi}^{\pi}f(x)\cos(mx) = \frac{a_0}{2}\int_{-\pi}^{\pi}\cos(mx) dx + \sum_{n=1}^{\infty}a_n \int_{-\pi}^{\pi}\cos(nx)\cos(mx) dx \\+\sum_{n=1}^{\infty}b_n \int_{-\pi}^{\pi}\sin(nx)\cos(mx) dx $$
where $$ \int_{-\pi}^{\pi}\cos(nx)\cos(mx) dx = \begin{cases} \pi & n = m \\ 0 & n \neq m \end{cases}, $$
$$ \int_{-\pi}^{\pi}\cos(mx) dx = \frac{1}{m}\sin{mx}|_{-\pi}^{\pi} = 0,$$ $$ \int_{-\pi}^{\pi}\sin(nx)\cos(mx) dx = 0$$ notice that here, $\sin(nx)\cos(mx)$, is an odd function. Then we have:
$$\implies a_n = \frac{1}{\pi} \int_{-\pi}^{\pi}f(x)\cos(nx)dx.$$ Also, the same procedure for $b_n$ leads to: $$\implies b_n = \frac{1}{\pi} \int_{-\pi}^{\pi}f(x)\sin(nx)dx.$$
Now, for the Fourier series conversion from the Real form to the complex form we use the Euler's formula we have:
$$f(x) = \frac{a_0}{2}+\sum_{n=1}^{\infty} a_n [\frac{e^{inx}+e^{-inx}}{2}]+ b_n[\frac{e^{inx}-e^{-inx}}{2i}],$$
then we have
$$f(x) = \frac{a_0}{2}+\sum_{n=1}^{\infty} \frac{1}{2} [a_n -ib_n]e^{inx} + \frac{1}{2} [a_n +ib_n]e^{-inx},$$
and finally we have:
$$f(x) = \sum_{n=-\infty}^{\infty} c_n e^{inx} ,$$
where:
$$ c_n = \begin{cases} \frac{1}{2} [a_n -ib_n] & n \geq 0 \\ \frac{1}{2} [a_{|n|} +ib_{|n|}] & n \leq 0 \\ \frac{1}{2} a_0 & n = 0 \end{cases}, $$
in which the coefficients $c_n$ are called the complex Fourier coefficients can be written in a closed form as
$$\implies c_n = \frac{1}{2\pi} \int_{-\pi}^{\pi}f(x)e^{-inx}dx.$$
As it is shown, the imaginary number you mentioned is somehow hidden inside the "$cosine$" and "$sine$" which comes out by using its expansion in terms of complex exponentials. Also, notice the difference of the range of summation in two formula!
For an orthonormal basis $\;\{\varphi_i\}\;$:
$$\langle f(x)\,,\,f(x)\rangle=\frac1{\pi}\int\limits_{-\pi}^{\pi}|f(x)|^2dx=\sum_{m=-\infty}^\infty\sum_{k=-\infty}^\infty c_m\overline{c_k}\langle \varphi_m\,,\,\varphi_k\rangle=\sum_{m=-\infty}^\infty|c_m|^2\\ \quad =\frac{a_0^2}{2}+\sum_{n=1}^{\infty} (a_n^2 +b_n^2)$$
where from the orthonormality conditions
$$\langle \varphi_m\,,\,\varphi_k\rangle=\begin{cases}1&,\;\;\;m=k\\{}\\0&,\;\;\;m\neq k\end{cases}.$$
this result is called Parseval's energy theorem (which is represented based on Fourier coefficients of two forms).
Furthermore, about the usage, based on the problem you can use suitable form to have more meaningful representation with easier calculations. For instance, the exponential representation has the same information as the other forms, however, it is preferred due to its less and simpler calculations. On the other hand, trigonometric form, can be easily visualized in terms of sum of cosine and sine functions.
As from trigonometric form, the Fourier series of an even function only consists of cosine terms and an odd function only consists of sine terms.
From the signal processing viewpoint, by Fourier series representation, it is possible to write a periodic function in terms of "$\sin$" and "$\cos$"function from low to high frequency; here, $x = 2\pi \text{f}_0$ consists of the fundamental frequency, $\text{f}_0$, which signal can be written in terms of all its frequency components. A figure from Wiki is shown below. As it is noticeable from figure below, the low frequency components have the most essential part of the original periodic square wave; as the $n$ increases, means by adding higher frequencies, the Fourier series $\text{f}$ gets more and more similar to the original function, here $\text{F}$. Moreover, to reach the square shape, we need to add infinite terms to have the sudden changes or such instant discontinuities.
Reference for figure: https://en.wikipedia.org/wiki/Fourier_series
$\hskip2in$