Fourier series
A Fourier series is nothing but the expansion of a periodic function f(x) with the terms of an infinite sum of sins and cosine values. It decomposes any periodic function or periodic signal into the sum of a set of simple oscillating functions, namely sines and cosines.
Fourier series formula
$$ f(x) = \frac 12 a_0 + \sum_{n=1}^\infty a_n \cos nx + \sum_{n=1}^\infty b_n \sin nx $$
where,
$$ a_0= \frac {1}{\pi} \int\limits_{-\pi}^{\pi} f(x)dx $$
$$ a_n= \frac {1}{\pi} \int\limits_{-\pi}^{\pi} f(x) \cos nx \ dx $$
$$ b_n= \frac {1}{\pi} \int\limits_{-\pi}^{\pi} f(x) \sin nx \ dx $$
Example:
Expand the function f(x) = ekx in the interval [ – π , π ] using fourier series.
Solution:
$$ f(x) = \frac 12 a_0 + \sum_{n=1}^\infty a_n \cos nx + \sum_{n=1}^\infty b_n \sin nx $$
Here,
$$ a_0= \frac {1}{\pi} \int\limits_{-\pi}^{\pi} f(x)dx $$
$$ a_0= \frac {1}{\pi} \int\limits_{-\pi}^{\pi} e^{kx} dx $$
$$ a_0= \frac {2}{k\pi} \sinh k\pi $$
$$ a_n= \frac {1}{\pi} \int\limits_{-\pi}^{\pi} f(x) \cos nx \ dx $$
$$ a_n= \frac {1}{\pi} \int\limits_{-\pi}^{\pi} e^{kx} \cos nx \ dx $$
$$ a_n= \frac {e^{kx}}{\pi (k^2+n^2)} [(k \cos nx)+(n \sin nx)]_{-\pi}^{\pi} $$
$$ a_n= \frac {k \cos n\pi}{\pi (k^2+n^2)} [e^{k\pi} – e^{-k\pi}] $$
$$ a_n= 2k (-1)^n \frac {\sinh k\pi}{\pi (k^2+n^2)} $$
$$ b_n= \frac {1}{\pi} \int\limits_{-\pi}^{\pi} f(x) \sin nx \ dx $$
$$ b_n= \frac {1}{\pi} \int\limits_{-\pi}^{\pi} e^{kx} \sin nx \ dx $$
$$ b_n= \frac {e^{kx}}{\pi (k^2+n^2)} [(k \sin nx)+(n \cos nx)]_{-\pi}^{\pi} $$
$$ b_n= -2n (-1)^n \frac {\sinh k\pi}{\pi (k^2+n^2)} $$
Putting all above values in the equation, we get the expansion of the above function:
$$ f(x) = e^{kx} = \frac {2 \sinh k\pi}{\pi} \frac {1}{2k} – k \left[ \frac {\cos x}{k^2+1^2}- \frac {\cos 2x}{k^2+2^2} + \frac {\cos 3x}{k^2+3^2}- \cdots \right]+ \left[ \frac {\sin x}{k^2+1^2}- \frac {2\sin 2x}{k^2+2^2} + \frac {3\sin 3x}{k^2+3^2}- \cdots \right] $$
$$ $$