Fourier Series Mathmatics
Fourier Series Mathmatics
Fourier Series Mathmatics
Here two different sine waves add together to make a new wave:
+
=
Square Wave
Can we use sine waves to make a square wave?
-h
-π 0 π
-π 0 π
-π 0 π
Can you see how it starts to look a little like a square wave?
-π 0 π
-π 0 π
-π 0 π
And if we could add infinite sine waves in that pattern we would have a square
wave!
By adding infinite sine (and or cosine) waves we can make other functions, even if
they are a bit weird.
You might like to have a little play with:
And it is also fun to use Spiral Artist and see how circles make waves.
They are designed to be experimented with, so play around and get a feel for the
subject.
First let us write down a full series of sines and cosines, with a name for all
coefficients:
∞ ∞
π
f(x) = a0 + Σ an
n=1
cos(nx ) +
L Σ bn sin(nx πL )
n=1
Where:
∞
π
What does Σ
n=1
an cos(nx
L
) mean?
It uses Sigma Notation to mean sum up the series of values starting at n=1:
a1 cos(1x π/L)
a2 cos(2x π/L)
etc
We do not (yet) know the values of a1, a2 etc.
a0 =
1
2L ∫ f(x) dx
−L
L
an =
1
L ∫ f(x) cos(nx
π ) dx
L
−L
L
bn =
1
L ∫ f(x) sin(nx
π ) dx
L
−L
π
f(x) sin(nx )
L
between −L and L
We can often find that area just by sketching and using basic calculations, but other
times we may need to use Integration Rules .
Take our target function, multiply it by sine (or cosine) and integrate (find the area)
And after we calculate all coefficients, we put them into the series formula above.
Let us see how to do each step and then assemble the result at the end!
-h
-π 0 π
a0 is the net area between −L and L, then divided by 2L. It is basically an average
of f(x) in that range.
-h
-π 0 π
The net area of the square wave from −L to L is zero.
So we know that:
a0 = 0
π
π ) dx
a1 =
1
π ∫ f(x) cos(1x
π
−π
Now, because the square wave changes abruptly at x=0 we need to break the
calculation into −π to 0 and 0 to π,
0
1
π
∫ −h cos(x) dx
−π
0
−h
π
∫ cos(x) dx
−π
-h
-π 0 π
The net area of cos(x) from -π to 0 is zero.
0
−h
π
∫ cos(x) dx = 0
−π
-π 0 π
The net area of cos(x) from 0 to π is zero.
a1 = 0
-h
-π 0 π
The net area of cos(2x) from -π to 0 is zero.
And:
-π 0 π
The net area of cos(2x) from 0 to π is also zero.
So we know that:
a2 = 0
In fact we can extend this idea to every value of a and conclude that:
an= 0
So far there has been no need for any major calculations! A few sketches and a little
thought have been enough.
π
π ) dx
b1 =
1
π ∫ sin(1x
π
−π
π
b1 =
1
π ∫ sin(x) dx
−π
and as before, because of the abrupt change at x=0, we need to break the
calculation into −π to 0 and 0 to π,
0
−h
π
∫ sin(x) dx
−π
-2 -h
-π 0 π
How do we know the area is −2?
Then we calculate the definite integral between −π and 0 by calculating the value of
−cos(x) for 0, and for −π, and then subtracting:
[−cos(0)] − [−cos(−π)] = −1 − 1 = −2
−h
(−2)
π
h
+2
-h
-π 0 π
1 4h
b1 = [ (−h) × (−2) + (h) × (2) ] =
π π
-h
-π 0 π
The net area of sin(2x) from −π to 0 is zero.
b2 = 0
π
−h
π ∫ sin(3x) dx
−π
-h
-π 0 π
Two areas cancel, but the third one is important!
For 0 to π we have:
h
-h
-π 0 π
Again two areas cancel, but not the third
b1 4h
b3 = =
3 3π
-h
-π 0 π
When n is even the areas cancel for a result of zero.
-h
-π 0 π
When n is odd, all except one area cancel for a result of 1/n.
So we can say
4h
bn = when n is odd, but 0 otherwise
nπ
And we arrive at our last step: putting the coefficients into the master formula:
∞ ∞
π
f(x) = a0 + Σ an
n=1
cos(nx ) +
L Σ bn sin(nx πL )
n=1
a0 = 0
an = 0 (all of them!),
bn = 0 when n is even
4h
bn = when n is odd
nπ
So:
4h sin(3x) sin(5x)
f(x) = [ sin(x) + + + ... ]
π 3 5
In conclusion:
Think about each coefficient, sketch the functions and see if you can find a pattern,
put it all together into the series formula at the end
Why not try it with "sin((2n-1)*x)/(2n-1)", the 2n−1 neatly gives odd values, and
see if you get a square wave.
Other Functions
Of course we can use this for many other functions!
But we must be able to work out all the coefficients, which in practice means that we
work out the area of:
the function
the function times sine
the function times cosine
But as we saw above we can use tricks like breaking the function into pieces, using
common sense, geometry and calculus to help us.
∞ ∞
π
f(x) = a0 + Σ an
n=1
cos(nx ) +
L Σ bn sin(nx πL )
n=1
But when the function f(x) has a period from -π to π we can use a simplified version:
∞ ∞
f(x) = a0 + Σ an cos(nx) + Σ bn sin(nx)
n=1 n=1
Or there is this one, where a0 is rolled into the first sum (now n=0 to ∞):
∞ ∞
f(x) = Σ an cos(nx) + Σ bn sin(nx)
n=0 n=1
But I prefer the one we use here, as it is more practical allowing for different periods.