You are on page 1of 18

Chapter 7

Fourier series and orthogonal


functions

7.1 The Fourier coefficients

Consider a trigonometric series of the form



X
1
f(x) = a0 + (an cos nx + bn sin nx),
2
n=1

that is defined on the closed interval −π ≤ x ≤ π. We want to find the coefficients an


and bn in the series expansion. It is convenient to assume, temporarily, that the series is
uniformly convergent, because this implies that the series can be integrated term by term
from −π to π. Since
Zπ Zπ
cos nx dx = 0, and sin nx dx = 0, n = 1, 2, . . .
−π −π

the term-by-term integration yields


Zπ Zπ
1
f(x) dx = a0 π ⇒ a0 = f(x) dx.
−π π −π

P∞
The coefficient an is found in a similar way: if we multiply f(x) = 21 a0 + n=1 (an cos nx+
bn sin nx) by cos nx we get

X
1
f(x) cos nx = a0 cos nx + (am cos mx cos nx + bm sin mx cos nx).
2
m=1

1
Recalling the trigonometric identities

1
sin mx cos nx = [sin(m + n)x + sin(m − n)x],
2
1
cos mx cos nx = [cos(m + n)x + cos(m − n)x],
2
and
1
sin mx sin nx = [cos(m − n)x − cos(m + n)x],
2
we have Zπ
sin mx cos nx dx = 0, n ≥ 1,
−π

and Zπ
cos mx cos nx dx = 0, n 6= m.
−π

Therefore we can write


Zπ Zπ Z
1 π
f(x) cos nx = an cos2 nx dx = an π ⇒ an = f(x) cos nx dx.
−π −π π −π

Note that this expression is valid also for n = 0 and that is why we write 21 a0 rather than
a0 .
P∞
We get the corresponding formula for bn by multiplying f(x) = 21 a0 + n=1 (an cos nx +
bn sin nx) by sin nx, integrating term by term, and using the fact

sin mx sin nx dx = 0, n 6= m ,
−π

what yields

1
bn = f(x) sin nx dx .
π −π

Thus, if the series is uniformly convergent the coefficients an and bn can be obtained
by the above formulas. However, we don’t know if a given function f(x) admits an ex-
pansion as a uniformly convergent trigonometric series. For this reason, it is better to
set aside the idea of finding the coefficients an and bn of the expansion, which may or
may not exist, and use instead those formulas to define certain numbers an and bn ,
called Fourier coefficients of f(x), that are used to construct the trigonometric series. To
form this series we don’t need f to be continuous; only that is integrable on the interval

2
−π ≤ x ≤ π. Of course, we hope that the Fourier series of f will converge and have f for
P
its sum, and that therefore the expression f(x) = 12 a0 + ∞
n=1 (an cos nx + bn sin nx) is a
valid expansion of f(x), but this is not always true.

Example 1: Consider the function f1 (x) = x, −π ≤ x ≤ π. We have


Z
1 π
a0 = xdx = 0,
π −π
Z
1 π
an = x cos nx dx = 0 (integrating by parts),
π −π
and

1 2 2
bn = x sin nx dx = − cos nπ = (−1)n+1 (integrating by parts).
π −π n n

Substituting these results in the Fourier series suggests that


 
sin 2x sin 3x
f1 (x) = x = 2 sin x − + − ... .
2 3

Now notice that each term of the series has period 2π, so the sum also has period 2π;
that means that the known graph of the sum, i.e., between −π and π is repeated on each
successive interval of length 2π, as appears in the following figure
4
2

− 5π − 4π − 3π − 2π −π π 2π 3π 4π 5π
0
-2
-4

-15 -10 -5 0 5 10 15

3
showing that the series represents the function f(x) = x only on (−π, π) and not on the
entire real line.

In the points x = ±π, ±3π, . . . , the sum of the series has a sudden jump from −π to π.
If we substitute these values in the ‘expansion’ of f(x) = x we see that every term of the
series is 0, and therefore the sum is also 0 (represented by red points in the plot).

It can be verified that the partial sums of the Fourier series approximate the function
f1 (x) = x on the interval (−π, π) (but not at x = ±π). 

The previous example is an illustration of the following simple theorem:

Theorem: Let f(x) be an integrable function defined on the interval −π ≤ x ≤ π. If f is


even, then its Fourier series has only cosine terms, and the coefficients are given by
Z
2 π
an = f(x) cos nx dx, bn = 0.
π 0
If f(x) is odd, then, its Fourier series has only sine terms and the coefficients are given by
Z
2 π
an = 0, bn = f(x) sin nx dx.
π 0

Thus if we want to compute the Fourier series of an odd function, we don’t have to bother
calculating the cosine coefficients.

Example 2. The square wave: Consider the function defined by f2 (x) = 0, if −π ≤ x < 0,
and f2 (x) = π, if 0 ≤ x ≤ π. The expressions for the Fourier coefficients provide
Z 0 Zπ 
1
a0 = 0 dx + π dx = π,
π −π 0
Z
1 π
an = π cos nx dx = 0, n ≥ 1,
π 0
Z 
1 π 1 n 0, n = 2m
bn = π sin nx dx = (1 − (−1) ) = 2
π 0 n
n, n = 2m − 1
and thus the Fourier series is
 
π sin 3x sin 5x
f2 (x) = + 2 sin x + + + ... .
2 3 5

4
The sum of this series is periodic of period 2π, and its graph is shown in the following
figure:
3
2
1
0

− 4π − 3π − 2π −π π 2π 3π 4π
-1

-10 -5 0 5 10

π
At each of the points of discontinuity, the sum of the series has the value 2, shown as
isolated dots in the graph. Note that in this case, as well as in example 1, such isolated
points take on the value given by the average of the limits of the function as we approach
the point of discontinuity from the left and from the right. 

Example 3: Consider the function defined by f3 (x) = − π


2 , if −π ≤ x < 0, and f3 (x) =
π
2,
if 0 ≤ x ≤ π. We could find its Fourier series by applying the already known expressions
for the coefficients an and bn . However, it is easier to use the fact that the operation
of forming the Fourier coefficients is linear: the coefficients for the sum f(x) + g(x) are the
sums of the respective coefficients for f(x) and for g(x), and if c is a constant, then the coefficients
for cf(x) are c times the coefficients for f(x). Also, the Fourier series of a constant function is
simply the constant itself. Therefore, if we notice that the function in this example is the
one defined in example 2 minus the constant π/2, its Fourier series can be obtained by
substracting π/2 from the series representing f2 , which gives
 
sin 3x sin 5x
f3 (x) = 2 sin x + + + ... .
3 5

The graph of the sum is shown in the following figure:

5
1
0

− 4π − 3π − 2π −π π 2π 3π 4π
-1
-2

-10 -5 0 5 10

Note that, again, since the function is odd, the Fourier series has only sine terms. 

7.2 The problem of convergence

Each term of the series



X
1
f(x) = a0 + (an cos nx + bn sin nx)
2
n=1
has period 2π. Therefore, if the function f(x) is to be represented by this sum, f(x) must
also have period 2π. Thus we will assume that f(x) is initially given on the basic inter-
val [−π, π) or (−π, π] and that for other values of x, f(x) is defined by the periodicity
condition
f(x + 2π) = f(x).
In particular, this requires that we must always have f(π) = f(−π). Accordingly, the
complete function is called “periodic extension” of the originally given part.

The following theorem establishes the desired convergence behaviour (the Fourier series
not only converges, but also converges to the corresponding function) for a very large
class of functions.

Dirichlet’s theorem: Assume that f(x) is defined and bounded for −π ≤ x < π, and
also that it has only a finite number of discontinuities and only a finite number of maxima
and minima on this interval. Let f(x) be defined for other values of x by the periodicity
condition f(x + 2π) = f(x). Then, the Fourier series of f(x) converges to
1
[f(x− ) + f(x+ )]
2

6
at every point x, and therefore it converges to f(x) at every point of continuity of the
function. Thus, if at every point of discontinuity the value of the function is redefined as
the average of its two one-sided limits there,

1
f(x) = [f(x− ) + f(x+ )],
2
then the Fourier series represents the function everywhere.

Thus, the continuity of a function is not sufficient for the convergence of its Fourier series
to the function, and neither is it necessary: it is possible for a discontinuous function to be
represented everywhere by its Fourier series, provided its discontinuities are relatively
mild and provided it is relatively well-behaved between the points of discontinuity.

Example 4: Consider the function defined by f4 (x) = 0, if −π ≤ x < 0, and f4 (x) = x, if


0 ≤ x ≤ π. Its Fourier series can be found as follows:
Z
1 π π
a0 = x dx = ,
π 0 2

Z  0, n = 2m
1 π 1 n
an = x cos nx dx = [(−1) − 1] = 2 , n≥1
π 0 πn2  − , n = 2m − 1
πn 2

and Z
1 π (−1)n+1
bn = x sin nx dx = .
π 0 n
The Fourier series is therefore
∞ ∞
π 2 X cos(2n − 1)x X sin nx
f4 (x) = − 2
+ (−1)n+1 .
4 π (2n − 1) n
n=1 n=1

By Dirichlet’s theorem this equation is valid at all points of continuity, since f(x) is under-
stood to be the periodic extension of the initially given part. At the point of discontinuity
x = π, the series converges to

1 π
(f4 (π− ) + f4 (π+ )) = .
2 2
When x = π is substituted in the expansion, we obtain the sum of the reciprocals of the
squares of the odd numbers:

X 1 1 1 1 π2
= 1 + + + + · · · = .
(2n − 1)2 32 52 72 8
n=1

7
With this result, we can also conclude that the sum of the reciprocals of the squares of all
the positive integers is given by

X 1 1 1 1 π2
= 1 + + + + · · · = .
n2 22 32 42 6
n=1

However, if the Fourier series is not uniformly convergent because there are points of
discontinuity of f at the end points, there is an abnormality happening at the truncated
1 XN
Fourier series fN (x) = a0 + (an cos nx + bn sin nx), at the discontinuity points. If
2
n=1
α0 is a point of discontinuity, the jump in the truncated sum can be written as

∆fN = fN (αo + ) − fN (αo − ),

with  > 0 arbitrarily small. When  → 0 and N → ∞ it can be proven that the jump of
the truncated sum can be approximated by

∆fN ≈ 1.18 ∆f.

This means that very close to a discontinuity, the Fourier approximation overshoots the
function by about 18%. This is often called the Gibbs phenomenon.

The picture shows the Fourier


series truncated at N = 301
(shown in red) of the function
 π
 − , −π ≤ x < 0
f(x) = 2
 π, 0≤x≤π
2
(shown in blue; see Example
3). The Gibbs phenomenon can
be observed in the neighbour-
hood of the origin.

8
7.3 Extension to arbitrary intervals

The standard form of a Fourier series, i.e., where the function under consideration is
defined on the interval −π ≤ x < π, might be adapted to a function defined on an
interval −L ≤ x < L, where L is a positive number different from π. This is done by the
change of variable
πx
t= .
L
The function f(x) is transformed into a function of t:
 
Lt
f(x) = f = g(t), −π ≤ t < π ,
π

and if f(x) satisfies the Dirichlet conditions, so does g(t). Therefore we can expand g(t)
in a Fourier series as usual:
X ∞
1
g(t) = a0 + (an cos nt + bn sin nt).
2
1

Next we transform this back into a solution of the original problem, i.e., finding an ex-
pansion of f(x) on the interval −L ≤ x < L :

X∞
1 nπx nπx 
f(x) = a0 + an cos + bn sin .
2 L L
1

This is equivalent to computing directly the expression above, where we determine the
coefficients as
ZL
1
a0 = f(x) dx,
L −L

ZL
1 nπx
an = f(x) cos dx,
L −L L
ZL
1 nπx
bn = f(x) sin dx.
L −L L

Example 5: Consider the function defined by f5 (x) = 0, if −2 ≤ x < 0, and f5 (x) = 1, if


πx
0 ≤ x ≤ 2. We do the change of variable t = to get the function
2

0, −π ≤ t < 0
g(t) =
1, 0 ≤ t < π

9
Next we obtain the Fourier expansion of g(t):

1  0, n = 2m
a0 = 1; an = 0, n ≥ 1; bn = (1 − (−1)n ) = 2
nπ  , n = 2m − 1

Therefore we have

1 2 X sin(2n − 1)t
g(t) = +
2 π 2n − 1
1

and the desired expansion is



1 2 X sin(2n − 1) πx
2
f(x) = + .
2 π 2n − 1
1

Alternatively, we could have computed directly:


Z2
1
a0 = f(x)dx = 1,
2 −2
Z2
nπx
an = f(x) cos dx = 0,
−2 2
Z2
1 nπx 1
bn = f(x) sin dx = ((−1)n − 1),
2 −2 2 πn
and substituting these expressions in the generalised expansion of f, obviously yields the
same result.
In addition, we know that this series converges to the periodic expansion of f(x), with
period 4, at all points except the point of discontinuity x = 0, ±2, ±4, . . . and at these
1
points it converges to . 
2

7.4 Orthogonal functions

A sequence of functions θn (x), n = 1, 2, 3, . . . is said to be orthogonal on the interval


[a, b] if 
Zb
= 0, m 6= n
θm (x)θn (x) dx
a 6= 0, m=n
In other words, we say that two functions are orthogonal if their inner product < · , · > is
zero, and a sequence of functions is an orthogonal sequence if each function is orthogonal
to every other and no function is orthogonal to itself.

10
Example: The sequence

1, cos x, sin x, cos 2x, sin 2x, . . .

is orthogonal on [−π, π], but is not orthogonal on [0, π]. 

One can form series similar to Fourier series, called generalized Fourier series, by using
any orthogonal sequence of functions. The formula for the generalized Fourier coeffi-
cients is particularly simple if
Zb
θm (x)θn (x) dx = 1, for m = n.
a

In this case, the functions θn (x) are said to be normalized, and {θn (x)} is called an or-
thonormal sequence. On the other hand, if
Zb
(θn (x))2 dx = αn 6= 1,
a

it is easy to verify that the functions


θn (x)
φn (x) = √ ,
αn
are orthonormal.

Example: The sequence


1 cos x sin x cos 2x sin 2x
√ , √ , √ , √ , √ ,...
2π π π π π
is orthonormal on [−π, π]. 

More precisely, we define the norm of a function f by


Zb
s
||f|| = (f(x))2 dx,
a

and a function f is called a null function if ||f|| = 0. The norm has the simple properties:

||cf|| = |c| ||f||

| < f, g > | ≤ ||f||||g|| (Schwarz inequality)

11
||f + g|| ≤ ||f|| + ||g|| (Minkowski inequality)

Now let {φn (x)} be an orthonormal sequence of functions on [a, b], and suppose we want
to expand another function f(x) in a series of the form

f(x) = a1 φ1 (x) + a2 φ2 (x) + · · · + an φn (x).

To determine the coefficients an we multiply both sides by φn (x) and integrate term by
term (assuming such an integration is valid). This yields:
Zb Zb
f(x)φn (x) dx = an [φn (x)]2 dx = an .
a a

7.5 Complex Fourier series

We have seen that a Fourier series builds a representation of a function composed of


a weighted sum of the following basis functions {1, cos x, sin x, cos 2x, sin 2x, . . . } where
the weights are the already known coefficients a0 , an , bn . However, computing these
coefficients often involves some laborious integration. We can compute an alternative
representation based on a different set of basis functions:

{1, eix , e−ix , e2ix , e−2ix , . . . }

A representation based on this family of functions is called the complex Fourier series


X
f(x) = cn einx ,
n=−∞

where the coefficients are normally complex numbers. This expansion is often easier to
calculate since it involves integration of exponentials.

It is easy to obtain the complex Fourier series from the trigonometric sine/cosine Fourier
series:

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

X ∞
X
a0 einx + e−inx einx − e−inx
= + an + bn =
2 2 2i
n=1 n=1

12
∞ ∞ ∞
a0 X an − ibn inx X an + ibn −inx X
= + e + e = cn eint ,
2 2 2 n=−∞
n=1 n=1

with  a0

 , n=0

 2





 an − ibn
cn = n = 1, 2, 3, . . .

 2







 a−n + ib−n n = −1, −2, −3, . . .
2
Thus, for n positive
Zπ Zπ
1 1 1
cn = (an − ibn ) = f(x)(cos nx − i sin nx)dx = f(x)e−inx dx,
2 2π −π 2π −π

and also for n negative


Zπ Zπ
1 1 1
cn = (a−n + ib−n ) = f(x)(cos(−nx) + i sin(−nx))dx = f(x)e−inx dx.
2 2π −π 2π −π

Summarising:

a0 1
c0 = ; cn = f(x)e−inx dx, n 6= 0
2 2π −π

Example: Let’s find the complex Fourier series of the square wave f2 (x) = 0, if −π ≤ x <
0, and f2 (x) = π, if 0 ≤ x ≤ π. We have
Z Z
1 π −inx 1 π −inx 1 − e−inπ
cn = f(x)e dx = πe dx = , n 6= 0,
2π −π 2π 0 2ni

 0, n even
cn = 1 −i , n 6= 0
 = , n odd
ni n
and Z
1 π π
c0 = πdx = .
2π 0 2
Therefore the complex Fourier expansion is given by:

π X 1 π

e−3ix e−ix eix e3ix

inx
f(x) = − i e = − i ··· + + + + + ... .
2 n 2 −3 −1 1 3
|n| odd

13
It is easy to verify that this expansion coincides with the real one obtained in example 2,
an − ibn 2
since cn = , and thus an = 0 and bn = , as we already knew. 
2 n

This result states clearly the direct relation between complex analysis and Fourier series.
However, this relation is enhanced with the following considerations. If we identify pe-
riodic continuous functions on R with continuous functions defined on the unit circle
C1 , we can view a periodic real function f as a (complex!) function defined on C1 ⊂ C.
As we will see in chapter 8, it is possible to extend univoquely our function f to the set
T1 = {z ∈ C : |z| ≤ 1} and get an analytic function. As a consequence, this function has a
power series expansion
X
cn zn .
n

Then the restriction of f (complex) to the unit circle can be written as


X
f(x) = cn (eix )n ,
n

which is a convergent series. The coefficients cn are obviously the ones determined at
the beginning of the section.

7.6 Application to ordinary differential equations

Suppose we want to find a particular solution of the non-homogeneous second order


differential equation
y 00 + py 0 + qy = f(x),

where f is a periodic function with period L. If we obtain the Fourier expansion of f we


will get:
∞ ∞
a0 X nπx X nπx
f(x) = + an cos + bn sin .
2 L L
n=1 n=1

Assume there is a particular solution of the equation of the form:


∞ ∞
A0 X nπx X nπx
y(x) = + An cos + Bn sin .
2 L L
n=1 n=1

If we compute the derivatives and substitute into the equation we can use the method of
the undetermined coefficients to find A0 , An and Bn in the Fourier expansion and obtain
the desired solution y(x).

14
Example: Solve the following ODE:

y 00 + 2y = f(x),

where f(x) is 2π-periodic and defined by f(x) = x2 , −π < x < π. First we compute the
Fourier expansion of f, but notice that since it is an even function, we will have bn = 0,
for all n. We have: Zπ
1 2π2
a0 = x2 dx = ,
π −π 3
and integrating by parts

1 4
an = x2 cos nxdx = (−1)n .
π −π n2

Therefore

π2 X 4
f(x) = + (−1)n 2 cos nx.
3 n
n=1

Next assume that there is a particular solution of the form


∞ ∞
A0 X X
y(x) = + An cos nx + Bn sin nx,
2
n=1 n=1

with derivatives

X ∞
X
0
y (x) = − nAn sin nx + Bn n cos nx,
n=1 n=1

and

X ∞
X
00 2
y (x) = − n An cos nx − Bn n2 sin nx.
n=1 n=1

We substitute into the equation and obtain:



X ∞
X ∞ ∞
2 2 2 2 A0 X X
− n π An cos nx − Bn n π sin nx − 2 · ( + An cos nx + Bn sin nx) =
2
n=1 n=1 n=1 n=1


π2 X 4
= + (−1)n 2 cos nx.
3 n
n=1

Setting the coefficients of the corresponding terms equal to one another, we get

Bn = 0

π2
A0 =
3
4
An = (−1)n
n2 (2 − n2 π2 )

15
Thus, the desired particular solution is

π2 X 4
y(x) = + (−1)n 2 cos nx.
6 n (2 − n2 π2 )
n=1

Example. Harmonic vibrations. The spring-mass system: Consider a body of mass m


attached to a wall by means of a spring. At the equilibrium position, x = 0 the spring
does not exert any force. When the body is displaced by a distance x the spring exerts a
restoring force Fs = −kx, where k is a constant that depends on the spring. By Newton’s
second law we will have
d2 x d2 x k
m = Fs ⇒ + x=0 ⇒ x 00 + a2 x = 0,
dt2 dt 2 m
r
k
where a = corresponds to the natural frequency of the system. If the body is pulled
m
aside to the position x = x0 and then released at time t = 0 without any initial velocity,
we have the initial conditions x(0) = x0 and x 0 (0) = 0. With these conditions it is easy to
verify that the solution of the ODE is the periodic vibration x = x0 cos at.

Now, assume that there is an external force Fe = f(t) acting on the body of mass m. In
this situation, we want to solve the differential equation

mx 00 + kx = f(t).

The most important case is that in which f(t) is periodic, so that it can be expanded by
a Fourier series. Since we know how to solve the reduced (non-homogeneous) equation,
we only need a particular solution xp of the complete ODE. And we are mostly interes-
ted in particular solutions that are periodic with the same period as f(t). We call this
particular solution the steady periodic solution. The resulting equation

x 00 + a2 x = 0,

has general solution


xg,r (t) = A cos at + B sin at.

The 2L-periodic function f(t) can be written as


∞ ∞
a0 X nπt X nπt
f(t) = + an cos + bn sin ,
2 L L
n=1 n=1

16
and we seek a 2L-periodic solution of the form
∞ ∞
A0 X nπt X nπt
xp (t) = + An cos + Bn sin ,
2 L L
n=1 n=1

where the coefficients will be determined, as before, by the method of the undetermined
coefficients. In some situations we can find that, when we expand f(t), some of its terms
coincide with the solution to the reduced equation. Then, we cannot use those terms in
the trial solution, since we will get a contradictory equation. That is, suppose


a=
L
for some integer N. In this case we have to modify our proposed solution and try
  X∞  
A0 Nπt nπt nπt nπt
xp (t) = + t AN cos + BN sin + An cos + Bn sin .
2 L L L L
n=1
n6=N

Of course, the solution obtained in this way is not a Fourier series, not even periodic.
Further, the terms t AN cos Nπt nπt
will eventually dominate (when t → ∞)

L + BN sin L
and lead to wild oscillations. This behaviour or tendency of the system to oscillate at a
greater amplitude at some frequencies than at others is called pure resonance (or just res-
onance), and the corresponding frequences are called resonant frequencies or resonant
modes.

P∞ (−1)n
Consider m = 1, a = 9 and f(t) = n=1 n sin nt. Our trial solution is
∞ ∞
A0 X X
x(t) = + cos nt + sin nt .
2
n=1 n=1

By differentiating and substituting into the equation we obtain

(−1)n
A0 = 0; An = 0; (9 − n2 )Bn = .
n
Thus, for n 6= 3 we have the coefficients

(−1)n
Bn = .
n(9 − n2 )

For n = 3 we have to add a resonant term of the form

A3 t cos 3t + B3 t sin 3t ,

17
with first and second derivatives given by

A3 (cos 3t − 3t sin 3t) + B3 (sin 3t + 3t cos 3t) ,

and
A3 (−6 sin 3t − 9t cos 3t) + B3 (6 cos 3t − 9t sin 3t) ,

respectively. According to the ODE, it must be

(−1)3
A3 (−6 sin 3t−9t cos 3t)+B3 (6 cos 3t−9t sin 3t)+9(A3 t cos 3t+B3 t sin 3t) = sin 3t .
3
Equating the coefficients of cos 3t and sin 3t we obtain

(−1)3 1
−6A3 − 9tB3 + 9B3 t = ⇒ A3 = ,
3 18
and
−9tA3 + 6B3 + 9tA3 = 0 ⇒ B3 = 0 .

Therefore, the desired solution is



X
1 (−1)n
x(t) = t cos 3t + sin nt .
18 n(9 − n2 )
n=1
n6=3

18

You might also like