# Fourier Series


# The Fourier Series

The Fourier Transform is an integral transform that re-expresses a
function in terms of sine waves. It was named after Joseph Fourier
(1768-1830) who is famous for, among other things, studying the propagation of
heat in solid bodies. In this he expanded functions as a trigonometrical
series, this was later to be known as the Fourier Series.

## The Fourier Series

A Fourier series is an expansion of a periodic function in terms of a sum
of sines and cosines. The Fourier series of a function $$f(x)$$ is given by

$$f(x)=\frac{1}{2}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_{-\pi}^{\pi}f(x) dx$$

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

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

what we are saying here is that the function $$f(x)$$ is made up of a
constant plus a sum of sine and cosine waves with different amplitudes and
frequencies.

### An example

An example may now be useful for understanding this. Lets look at periodic
square wave function

Since the function is periodic we only need to deal with the region
between $$-\pi$$ and $$\pi$$ and note that $$f(x) =1$$ over the region $$-\pi/2$$ to
$$\pi/2$$ and is zero everywhere else. The equation for $$a_{0}$$ now becomes

$$a_{0}=\frac{1}{\pi}\int_{-\pi/2}^{\pi/2}1 dx = \frac{1}{\pi}[x]_{-\pi/2}^{\pi/2}=1$$

and

$$a_{n}=\frac{2}{\pi n}sin(\frac{\pi n}{2})$$

which only exists when $$n$$ is odd and is zero when even.

And finally

$$b_{n}=0$$

So the Fourier series expansion of $$f(x)$$ is

$$f(x)=\frac{1}{2}+\sum_{n=1,3,5,…}^{\infty}\frac{2}{\pi n}\cos(nx)$$

We can see how the square wave is built up from the cosines by restricting
the summation to a limited number of terms and this is shown in the figure
below

The legend indicates the number of terms. When $$n=1$$ the graph is a cosine
wave. As $$n$$ increases more and more higher frequencies are added and the
series becomes closer to a square wave.

## Sine and Cosine Series

If the function, $$f(x)$$ is odd $$a_{n}$$ is always zeros and the function
can be described by the Fourier Sine Series. If the function is even (as
above) the $$b_{n}$$ term is zero and so it becomes the Fourier Cosine
Series.

 Aside: $$f(x)$$ is even if $$f(x)=f(-x)$$. An example is $$f(x) = cos(x)$$, and $$cos( \pi /2) = \cos(- \pi/2)$$.$$f(x)$$ is odd if $$f(x)=-f(-x)$$ and example is $$f(x)=sin(x)$$

## The Complex Fourier Series

From Euler’s equation we can rewrite our expansion series using complex
numbers.

$$\sin ( nx) = \frac{e^{i n x}-e^{-i n x}}{2i}$$

$$\cos ( nx) = \frac{e^{i n x}+e^{-i n x}}{2}$$

Re-expressing the Fourier series as

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

note that

$$a_{n} \cos(nx)+ b_{n} \sin(nx) = \frac{1}{2} a_{n}(e^{i n x}+e^{-i n x}) +\frac{1}{2i} b_{n}(e^{i n x}-e^{-i n x})$$

$$=\frac{1}{2}(a_{n}-ib_{n})e^{i n x}+\frac{1}{2}(a_{n}+ib_{n})e^{-i n x}$$

Now let

$$c_{n}=\frac{1}{2}(a_{n}-i b_{n}) = \frac{1}{2 pi} \int_{-\pi}^{\pi} f(x) e^{-i n x} dx$$

and

$$k_{n}=\frac{1}{2}(a_{n}+i b_{n}) = \frac{1}{2 \pi} \int_{-\pi}^{\pi} f(x) e^{i n x} dx$$

we can re-write the above as

$$f(x)=c_{0}+\sum_{n=1}^{\infty}(c_{n} e^{i n x} + k_{n} e^{-i n x} )$$

Note that $$k_{n}=c_{-n}$$ if we now define $$n= 0, \pm 1, \pm 2, \cdots$$ we
can now represent the expansion in the complex form where now

$$f(x)=\sum_{n=-\infty}^{\infty}c_{n}e^{i n x}$$

$$c_{n} =\frac{1}{2 \pi} \int_{-\pi}^{\pi} f(x) e^{-i n x} dx$$

In the above example the series was assumed to be periodic over a length
of $$L=2\pi$$. It doesn’t have to be $$2\pi$$, it could be any length although
the sine and cosines remain periodic over this region. The expansion becomes
the more compact

$$f(x)=\sum_{-\infty}^{\infty}c_{n}e^{\frac{i \pi n x}{L}}$$

and

$$c_{n}=\frac{1}{L}\int_{-L/2}^{L/2}f(x) e^{\frac{-i 2 \pi n x}{L}} dx$$

## The Transform

This all very well for describing a periodic function. But what if the
function is not periodic. We over come this by letting the period tend
towards infinity $$L \rightarrow \infty$$. More on how this is done later,
but for now we state the definitions.

The Fourier Transform (FT) is represented here by the operator $$\mathcal{F}{}$$.

The transform is

$$\FT{f(x)}=F(u)=\int_{-\infty}^{\infty} f(x) e^{-2 \pi i u x} dx$$

And the inverse is

$$\FT{-1}{F(u)}=f(x)=\int_{-\infty}^{\infty}F(u)e^{2 \pi i u x} dx$$

In two dimensions the transform is

$$\FT{f(x,y)}=F(u,v)=\int \int_{-\infty}^{\infty} f(x,y)e^{-2 \pi i (ux+vy)} dxdy$$

and the inverse is

$$\iFT{F(x,y)}=f(x,y)=\int \int_{-\infty}^{\infty} F(u,v)e^{2 \pi i (ux+vy)} dudv$$