# Fourier Series Formula

A Fourier series is an expansion of a periodic function

$$\begin{array}{l}f(x)\end{array}$$
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 =

$$\begin{array}{l}\frac{1}{\pi} \int_{- \pi}^{\pi} f(x) dx\end{array}$$

an =Â

$$\begin{array}{l}\frac{1}{\pi} \int_{-\pi}^{\pi} f(x)cos\;nx\;dx\end{array}$$

bn =Â

$$\begin{array}{l}\frac{1}{\pi} \int_{-\pi}^{\pi}f(x)sin\;nx\;dx\end{array}$$

n = 1, 2, 3…..

### Solved Example

Question: Expand the function f(x) = ekxÂ in the interval [Â –

$$\begin{array}{l}\pi\end{array}$$
,
$$\begin{array}{l}\pi\end{array}$$
]Â using fourier series.

Solution:

Let the Fourier series for f(x) be

f(x) =

$$\begin{array}{l}\frac{1}{2}\end{array}$$
ao +
$$\begin{array}{l}\sum_{n=1}^{\infty}\end{array}$$
(ancos(nx) + bnsin(nx))

Here

a0 =

$$\begin{array}{l}\frac{1}{\pi}\end{array}$$
$$\begin{array}{l}\int_{-\pi}^{\pi}\end{array}$$
f(x) dx

=

$$\begin{array}{l}\frac{1}{\pi}\end{array}$$
$$\begin{array}{l}\int_{-\pi}^{\pi}\end{array}$$
ekxdx

=

$$\begin{array}{l}\frac{1}{k \pi}\end{array}$$
[ekx
$$\begin{array}{l}]_{-\pi}^{\pi}\end{array}$$

=

$$\begin{array}{l}\frac{1}{k \pi}\end{array}$$
(ekÏ€Â – e-kÏ€Â )

=

$$\begin{array}{l}\frac{2}{k \pi}\end{array}$$
sinh( k
$$\begin{array}{l}\pi\end{array}$$
)

Now,

an =

$$\begin{array}{l}\frac{1}{\pi}\end{array}$$
$$\begin{array}{l}\int_{- \pi}^{\pi}\end{array}$$
ekx cos (nx) dx

=

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

=

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

=

$$\begin{array}{l}\frac{k cos(n \pi)}{\pi (k^2 + n^2)}\end{array}$$
Â
$$\begin{array}{l}[e^{k \pi} – e^{-k \pi}]\end{array}$$

= 2k (-1)n

$$\begin{array}{l}\frac{sinh(k \pi)}{\pi (k^2 + n^2)}\end{array}$$

and

bn =

$$\begin{array}{l}\frac{1}{\pi}\end{array}$$
$$\begin{array}{l}\int_{-\pi}^{\pi}\end{array}$$
ekx sin(nx) dx

=

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

=

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

=

$$\begin{array}{l}\frac{-n cos(n \pi)}{\pi(k^2 + n^2)}\end{array}$$
$$\begin{array}{l}[e^{k \pi} – e^{-k \pi}]\end{array}$$

=

$$\begin{array}{l}\frac{-2n(-1)^n sinh(k \pi)}{\pi(k^2 + n^2)}\end{array}$$

Substituting these values of ao ,an ,bn we get

f(x) = ekx =

$$\begin{array}{l}\frac{1}{k \pi}\end{array}$$
sinh(k
$$\begin{array}{l}\pi\end{array}$$
) +
$$\begin{array}{l}\sum_{n=1}^{\infty}\end{array}$$
$$\begin{array}{l}\frac{2 (-1)^{n} sinh(k \pi)}{\pi(k^{2} + n^{2})}\end{array}$$
Â (a
$$\begin{array}{l}\;\end{array}$$
cos(nx) – n
$$\begin{array}{l}\;\end{array}$$
sin(nx))
$$\begin{array}{l}\frac{2 sinh(k \pi)}{\pi}\end{array}$$
$$\begin{array}{l}\frac{1}{2k}\end{array}$$
+
$$\begin{array}{l}\sum_{1}^{\infty}\end{array}$$
$$\begin{array}{l}\frac{(-1)^{n}}{k^{2} + n^{2}}\end{array}$$
(k
$$\begin{array}{l}\;\end{array}$$
cos(nx) – n
$$\begin{array}{l}\;\end{array}$$
sin(nx))]

or

ekx =

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