You are on page 1of 15

# Physics 209: Wave Phenomena with Biophysical Applications

## Week 2: Lecture Notes

More on Fourier Analysis

## FOURIER SERIES CONTINUED

We are trying to compute the coefficients in the Fourier expansion of a periodic function.

∞ ∞
a0 X X
f (x) = + an cos(2πnx/λ) + bn sin(2πnx/λ) (1)
2 n=1 n=1

Last time we got the constant term a0 . Now we go after the an and bn :

## Consider this (m = integer):

2 Z x0 +λ
I1 = f (x) cos(2πmx/λ) dx (2)
λ x0

This can presumably be done for any reasonable function f (x). We will show that this
integral I1 = am , the m-th coefficient of the cosine part of the Fourier expansion. Do do this,
we substitute our Fourier expansion for f (x) in this integral:

∞ ∞
" #
2 Z x0 +λ a0 X X
I1 = dx cos(2πmx/λ) + an cos(2πnx/λ) + bn sin(2πnx/λ) (3)
λ x0 2 n=1 n=1

" #
a0 2 Z x0 +λ 2 Z x0 +λ X
I1 = cos(2πmx/λ) dx + dx cos(2πmx/λ) an cos(2πnx/λ) +
(4)
2 λ x0 λ x0 n=1

" #
2 Z x0 +λ X
dx cos(2πmx/λ) bn sin(2πnx/λ) (5)
λ x0 n=1

X 2 Z x0 +λ
I1 = 0 + an cos(2πmx/λ) cos(2πnx/λ) dx + (6)
n=1 λ x0

X 2 Z x0 +λ
bn cos(2πmx/λ) sin(2πnx/λ) dx (7)
n=1 λ x0

1
So, we still have an infinite number of integrals to do, but it turns out that only one of them
6= 0 and that one = 1.

Look at some plots of products of sines and cosines that make up the integrands of these
integrals.

## This file shows m = 2 and n = 1, 3, and 2 (note order) for the R1

first set of integrals in I1 . Can
see by inspection that if you integrate over a full period ie: 0 dx in this case, the integrand
for n = 1 and 3 is equally positive and negative, and the integral will give 0. If n = 2 ie:
n = m, however, the integrand is positive-definite and the integral is non-zero.

## Derivation of this result for the cosine * cosine integrals:

2 Z x0 +λ
I2 = cos(2πmx/λ) cos(2πnx/λ) dx (8)
λ x0

## First, look at case where m = n:

2 Z x0 +λ
I2 = cos2 (2πmx/λ) dx (9)
λ x0

1+cos(2u)
Use the fact that cos2 u = 2
(you can prove this using complex exponentials....)

2 Z x0 +λ 1 1
 
I2 = + cos(2(2πmx/λ)) dx (10)
λ x0 2 2

2 Z x0 +λ 1 2 Z x0 +λ 1
I2 = dx + cos(2(2πmx/λ)) dx (11)
λ x0 2 λ x0 2

The second integral is zero (integral of cosine over integer number of periods), and the first
integral is 1, so

I2 = 1 f or n=m (12)

## Now turn to the case where n 6= m:

How do we deal with these product of cosines eg: cos(a) cos(b) = ?? Use the following trick.
(here is where it’s useful to remember the angle addition formulae:

2
cos(a + b) = cos(a) cos(b) − sin(a) sin(b) (13)
cos(a − b) = cos(a) cos(b) + sin(a) sin(b) (14)

## Add these last two equations and divide by two:

cos(a + b) + cos(a − b)
= cos(a) cos(b) (15)
2

Thus, we re-write

2 Z x0 +λ
I2 = cos(2πmx/λ) cos(2πnx/λ) dx (16)
λ x0

as

2 Z x0 +λ 1
I2 = [cos(2πmx/λ + 2πnx/λ) + cos(2πmx/λ − 2πnx/λ)] dx (17)
λ x0 2

1 Z x0 +λ
I2 = [cos(2π(m + n)x/λ) + cos(2π(m − n)x/λ)] dx (18)
λ x0

But, since m and n are integers n0 = n + m and n00 = m − n are also integers. Thus,

1 Z x0 +λ
I2 = [cos(2πn0 x/λ) + cos(2πn00 x/λ)] dx = 0 (19)
λ x0

since we are again integrating over integer number of periods of these cosines.

## This gives us the following

IMPORTANT RESULTS

2 Z x0 +λ
I2 = cos(2πmx/λ) cos(2πnx/λ) dx = 1 if n = m and = 0 if n 6= m (20)
λ x0

3
Shorthand notation for right-hand side of this is the “Kronecker delta”
I2 = δn,m (21)

## An entirely similar calculation (see Problem Set 2) shows that

2 Z x0 +λ
sin(2πmx/λ) sin(2πnx/λ) dx = δn,m (22)
λ x0

and

2 Z x0 +λ
cos(2πmx/λ) sin(2πnx/λ) dx = 0 (23)
λ x0

Digression

In this context, these sines and cosines are termed “Orthogonal Functions.” Orthogonal
usually means “perpendicular,” in the sense of two vectors being perpendicular. This occurs
when the dotproduct A · B = 0. These integrals define a generalized dot product, or “inner
product” in the “vector space of periodic functions with period λ.” The sines and cosines
are a bit like unit vectors in 3D space for this function space, in that any periodic function
with period λ can be composed by adding them up with the appropriate coefficients, just as
any 3D vector A = ax̂ + bŷ + cẑ.

End Digression

Thus, looking back at the expression for I1 on an earlier page, we see that

2 Z x0 +λ
I1 = f (x) cos(2πmx/λ) dx = am (24)
λ x0

## Similarly, one can show that

2 Z x0 +λ
f (x) sin(2πmx/λ) dx = bm (25)
λ x0

This gives us the prescription we need for finding the coefficients in the Fourier Series for
f (x).

∞ ∞
a0 X X
f (x) = + an cos(2πnx/λ) + bn sin(2πnx/λ) (26)
2 n=1 n=1

4
EXAMPLES OF FOURIER SERIES CALCULATIONS

1. SQUARE WAVE

f(x)
+1

x
-1
x= λ/2 x= λ

## Exercise: Find the Fourier coefficients a0 , an , and bn for this function.

(Note: Fourier analysis works fine for functions that are “piece-wise smooth”)

1. WHAT’S a0 ? = 0. Why: a0 is the average value of this function, which can be seen to
be zero. (Do the integral if you don’t believe it....)

## Do out the calculation of the an ’s...

2Zλ
an = f (x) cos(2πnx/λ) dx (27)
λ 0
2 Z λ/2 2Zλ
= (+1) cos(2πnx/λ) dx + (−1) cos(2πnx/λ) dx (28)
λ 0 λ λ/2
! !
2 λ λ/2 2 λ
= sin(2πnx/λ)|0 − sin(2πnx/λ)|λλ/2 (29)
λ 2πn λ 2πn
" # " #
1 2πn λ 1 2πn 2πn λ
= sin( )−0 − sin( λ) − sin( ) (30)
πn λ 2 πn λ λ 2
1
= [sin(nπ) − 0 − sin(2πn) + sin(nπ)] (31)
πn
= 0 (32)

## WHY? HOW DID I KNOW THIS WOULD HAPPEN?

Because f (x) is an odd function. This is an example of a general result:

5
If f (x) is odd, all an = 0
If f (x) is even, all bn = 0.

There are a couple of ways to see this. Cosines are even fns and sines are odd, thus if f (x)
is odd, it can only have odd components (and vice versa). Alternatively, look closer at the
calculations of the Fourier coefficients, and take the integration interval from −λ/2 → +λ/2.
If as in our case at the moment, f (x) is odd, then f (x) cos(kx) is odd, and an integral of an
odd function over a symmetric interval = 0. However, f (x) sin(kx) is even, and an integral
of an even function over a symmetric interval 6= 0.

Once we are convinced of this fact, we see that for the square wave described above, we only
need to actually do integrals to compute the bn coefficients.

THUS: HELPFUL HINT: as a FIRST STEP: look at f (x) to see if you can save work by
doing some of the calculations by inspection.

CALCULATION of the bn ’s

We are always free to choose the range of integration in these calculations, as long as we
make sure to integrate over a full period of the function in question.

Here it is convenient to integrate from x = 0 to x = λ (ie x0 = 0), but since the function is
piece-wise smooth, we have to split it up

2Zλ
bn = f (x) sin(2πnx/λ) dx (33)
λ 0
2 Z λ/2 2Zλ
= (+1) sin(2πnx/λ) dx + (−1) sin(2πnx/λ) dx (34)
λ 0 λ λ/2
! !
2 −λ λ/2 2 −λ
= cos(2πnx/λ)|0 − cos(2πnx/λ)|λλ/2 (35)
λ 2πn λ 2πn
" # " #
−1 2πn λ 1 2πn 2πn λ
= cos( )−1 + cos( λ) − cos( ) (36)
πn λ 2 πn λ λ 2
1
= [− cos(nπ) + 1 + 1 − cos(nπ)] (37)
πn
1
= (2 − 2 cos(nπ)) (38)
πn

And finally,

2
bn = (1 − cos(nπ)) (39)

6
It is worth evaluating a few of these to see the pattern:

b1 = π2 (1 − (−1)) = 4
π

2
b2 = 2π
(1 − 1) = 0
2 4
b3 = 3π
(1 − (−1)) = 3π

2
b4 = 4π
(1 − 1) = 0

b5 = π2 (1 − (−1)) = 4

So, in general,
4
bn = nπ
for n odd, and = 0 for n even.

So,

4 2π 4 2π 4 2π
f (x) = sin( x) + sin( 3x) + sin( 5x) + ... (40)
π λ 3π λ 5π λ

## MOVIE: wk2m1 sqrwave.mov SHOW PLOTS OF THIS ON COMPUTER

Remember that the cosine terms are absent due to symmetry of f (x). If the square wave
were phase shifted they’d come back in. Could shift it by quarter period so it’s even, and
then the sine terms would vanish...

7
f1(x) Odd function - sine series only
+1

x
-1
x= λ/2 x= λ
f2(x)
+1

x
-1
x= λ/2 x= λ

## Even function - cosine series only

The exercise we’ve just done for the square wave can be done for any periodic function. Some
commonly done (Read: readily integrated) examples are the sawtooth wave, the triangle
wave, and the somewhat weird parabolic wave

1.5
Symmetric sawtooth wave
1.0

0.5

-0.5
-3 -2 -1 0 1 2 3

8
1.5
Asymmetric sawtooth wave
1.0

0.5

-0.5

-1.0

-1.5
-3 -2 -1 0 1 2 3
f(t)

t
T 2T

## Some of these will be homework problems.

FUNCTIONS OF TIME

The above derivation and example were done for functions of position f (x), but Fourier
analysis works equally well for functions of time f (t) with period T :

X
f (t) = a0 /2 + [an cos(nω1 t) + bn sin(nω1 t)], (41)
n=1

## with ω1 = 2π/T , and coeffiients given by:

2 Z t0 +T
a0 = f (t)dt (42)
T t0

2 Z t0 +T
an = f (t) cos(nω1 t) dt (43)
T t0

9
2 Z t0 +T
bn = f (t) sin(nω1 t) dt (44)
T t0

## Feed output to speakers and digital scope / fourier analyzer

Build up and listen to square wave
Add in even harmonics to get triangle wave
On scope, look at both waveform and spectrum

If we had some function f (t) that we couldn’t integrate analytically, we could still get the
Fourier coefficients by doing the needed integrals numerically.

## This is basically what the Fourier analyzer does.

(This is not quite true. The Fourier analyzer is actually doing a numerical Fourier Transform.
We’ll see shortly what that is....)

10
Revisiting the Violin String

Our general expression for the motion (transverse displacement) of a violin string obtained
last week was:

X
Ψ(x, t) = An sin(kn x) cos(ωn t + φn ) (45)
n=1

## with kn = (2π/λ)n with λ = 2L and ωn = vkn .

L
1.0 λ1 = 2 L

x
-1.0

L
1.0 λ2 = 2 L/2 = L

x
-1.0

L
1.0

λ3 = 2 L/3 x
-1.0

L
1.0 λ4 = 2 L/4 = L/2

x
-1.0

A particular motion of the string will be determined by the set of amplitudes An and phases
φn .

11
Sketch of a string plucked at its center

## Ψ(x, t = 0) = f (x) – some sort of triangle function.

But

X
Ψ(x, 0) = An sin(kn x) (46)
n=1

This looks like a Fourier Series, and indeed we get the An coefficients by computing the
Fourier series of this function

f(x)

x= L
x= 2L
x

## SKETCH OF EXTENDED TRIANGLE WAVE WITH PERIOD 2L

This determines the relative strength of the different harmonics in the sound the string
produces - ie: the tone quality.

If you plucked it in a different place, there’d be a different Fourier series, and a different
tone.

(Damping, resonance, etc make this somewhat more complicated in practice, but you can
see this with real instruments. Violinists play ”near the bridge” or ”over the fingerboard”
to achieve different tones. ”Brighter” or ”darker” tone quality refers to relative strength of

12
high harmonics of a pitch)

## We can see this with the Fourier Synthesizer.

HINT FOR HOMEWORK: Can also have initial conditions where velocity at t = 0 is
specified.... eg: piano string.

13
Another Fourier Series Example
...just for practice...
Repeated half parabola

We are going to calculate the Fourier expansion for the “repeated half parabola” with period
T , given for 0 < t < T by
f (t) = At2 (47)
f(t)

t
T 2T

## Our general expression for the Fourier Series is

X
f (t) = a0 /2 + [an cos(nω1 t) + bn sin(nω1 t)], (48)
n=1

with ω1 = 2π/T .

The first question we ask, is can the symmetry (even or odd) be used to reduce the work we
must do? Here the answer is no, as f (t) has no definite odd or even symmetry. Thus, both
the an and bn terms must be calculated.

Here we go. First we look at a0 . Is this non-zero? Remember, this is the half the average
value of the function. The function is never < 0 so a0 6= 0, and we have to calculate it.

2ZT
a0 = f (t)dt (49)
T 0
We are choosing the period over which to integrate between t = 0 and t = T .

#T
2A t3 2AT 2
"
2ZT 2
a0 = At dt = = (50)
T 0 T 3 0 3

14
Next we get the an :
2ZT 2
an = At cos(nω1 t)dt (51)
T 0
This is a standard integral (integrate twice by parts). We may look it up or get Mathematica
to do it for us. #T
2 2t cos(nω1 t) (n2 ω12 t2 − 2) sin(nω1 t)
"
an = A + (52)
T n2 ω12 n3 ω13 0
!
2 2T cos(2πn)
an = A −0+0−0 . (53)
T n2 ω12
Note that only the first term evaluated at t = T gives a non-zero answer. Thus, after a bit
of algebra
T2
an = A 2 2 (54)
π n

## Now we get the bn terms:

2ZT 2
bn = At sin(nω1 t)dt (55)
T 0
This is another standard integral (integrate twice by parts). We may look it up or get
Mathematica to do it for us.
#T
2 2t sin(nω1 t) (n2 ω12 t2 − 2) cos(nω1 t)
"
bn = A − . (56)
T n2 ω12 n3 ω13 0

T2
bn = −A . (57)
πn

## So, we get in the end that:

1 1
f (t) = AT 2 /3 + AT 2
X
[ cos(nω1 t) − sin(nω1 t)]. (58)
n=1 π 2 n2 πn

Note that the bn terms are bigger than the an since they fall off as n−1 rather than as n−2 .

A movie of the Fourier Series for f (t) is given in wk2m2 parabolicwave.mov on the P320
website.

15