# Fourier Series Formula

A Fourier series is an expansion of a periodic function $f(x)$ in terms of an infinite sum of sines and cosines. It decomposes any periodic function or periodic signal into the sum of a set of simple oscillating functions, namely sines and cosines.

$\large f(x)=\frac{1}{2}a_{0}+\sum_{n=1}^{\infty}a_{n}cos\;nx+\sum_{n=1}^{\infty}b_{n}sin\;nx$

Where
ao = $\frac{1}{\pi} \int_{- pi}^{\pi} f(x) dx$

an = $\frac{1}{\pi} \int_{-\pi}^{\pi} f(x)cos\;nx\;dx$

bn = $\frac{1}{\pi} \int_{-\pi}^{\pi}f(x)sin\;nx\;dx$

n = 1, 2, 3…..

Solved Examples

Question: Expand the function f(x) = ekx in the interval [ – $\pi$ , $\pi$ ] using fourier series ?

Solution:

Let the Fourier series for f(x) be

f(x) = $\frac{1}{2}$ ao + $\sum_{n=1}^{\infty}$ (ancos(nx) + bnsin(nx))

Here

a0 = $\frac{1}{\pi}$ $\int_{-\pi}^{\pi}$ f(x) dx

= $\frac{1}{\pi}$ $\int_{-\pi}^{\pi}$ ekxdx

= $\frac{1}{k \pi}$ [ekx $]_{-\pi}^{\pi}$

= $\frac{1}{k \pi}$ (ekx – e-kx )

= $\frac{2}{k \pi}$ sinh( k $\pi$ )

Now,

an = $\frac{1}{\pi}$ $\int_{- \pi}^{\pi}$ ekx cos (nx) dx

= $\frac{e^{(kx)}}{\pi(k^2+n^2))}$ $[(k cos(nx) + n sin(nx))]_{-\pi}^{\pi}$

= $\frac{1}{\pi(k^2 + n^2)}$ $[e^{k \pi} (k cos(n \pi) + n sin(n \pi)) – e^{-k \pi} [k cos(n \pi) – n sin (n \pi) ]$

= $\frac{k cos(n \pi)}{\pi (k^2 + n^2)}$ $[e^{k \pi} – e^{-k \pi}]$

= 2k (-1)n$\frac{sinh(k \pi)}{\pi (k^2 + n^2)}$

and

bn = $\frac{1}{\pi}$ $int_{-\pi}^{\pi}$ ekx sin(nx) dx

= $\frac{e^{(kx)}}{\pi(k^2 + n^2)}$ $[k sin(nx) – n cos(nx) ]_{-\pi}^{\pi}$

= $\frac{1}{\pi(a^2 + n^2)}$ $[e^{k \pi}(k sin(n \pi) – n cos(n \pi)) – e^{-k \pi} (-k sin (n \pi) – n cos(n \pi)) ]$

= $\frac{-n cos(n \pi)}{\pi(k^2 + n^2)}$ $[e^{k \pi} – e^{-k \pi}]$

= $\frac{-2n(-1)^n sinh(k \pi)}{\pi(k^2 + n^2)}$

Substituting these values of ao ,an ,bn we get

f(x) = ekx = $\frac{1}{k \pi}$ sinh(k $\pi$) + $\sum_{n=1}^{\infty}$ $\frac{2 (-1)^{n} sinh(k \pi)}{\pi(k^{2} + n^{2})}$ (a$\;$cos(nx) – n $\;$sin(nx)) $\frac{2 sinh(k \pi)}{\pi}$ $\frac{1}{2k}$ + $\sum_{1}^{\infty}$ $\frac{(-1)^{n}}{k^{2} + n^{2}}$ (k $\;$cos(nx) – n $\;$sin(nx))]

or

ekx = $\frac{2sinh(k \pi)}{\pi}$ $\frac{1}{2k}$ – k [$\frac{cos x}{k^{2} + 1^{2}}$ – $\frac{cos 2x}{k^{2} + 2^{2}}$ + $\frac{cos 3x}{k^{2} + 3^{2}}$ – ….] + [$\frac{sin x}{k^{2} + 1^{2}}$ – $\frac{2\;sin\;2x}{k^{2} + 2^{2}}$ + $\frac{3\; sin\; 3x}{k^{2} + 3^{2}}$ -…..) ]