Fourier Lectures Part1
Fourier Lectures Part1
U S
IT
TH
Y
O F
H
G
E
R
D I U
N B
Fourier Analysis
Prof. John A. Peacock
[email protected]
Session: 2013/14
1
1 Introduction
Describing continuous signals as a superposition of waves is one of the most useful concepts in
physics, and features in many branches - acoustics, optics, quantum mechanics for example. The
most common and useful technique is the Fourier technique, which were invented by Joseph Fourier
in the early 19th century. In many cases of relevance in physics, the waves evolve independently,
and this allows solutions to be found for many ordinary di↵erential equations (ODEs) and partial
di↵erential equations (PDEs). We will also explore some other techniques for solving common
equations in physics, such as Green’s functions, and separation of variables, and investigate some
aspects of digital sampling of signals.
As a reminder of notation, a single wave mode might have the form
Here, a is the wave amplitude; is the phase; and k is the wavenumber, where the wavelength is
= 2⇡/k. Equally, we might have a function that varies in time: then we would deal with cos !t,
where ! is angular frequency and the period is T = 2⇡/!. In what follows, we will tend to assume
that the waves are functions of x, but this is an arbitrary choice: the mathematics will apply equally
well to functions of time.
2 Fourier Series
Learning outcomes
In this section we will learn how Fourier series (real and complex) can be used to represent functions
and sum series. We will also see what happens when we use truncated Fourier series as an approx-
imation to the original function, including the Gibbs phenomenon for discontinuous functions.
2.1 Overview
Fourier series are a way of expressing a function as a sum, or linear superposition, of waves of
di↵erent frequencies: X
f (x) = ai cos(ki x + i ). (2.1)
i
This becomes more well specified if we consider the special case where the function is periodic with
a period 2L. This requirement means that we can only consider waves where a whole number of
wavelengths fit into 2L: 2L = n ) k = n⇡/L. Unfortunately, this means we will spend a lot of
time writing n⇡/L, making the formulae look more complicated than they really are.
A further simplification is to realize that the phase of the waves need not be dealt with explicitly.
This is because of the trigonometric identity (which you should know)
Thus a single wave mode of given phase can be considered to be the combination of a sin and a cos
mode, both of zero phase.
2
• Fourier Series deal with functions that are periodic over a finite interval. e.g. 1 < x < 1.
The function is assumed to repeat outside this interval.
• Fourier Series are useful if (a) the function really is periodic, or (b) we only care about the
function in a finite range (e.g. ⇡ < x < ⇡). We’ll discuss this more in Sec. 2.7.
• If the range is infinite, we can use a Fourier Transform (see section 3).
• We can decompose any function we like in this way (well, any that satisfy some very mild
mathematical restrictions).
• The sines and cosines are said to form a complete set. This means the same as the last bullet
point. We won’t prove this.
• One can decompose functions in other complete sets of functions (e.g. powers: the Taylor
series is an example of this), but the Fourier Series is perhaps the most common and useful.
Most of this course will be concerned with Fourier Series and Fourier Transforms (see later).
3
where an and bn are (real-valued) expansion coefficients, also known as Fourier components. The
reason for the unexpected factor 1/2 multiplying a0 will be explained below.
We don’t need to include negative n because the Fourier modes have a well defined symmetry (even
or odd) under n ! n: let’s imagine we included negative n and that the expansion coefficients
are An and Bn :
A0 X h ⇣ n⇡x ⌘ ⇣ n⇡x ⌘i
f (x) = + An cos + Bn sin (2.5)
2 ±n
L L
1 ⇣ n⇡x ⌘ ✓ ◆ ⇣ n⇡x ⌘ ✓ ◆
A0 X n⇡x n⇡x
= + An cos + A n cos + Bn sin + B n sin .
2 n=1
L L L L
(2.6)
n⇡x n⇡x n⇡x n⇡x
Now, cos L
= cos L
and sin L
= sin L
, so we can rewrite this as
A0 X h ⇣ n⇡x ⌘ ⇣ n⇡x ⌘i
1
f (x) = + (An + A n ) cos + (Bn B n ) sin . (2.7)
2 n=1
L L
At this point An and A n are unknown constants. As they only appear summed together (rather
than separately) we may as well just rename them as a single, unknown constant a0 = A0 , an ⌘
An + A n , (n 1). We do the same for bn ⌘ Bn B n . So, overall it is sufficient to consider just
positive values of n in the sum.
2.4 Orthogonality
Having written a function as a sum of Fourier modes, we would like to be able to calculate the
components. This is made easy because the Fourier mode functions are orthogonal i.e. for non-zero
integers m and n,
Z L ⇣ m⇡x ⌘ ⇣ n⇡x ⌘ ⇢ 0 m 6= n
dx cos cos = (2.8)
L L L L m=n
Z L ⇣ m⇡x ⌘ ⇣ n⇡x ⌘ ⇢ 0 m 6= n
dx sin sin = (2.9)
L L L L m=n
Z L ⇣ m⇡x ⌘ ⇣ n⇡x ⌘
dx cos sin =0. (2.10)
L L L
You can do the integrals using the trigonometry identities in Eqn. (2.14) below. Note that one of
the Fourier modes is a constant (the a0 /2 term), so we will also need
Z L ⇣ n⇡x ⌘ ⇢ 0 n 6= 0
dx cos = (2.11)
L L 2L n = 0
Z L ⇣ n⇡x ⌘
dx sin =0 (2.12)
L L
Note the appearance of 2L here, rather than L in the n > 0 cases above.
4
FOURIER ANALYSIS: LECTURE 2
The orthogonality is the fact that we get zero in each case if m 6= n. We refer to the collected
Fourier modes as an orthogonal set of functions.
Let us show one of these results. If m 6= n,
Z L ⇣ m⇡x ⌘ ⇣ n⇡x ⌘ Z ⇢ ⇢
1 L (m + n)⇡x (m n)⇡x
dx cos cos = dx cos + cos
L L L 2 L L L
2 n o n o 3L
(m+n)⇡x
1 4 L sin L
L sin (m Ln)⇡x
= + 5
2 (m + n)⇡ (m n)⇡
L
= 0 if m 6= n. (2.13)
ASIDE: useful trigonometric relations To prove the orthogonality, the following formulæ are
useful:
To derive these, we write ei(A±B) = eiA e±iB , and rewrite each exponential using e±i✓ = cos ✓ ± i sin ✓.
Add or subtract the two ± expressions and take real or imaginary parts as appropriate to get each
of the four results. Alternatively, the orthogonality can be proved using the complex representation
directly: cos(kx) = [exp(ikx) + exp( ikx)]/2, so a product of cosines always generates oscillating
terms like exp( ix k); these always integrate to zero, unless k = 0.
This works because all the terms in the series give zero, except the one we want. The procedure
with Fourier series is exactly analogous:
1. Choose which constant we wish to calculate (i.e. am or bm for some fixed, chosen value of m)
m⇡x
2. Multiply both sides by the corresponding Fourier mode (e.g. cos L
if we are interested in
am or sin m⇡x
L
if we are trying to find bm )
5
3. Integrate over the full range ( L x L in this case)
4. Rearrange to get the answer.
So, to get am :
Z L ⇣ m⇡x ⌘
dx cos f (x) (2.16)
L L
Z L ⇣ m⇡x ⌘
1
= a0 dx cos (2.17)
2 L L
X1 Z L ⇣ m⇡x ⌘ ⇣ n⇡x ⌘ Z L ⇣ m⇡x ⌘ ⇣ n⇡x ⌘
+ an dx cos cos + bn dx cos sin (2.18)
n=1 L L L L L L
1
X
= a0 .L m0 + L an mn (2.19)
n=1
= L am . (2.20)
(2.21)
6
1.0
0.8
0.6
0.4
0.2
x
-1.0 -0.5 0.0 0.5 1.0
|x|
Figure 2.1: e in 1 < x < 1.
i.e. the Fourier decomposition of an even function contains only even Fourier modes. Similarly, we
can show that
Z ⇣ m⇡x ⌘ Z ⇣ m⇡y ⌘ Z ⇣ m⇡x ⌘
1 L 1 L 2 L
am = dx cos f (x) + dy cos f (y) = dx cos f (x). (2.27)
L 0 L L 0 L L 0 L
For an odd function we get a similar result: all the am vanish, so we only get odd Fourier modes,
and we can calculate the bm by doubling the result from integrating from 0 ! L:
am = 0 (2.28)
Z L ⇣ m⇡x ⌘
2
bm = dx sin f (x) (2.29)
L 0 L
We derive these results as before: split the integral into regions of positive and negative x; make
a transformation y = x for the latter; exploit the symmetries of f (x) and the Fourier modes
cos m⇡x
L
, sin m⇡x
L
.
|x|
Example: f (x) = e for 1 < x < 1. The fundamental period is 2.
7
1.0
0.8
0.6
0.4
0.2
x
-1.0 -0.5 0.0 0.5 1.0
|x|
Figure 2.2: Fourier Series for e in 1 < x < 1 summed up to m = 1 and to m = 5.
( 1)m e 1
( 1)m e 1 1
1
am =
im⇡ 1 im⇡ + 1
1 1
= [( 1)m e 1 1]
im⇡ 1 im⇡ + 1
2
= [( 1)m e 1 1]
(im⇡ 1)(im⇡ + 1)
m 1
2[( 1) e 1]
=
m2 ⇡ 2 1
2[1 ( 1)m e 1 ]
= . (2.32)
1 + m2 ⇡ 2
8
f(x)=x 2
x
−3π −π π 3π
Inside the expansion range fFS (x) agrees exactly with the original function f (x). Outside, however,
it does not: f (x) keeps rising quadratically, whereas fFS (x) repeats with period 2L. We say the
Fourier series has periodically extended the function f (x) outside the expansion range. This is shown
in Fig. 2.3.
9
Figure 2.4: The Fourier spectrum an (with y-axis in units of L2 ) for function f (x) = x2 .
There are some special cases where fFS (x) does agree with f (x) outside the range. If f (x) is itself
periodic with period 2L/p (i.e. the size of the range divided by some integer p s.t. f (x + 2L/p) =
f (x)), then fFS (x) will agree with f (x) for all x.
Another special case is where f (x) is only defined in the finite range of expansion e.g. because we
are only considering a string extending from 0 to L. Physically, then it does not matter if fFS (x)
deviates from f (x) outside the range.
A plot of the coefficients, {cn } versus n, is known as the spectrum of the function: it tells us how
much of each frequency is present in the function. The process of obtaining the coefficients is often
known as spectral analysis. We show the spectrum for f (x) = x2 in Fig. 2.4.
Choice of periodic extension There is no unique way of casting f (x) as a periodic function,
and there may be good and bad ways of doing this. For example, suppose we were interested in
representing f (x) = x2 for 0 < x < L: we have already solved this by considering the even function
x2 over L < x < L, so the periodicity can be over a range that is larger than the range of interest.
Therefore, we could equally well make an odd periodic function by adopting +x2 for 0 < x < L and
x2 for L < x < 0. This is then suitable for a sin series. The coefficients for this are
Z ⇣ m⇡x ⌘ 1 Z 0 ⇣ m⇡x ⌘
1 L 2
bm = dx x sin + dx ( x2 ) sin
L 0 L L L L
Z L ⇣ ⌘ 2 ⇥
2 m⇡x 2L ⇤m⇡
= dx x2 sin = 3 3 y 2 cos y + 2y sin y + 2 cos y 0
L 0 L m⇡
2
2L
= 3 3 ⇥ [( 1)m+1 m2 ⇡ 2 + 2( 1)m 2] (2.35)
m⇡
So now we have two alternative expansions, both of which represent f (x) = x2 over 0 < x < L. To
10
lowest order, these are
L2 4L2 ⇣ ⇡x ⌘
cos : f (x) = cos + ··· (2.36)
3 ⇡2 L
2L2 ⇣ ⇡x ⌘
sin : f (x) = sin + ··· . (2.37)
⇡ L
It should be clear that the first of these works better, since the function does behave quadratically
near x = 0, whereas the single sin term is nothing like the target function. In order to get comparable
accuracy, we need many more terms for the sin series than the cos series: the coefficients for the
former decline as 1/m2 , as against only 1/m for the latter at large m, showing very poor convergence.
We now repeat the process for the integral on the RHS, setting u = 2y for the same reason:
Z Z
2 2
dy y cos y = y sin y 2y cos y + dy 2 cos y = y 2 sin y + 2y cos y 2 sin y . (2.43)
11
kn = n⇡/L is the wavenumber.
This is a complex Fourier series, because the expansion coefficients, cn , are in general complex
numbers even for a real-valued function f (x) (rather than being purely real as before). Note that
the sum over n runs from 1 in this case. (The plus sign in phase of the exponentials is a convention
chosen to match the convention used for Fourier Transforms in Sec. 3.)
Again, these basis functions are orthogonal and the orthogonality relation in this case is
8 9
Z L Z L < [x]L L = 2L (if n = m)=
dx m (x) ⇤n (x) = dx ei(km kn )x = h exp(i(km kn )x) iL = 2L mn .
L L : i(km kn )
= 0 (if n 6= m);
L
(2.46)
Note the complex conjugation of m (x): this is needed in order to make the terms involving k
cancel; without it, we wouldn’t have an orthogonality relation.
For the case n 6= m, we note that m n is a non-zero integer (call it p) and
As before, we exploited that the integral of a sum is the same as a sum of integrals, and that cn are
constants.
The complex approach may seem an unnecessary complication. Obviously it is needed if we have
to represent a complex function, but for real functions we need to go to some trouble in order to
make sure that the result is real:
1
X 1
X
f (x) = cn ein⇡x/L ) f (x) = f ⇤ (x) = c⇤n e in⇡x/L
(2.50)
n= 1 n= 1
Equating the coefficients of the eim⇡x/L mode, we see that the Fourier coefficients have to be Her-
mitian:
c⇤ m = cm . (2.51)
This shows why it was necessary to consider both positive and negative wavenumbers, unlike in the
sin and cos case.
But the advantage of the complex approach is that it is often much easier to deal with integrals
involving exponentials. We have already seen this when discussing how to prove the orthogonality
12
relations for sin and cos. Also, doing things this way saves having to do twice the work in obtaining
coefficients for sin and cos series separately.
The fact that complex exponentials contain both the sin and cos series in a single term also makes
sense of the extra factor of 12 everywhere in the orthogonality relations, relative to the real Fourier
series: this arises from the definition of sine and cosine in terms of complex exponentials.
2.8.2 Example
To show the complex Fourier approach in action, we revisit our example of expanding f (x) = x2
for x 2 [ L, L] (we could choose L = ⇡ if we wished). The general expression for the Fourier
coefficients, cm , takes one of the following forms, depending on whether or not m is zero:
Z L
1 L2
cm=0 = dx x2 = (2.52)
2L L 3
Z L
1 2L2 ( 1)m
cm6=0 = dx x2 e im⇡x/L = (2.53)
2L L m2 ⇡ 2
See below for details of how to do the second integral. We notice that in this case all the cm are
real, but this is not the case in general.
To make life easy, we should change variables to make the exponent more simple (whilst keeping y
real) i.e. set y = m⇡x/L, for which dy = (m⇡/L) dx. The integration limits become ±m⇡:
Z m⇡ Z m⇡
1 L L2 y 2 iy L2
cm = dy ⇥ e = dy y 2 e iy . (2.55)
2L m⇡ m⇡ m2 ⇡ 2 2m3 ⇡ 3 m⇡
Now we want to integrate by parts. We want the RHS integral to be simpler than the first, so we
set u = y 2 ) du = 2y dy and dv/dy = e iy ) v = e iy /( i) = ie iy (multiplying top and
bottom by i and recognising i ⇥ i = 1). So
⇢ Z m⇡ ⇢ Z m⇡
L2 ⇥ 2 iy ⇤m⇡ iy L2 ⇥ 2 iy ⇤m⇡
cm = iy e m⇡
dy 2y.ie = iy e m⇡
2i dy ye iy
2m3 ⇡ 3 m⇡ 2m 3⇡3
m⇡
(2.56)
13
The integral is now simpler, so we play the same game again, this time with u = y ) du/dy = 1
to get:
⇢ ✓ Z m⇡ ◆
L2 ⇥ 2 iy ⇤m⇡ ⇥ ⇤
iy m⇡ iy
cm = iy e m⇡
2i iye m⇡
dy ie (2.57)
2m3 ⇡ 3 m⇡
L2 n⇥ 2 iy ⇤m⇡ ⇣⇥ ⇤
iy m⇡
⇥ iy ⇤m⇡ ⌘o
= iy e m⇡
2i iye m⇡
i ie m⇡
(2.58)
2m3 ⇡ 3
L2 ⇥ 2 iy ⇤m⇡
= 3 3
iy e 2i.i.ye iy + 2i.i.i e iy m⇡ (2.59)
2m ⇡
L2 ⇥ iy ⇤m⇡
= 3 3
e iy 2 + 2y 2i m⇡ (2.60)
2m ⇡
We can now just substitute the limits in, using eim⇡ = e im⇡ = ( 1)m (so e iy has the same value
at both limits). Alternately, we can note that the first and third terms in the round brackets are
even under y ! y and therefore we will get zero when we evaluate between symmetric limits
y = ±m⇡ (N.B. this argument only works for symmetric limits). Only the second term, which is
odd, contributes:
L2 ⇥ ⇤
iy m⇡ L2 ⇥ im⇡
⇤
cm = 2ye m⇡
= 2m⇡e ( 2m⇡)eim⇡
2m3 ⇡ 3 2m3 ⇡ 3
L2 m 2L2 ( 1)m
= ⇥ 4m⇡( 1) = . (2.61)
2m3 ⇡ 3 m2 ⇡ 2
Now n and n0 are just dummy summation indices with no external meaning, so we can now relabel
n0 ! n and the second sum now looks a lot like the first. Noting from Eqn. (2.61) that in this case
c m = cm , we see that the two sums combine to give:
X1 X1 ⇣ n⇡x ⌘
fFS (x) = c0 + cn [ n (x) + n (x)] = c0 + 2cn cos (2.65)
n=1 n=1
L
So, this suggests that our real and complex Fourier expansions are identical with an = 2cn (and
bn = 0). Comparing our two sets of coefficients in Eqns. (2.33) and (2.61), we see this is true.
14
2.10 Some other features of Fourier series
In this subsection, we’re going to look at some other properties and uses of Fourier expansions.
If the Fourier series of f (x) is di↵erentiated or integrated, term Rby term, the new series (if it
converges, and in general it does) is the Fourier series for f 0 (x) or dx f (x), respectively (in the
latter case, only if a0 = 0; if not, there is a term a0 x/2, which would need to be expanded in sin
and cos terms).
This means that we do not have to do a second expansion to, for instance, get a Fourier series for
the derivative of a function.
It can also be a way to do a difficult integral. Integrals of sines and cosines are relatively easy, so
if we need to integrate a function it may be more straightforward to do a Fourier expansion first.
Fourier Series can be very useful if we have a di↵erential equation with coefficients that are constant,
and where the equation is periodic1 . For example
d2 z dz
2
+ p + rz = f (t) (2.66)
dt dt
where the driving term f (t) is periodic with period T . i.e. f (t + T ) = f (t) for all t. We solve this
by expanding both f and z as Fourier Series, and relating the coefficients. Note that f (t) is a given
function, so we can calculate its Fourier coefficients.
Writing
X1 X1
1
z(t) = a0 + an cos (n!t) + bn sin (n!t) (2.67)
2 n=1 n=1
X1 X1
1
f (t) = A0 + An cos (n!t) + Bn sin (n!t)
2 n=1 n=1
1
For non-periodic functions, we can use a Fourier Transform, which we will cover later
15
Then the l.h.s. of the di↵erential equation becomes
X1
d2 z dz r ⇥ ⇤
2
+p +rz = a 0 + n2 ! 2 an + pn!bn + ran cos(n!t) + n 2 ! 2 bn pn!bn + rbn sin(n!t) .
dt dt 2 n=1
(2.69)
Now we compare the coefficients with the coefficients of expansion of the r.h.s. driving term f (t).
The constant term gives
A0
ra0 = A0 ) a0 = . (2.70)
r
Equating the coefficients of cos(n!t) and sin(n!t) gives:
This is a pair of simultaneous equations for an , bn , which we can solve, e.g. with matrices:
✓ 2 2 ◆✓ ◆ ✓ ◆
n ! +r pn! an An
= (2.72)
pn! n2 ! 2 + r bn Bn
where
D ⌘ (r n2 ! 2 ) 2 + p2 n2 ! 2 . (2.74)
So for any given driving term the solution can be found. Note that this equation filters the driving
field: p
p A2n + Bn2
a2n + b2n = (2.75)
D
For large n, equation 2.74 gives D / n4 , so the high frequency harmonics are severely damped.
Discussion: If we set p = 0 and r > 0 we see that p we have a Simple Harmonic Motion problem
00 2
(z + !0 z = f (t)), with natural frequency !0 = r. p represents damping of the system. If the
forcing term has a much higher frequency (n! !0 ) then D is large and the amplitude is suppressed
– the system cannot respond to being driven much faster than its natural oscillation frequency. In
fact we see that the amplitude is greatest if n! is about !0 (if p is small) – an example of resonance.
Let us look at this in more detail. If we drive the oscillator at a single frequency, so An = 1 say, for
a single n, and we make Bn = 0 (by choosing the origin of time). All other An , Bn = 0.
The solution is
1 2 1
an = (w0 n2 ! 2 ); bn = pn! (2.76)
D D
If the damping p is small, we can ignore bn for our initial discussion.
So, if the driving frequency is less than the natural frequency, n! < !0 , then an and An have the
same sign, and the oscillations are in phase with the driving force. If the driving frequency is higher
than the natural frequency, n! > !0 , then an < 0 and the resulting motion is out of phase with the
driving force.
16
1.0
0.8
0.6
0.4
0.2
0.0
0 5 10 15 20
Figure 2.5: The amplitude of the response of a damped harmonic oscillator (with small damping) to
driving forces of di↵erent frequencies. The spike is close to the natural frequency of the oscillator.
2.10.3 Resonance
If the driving frequency is equal to the natural frequency, n! = !0 , then an = 0, and all the motion
is in bn . So the motion is ⇡/2 out of phase (sin(n!t) rather than the driving cos(n!t)). Here we
can’t ignore p.
Finally, note that we can always add a solution to the homogeneous equation (i.e. where we set
the right hand side to zero). The final solution will be determined by the initial conditions (z and
dz/dt). This is because the equation is linear and we can superimpose di↵erent solutions.
For the present approach, this presents a problem: the undriven motion of the system will not
be periodic, and hence it cannot be described by a Fourier series. This explains the paradox of
the above solution, which implies that an and bn are zero if An and Bn vanish, as they do in the
homogeneous case. So apparently z(t) = 0 in the absence of a driving force – whereas of course
an oscillator displaced from z = 0 will show motion even in the absence of an applied force. For a
proper treatment of this problem, we have to remove the requirement of periodicity, which will be
done later when we discuss the Fourier transform.
17
N ⇡N ⇡N ⇡
1 3.4641016151 0.3225089615
2 3.0000000000 0.1415926536
3 3.2145502537 0.0729576001
4 3.0956959368 0.0458967168
5 3.1722757341 0.0306830805
6 3.1192947921 0.0222978615
7 3.1583061852 0.0167135316
8 3.1284817339 0.0131109197
9 3.1520701305 0.0104774769
10 3.1329771955 0.0086154581
100 3.1414981140 0.0000945396
1000 3.1415916996 0.0000009540
10000 3.1415926440 0.0000000095
100000 3.1415926535 0.0000000001
We can get di↵erent series approximations by considering di↵erent values of x in the same Fourier
series expansions. For instance, consider x = ⇡. This gives:
1 1
⇡ 2 X 4( 1)n ⇡2 X 1
⇡2 = + 2
( 1)n ) = 2
⌘ ⇣(2) (2.80)
3 n=1
n 6 n=1
n
This is an example of the Riemann zeta function ⇣(s) which crops up a lot in physics. It has limits:
1
(
X 1 1 as s ! 1
⇣(s) ⌘ s
! (2.81)
n=1
n 1 as s ! 1
18