Fourier Series allow periodic functions to be broken down into linear combinations sine and cosine waves. Consequently they are extremely important in many areas of applied mathematics, particularly in frequency analysis. In many situations they can be used to solve differential equations, such as the wave equation.

#### Definition

Let f(x) be a real periodic square integrable function with period 2L. The Fourier Series is defined as

inf               inf
f(x) = a0 +  Σ ancos(nπx/L) +  Σ bnsin (nπx/L).
n=1               n=1
where the coefficients are determined by the integrals
an = 1/L integral(f(x)cos(nπx/L)dx, x=0...2L)
bn = 1/L integral(f(x)sin(nπx/L)dx, x=0...2L).

#### Justification

The Fourier series works because the functions cos(nπx/L) and sin(nπx/L) form a complete orthogonal set of the space of square integrable functions on the interval from 0 to 2L. We have the orthogonality relations for n,m>0 of the form

integral(sin(nπx/L)sin(mπx/L)dx, x=0...2L) = L δmn
integral(cos(nπx/L)cos(mπx/L)dx, x=0...2L) = L δmn
integral(cos(nπx/L)sin(mπx/L)dx, x=0...2L) = 0
where δmn is the Kronecker Delta. Now assume we have an expression of the form as above, and we wish to determine the coefficient bm. Multiply the relation by sin(mπx/L) to obtain
inf                         inf
f(x) sin(mπx/L)= a0sin(mπx/L) +  Σ ancos(nπx/L)sin(mπx/L) +  Σ bnsin (nπx/L)sin(mπx/L).
n=1                         n=1
We now integrate both sides from 0 to 2L. By the orthogonality relations, all the integrals vanish except for the term involving bm. Hence
integral(f(x)sin(mπx/L)dx, x=0...2L) = L bm
which gives the required result. The am's can be determined in a similar way by multiplying through by cos(mπx/L) and integrating.

#### Example

Consider a sawtooth wave, given by f(x)=x on the open interval (-L,L), which is periodic with period 2L.

f(x)
|
/     |   /         /
/      |  /         /
/       | /         /
/        |/         /
----+----+----+----+---- x
-L  /|    L   /2L
/ |       /
/  |      /
/   |     /
|

Then by above we have

an = 1/L integral(x cos(nπx/L)dx, x=-L...L)
= 0,
by symmetry. Using integration by parts we obtain
bn = 1/L integral(x sin(nπx/L)dx, x=-L...L)
= 2/L integral(x sin (nπx/L)dx, x=0...L)
= 2/L (-L/(nπ))(Lcos(nπL/L) - Lcos(nπ0/L)) + 2/(nπ) integral(cos(nπx/L),x=0...L)
= -2L/(nπ)cos(nπ)
= 2L/(nπ) (-1)n+1.
From this we deduce that
inf
f(x) = Σ 2L/(nπ) (-1)n+1 sin (nπx/L)
n=1

= 2L/π (sin(πx/L) - sin(2πx/L)/2 + sin(3πx/L)/3 - sin(4πx/L)/4 + ... )
Even for a simple example such as this we have derived a remarkable result: not the sort thing that one could guess.

#### Complex representation

If the input function f(x) is complex, then we have an alternative formulation

inf
f(x) =  Σ cn exp(inπx/L)
n=-inf
where the coefficients are determined by
cn = 1/(2L) integral(f(x)exp(-inπx/L)dx, x=-L...L).