5 - Fourier Series and Separation of Variables
5 - Fourier Series and Separation of Variables
5.1 Introduction
In the previous chapter, we introduced the finite difference method as a numerical approach for solving
a specific class of linear partial differential equations (PDEs). In this chapter, our goal is to solve these
same PDEs analytically. We recall that a PDE is said to be linear if the dependent variable and its
derivatives appear at most to the first power and in no functions.
To achieve this, we will employ the method of separation of variables, which involves transforming
the PDE into a system of ordinary differential equations (ODEs).
Step 2: Select from among the solutions found in Step 1 those solutions which satisfy the BC.
There will typically be an infinite sequence of these:
Step 3: Observe that, because the PDE and BC are linear and homogeneous, any linear com-
bination of solutions of these will again be a solution. Thus for any choice of coefficients
b1 , b2 , . . . the linear combination
∞
X
u(x, t) = bn un (x, t)
n=1
77
78 CHAPTER 5. FOURIER SERIES AND SEPARATION OF VARIABLES
will again be a solution of the PDE and BC (assuming the series converges). Choose the
constants bn so that u(x, t) satisfies the initial condition.
Insulation
ICE ICE
Insulation
t
x
u(x, 0) = f (x)
Figure 5.1: Consider a conducting bar with thermal conductivity α2 that has an initial temperature
distribution u(x, 0) = f (x) and whose endpoints are maintained at 0◦ C, i.e. embedded in ice. See Prof.
Peirce’s lectures.
ut = X(x) · Ṫ (t)
uxx = X ′′ (x) · T (t)
Substituting these into the heat equation (5.3):
Ṫ (t) X ′′ (x)
= =λ (5.6)
α2 T (t) X(x)
Since both sides depend on different variables, they must equal a constant, denoted as λ. This gives
two ordinary differential equations (ODEs):
Time equation:
Ṫ (t) = λα2 T (t)
Solving this gives:
2t
T (t) = Ceλα (5.7)
X ′′ − µ2 X = 0
The general solution is (we have chosen this form for simplifications, it is also fine to use the
exponential form):
X ′′ (x) = 0 ⇒ X(x) = Ax + B
Applying boundary conditions:
X ′′ + µ2 X = 0
The general solution is:
nπ nπ 2
µn = , λn = − (5.14)
L L
λn are eigenvalues. The corresponding eigenfunctions are:
nπ
Xn (x) = sin x (5.15)
L
So, the solution will have the form
2 nπ 2
nπx
un (x, t) = e−α ( L ) t sin , n = 1, 2, . . . (5.16)
L
Since the Equation (5.3) is linear, a linear combination of solutions is again a solution. Thus the
most general solution is:
∞ 2 nπx
−α2 ( nπ
L ) t
X
u(x, t) = bn e sin , bn , n = 1, 2, . . . . (5.17)
n=1
L
5.2. SOLUTION TO THE HEAT EQUATION BY SEPARATION OF VARIABLES 81
∞
X nπx
f (x) = bn sin (5.18)
n=1
L
This is the Fourier sin series of f (x). We have the following question in mind:
Note!
Given a function f (x) defined on [0, L], do there exist constants b1 , b2 , . . . such that (5.18) holds? If
the answer is "yes" then (5.17) is the solution to the heat equation problem (5.3).
We want to write the function f (x) in terms of the sum of an infinite number of basis functions
sin L . This is similar to projecting a vector on a set of basis vectors. The sine function is periodic
nπx
(
L
0, if n ̸= m
Z nπx mπx
sin sin dx = L (5.19a)
0 L L 2
, if n = m
Z L nπx mπx 0, if n ̸= m
cos cos dx = L2 , if n = m ̸= 0 (5.19b)
0 L L
L, if n = m = 0
Z L nπx mπx
cos sin dx = 0, ∀n, m (5.19c)
0 L L
The concept of orthogonality means that the inner product of two functions (or two vectors) is
zero over an interval.
Z L
⟨f (x), g(x)⟩ = f (x)g(x)dx. (Inner product of two functions)
0
Proof of Theorem 5.2.1. To prove the first property (5.19a), we use the trigonometric identities:
82 CHAPTER 5. FOURIER SERIES AND SEPARATION OF VARIABLES
L L
πx(n − m)
Z nπx mπx Z
1 πx(n + m)
sin sin dx = cos − cos dx
0 L L 0 2 L L
" L L#
1 L πx(n − m) L πx(n + m)
= sin − sin
2 (n − m)π L 0 (n + m)π L 0
=0
For m = n, we use:
1
sin2 A = (1 − cos 2A)
2
Thus:
Z L nπx Z L
2 1 2nπx
sin dx = 1 − cos dx
0 L 0 2 L
" L#
1 L 2nπx
= x|L0 − sin
2 2nπ L 0
L
=
2
The case of (5.19b) and (5.19c) follow with similar arguments.
Z L mπx L
f (x) sin dx = bm ·
0 L 2
Thus, the Fourier sine coefficients are:
2 L
Z mπx
bm = f (x) sin dx, m = 1, 2, 3, . . .
L 0 L
Finally, the most general solution to (5.3) is given by
∞ Z L
2 nπx 2 nπ 2
nπx
dx e−α ( L ) t sin
X
u(x, t) = f (x) sin (5.20)
n=1
L 0 L L
Example 5.2.1 (Fourier sine expansion). Let us solve (5.3) with f (x) = x, 0 < x < 1, L = 1. We
have using the integration by part formula,
Z 1
(−1)n+1
bn = 2 x sin(nπx)dx = 2
0 nπ
Hence,
∞
2 X (−1)n+1 −α2 (nπ)2 t
u(x, t) = e sin(nπx)
π n=1 n
We can use the latter expression to compute some series: for example, if t = 0 and x = 12 , then
we have
∞
2 X (−1)n+1
u(1/2, 0) = f (1/2) = 1/2 = sin(nπ/2)
π n=1 n
k n sin(nπ/2)
0 1 1
2 0
1 3 -1
4 0
2 5 1
Therefore,
∞
X (−1)k π
=
k=0
(2k + 1) 4
As previously,
P∞ we need to write f (x) = 50x(1 − x) for 0 < x < 1 as a sine series. That is,
f (x) = n=1 bn sin(nπx), where
Z 1 (
200 200(−1)n 0 if n even
bn = 2 50x(1 − x) sin(nπx)dx = 3 3 − 3 3
= 400
0 π n π n π 3 n3
if n odd
Hence the solution u(x, t), is given by:
∞
400 X 1 2 2
u(x, t) = 3 3
sin((2k + 1)πx)e−(2k+1) π 0.003t
π k=0 (2k + 1)
ut = X(x) · Ṫ (t)
uxx = X ′′ (x) · T (t)
Substituting these into the heat Equation (5.21):
Insulation
Insulator Insulator
Insulation
t
x
u(x, 0) = f (x)
Figure 5.3: Consider a conducting bar with thermal conductivity α2 that has an initial temperature
x
distribution u(x, 0) = f (x) and whose endpoints are insulated, Prof. Peirce’s lectures.
Ṫ (t) X ′′ (x)
= =λ (5.24)
α2 T (t) X(x)
Since both sides depend on different variables, they must equal a constant, denoted as λ. This gives
two ordinary differential equations (ODEs):
Time equation:
Ṫ (t) = λα2 T (t)
Solving this gives:
2t
T (t) = Ceλα (5.25)
X ′′ − µ2 X = 0
The general solution is (we have chosen this form for simplifications, it is also fine to use the
exponential form):
86 CHAPTER 5. FOURIER SERIES AND SEPARATION OF VARIABLES
X ′′ (x) = 0 ⇒ X(x) = Bx + A
Applying boundary conditions:
So, X(x) = A is a non-trivial solution. The eigenvalue λ0 = 0 and the corresponding eigenfunction
is X0 (x) = 1.
X ′′ + µ2 X = 0
We have
Thus,
nπ nπ 2
µn = , λn = − (5.33)
L L
λn are eigenvalues. The corresponding eigenfunctions are:
5.2. SOLUTION TO THE HEAT EQUATION BY SEPARATION OF VARIABLES 87
nπx
Xn (x) = cos , n = 1, 2, 3, . . . (5.34)
L
So, the solution will have the form
2 nπ 2
nπx
un (x, t) = e−α ( L ) t cos , n = 1, 2, . . . (5.35)
L
We also had another eigenvalue/function from λ = 0, u0 (x, t) = A0 · e0·t = A0 . Since the equation
(5.21) is linear, a linear combination of solutions is again a solution. Thus the most general solution is
of the form:
∞ nπx
2 nπ 2
An e−α ( L ) t cos
X
u(x, t) = A0 + , An , n = 0, 1, 2, . . . are constants (5.36)
n=1
L
i.e
∞ L
Z L XL nπx
f (x)dx = A0 · x|L0 + An sin = A0 L + 0
0 n=1
nπ L
0
Hence, Z L
1
A0 = f (x)dx
L 0
a0 = 2A0
ak = Ak , k = 1, 2, . . .
so that the ak can be rewritten on a unified form
2 L
Z
kπx
ak = f (x) cos dx k = 0, 1, 2, . . .
L 0 L
In terms of the new coefficients ak defined, the Fourier expansion for the initial condition function
f (x) is of the form
∞
a0 X nπx
f (x) = + an cos (5.40)
2 n=1
L
while the solution of the heat equation (5.23) is of the form
∞
a0 X nπx 2 nπ 2
u(x, t) = + an cos e−α ( L ) t (5.41)
2 n=1
L
Example 5.2.3 (Fourier cosine expansion). Determine the Fourier coefficients ak for the function
f (x) = x, 0<x<1=L
and use the resulting Fourier cosine expansion to prove the identity
∞
X 1 π2
=
k=0
(2k + 1)2 8
We have,
1 1
x2
Z
a0 = 2 xdx = 2 = 1 and
0 2 0
Z 1
(−1)n − 1 − n24π2 , n odd
an = 2 x cos(nπx)dx = 2 =
0 n2 π 2 0, n even
Therefore,
∞
1 4 X 1
f (x) = − 2 cos((2k + 1)πx) (5.42)
2 π k=0 (2k + 1)2
To obtain the required identity we set x = 1 in and rearrange terms. We can also deduce that the
solution of (5.23) with the initial condition u(x, 0) = x is given by
5.2. SOLUTION TO THE HEAT EQUATION BY SEPARATION OF VARIABLES 89
∞
1 4 X 1 2 2
u(x, t) = − 2 2
cos((2k + 1)πx)e−α ((2k+1)π) t (5.43)
2 π k=0 (2k + 1)
Figure 5.4: Partial sums of the Fourier Cosine Series of the function f (x) = x.
∂ 2 u 1 ∂u 1 ∂ 2u
∆u = + +
∂r2 r ∂r r2 ∂θ2
2
∂ u
=
∂(rθ)2
2
and if we let x = rθ then ∂(rθ)
∂ u
2 = uxx . In this case the heat distribution in the ring is determined by
x=L
x=0
x = −L
Figure 5.5: Consider a thin conducting ring with thermal conductivity α2 that has a given initial
temperature distribution.
ut = X(x) · Ṫ (t)
uxx = X ′′ (x) · T (t)
Substituting these into the heat equation (5.44):
Ṫ (t) X ′′ (x)
= = λ. (5.47)
α2 T (t) X(x)
Since both sides depend on different variables, they must equal a constant, denoted as λ. This gives
two ordinary differential equations (ODEs):
Time equation:
Ṫ (t) = λα2 T (t)
5.2. SOLUTION TO THE HEAT EQUATION BY SEPARATION OF VARIABLES 91
X ′′ − µ2 X = 0
The general solution is (we have chosen this form for simplifications, it is also fine to use the
exponential form):
X(x) = A cosh(µx) + B sinh(µx) (5.50)
We note that
and
X ′′ (x) = 0 ⇒ X(x) = Ax + B
We also have
X ′ (x) = A
and
X ′ (−L) = A = 0 = X ′ (L)
So, X(x) = B is a non trivial solution. For this case, the eigenvalue λ0 = 0 and the corresponding
eigenfunction is X0 = 1.
92 CHAPTER 5. FOURIER SERIES AND SEPARATION OF VARIABLES
X ′′ + µ2 X = 0
The general solution is:
nπ nπ 2
, λn = −
µn = (5.56)
L L
λn are eigenvalues. The corresponding eigenfunctions are:
n nπx nπx o
Xn (x) ∈ cos , sin , n = 1, 2, 3, . . . (5.57)
L L
So, the solution will have the form
2 h nπx nπx i
−α2 ( nπ )
un (x, t) = e L
t
An cos + Bn sin , n = 1, 2, . . . (5.58)
L L
We also had another eigenvalue/function from λ = 0, u0 (x, t) = A0 · e0·t = A0 .
Since the equation (5.44) is linear, a linear combination of solutions is again a solution. Thus the most
general solution is of the form:
∞ nπx nπx i
2 nπ 2 h
e−α ( L )
X
u(x, t) = A0 + t
An cos + Bn sin (5.59)
n=1
L L
for some coefficients A0 , An , Bn , n = 1, 2, . . ..
Using the initial condition u(x, 0) = f (x) :
X∞ h nπx nπx i
f (x) = A0 + An cos + Bn sin (5.60)
n=1
L L
As previously, we use the inner product ⟨·, ·⟩ to project f (x) onto the basis functions in the series.
We state the following important result:
5.2. SOLUTION TO THE HEAT EQUATION BY SEPARATION OF VARIABLES 93
Theorem
nπx
5.2.2 (Orthogonality
nπx
of trigonometric functions). The trigonometric functions
sin L and cos L (for n = 1, 2, 3, . . . ) are orthogonal over the interval [−L, L] in the fol-
lowing sense:
(
L
if n ̸= m
Z nπx 0,
mπx
sin sin dx = (5.61a)
−L L L L, if n = m
Z L nπx mπx 0,
if n ̸= m
cos cos dx = L, if n = m ̸= 0 (5.61b)
−L L L
2L, if n = m = 0
Z L nπx mπx
cos sin dx = 0, for all n, m (5.61c)
−L L L
The concept of orthogonality means that the inner product of two functions (or two vectors) is
zero over an interval.
Z L
⟨f (x), g(x)⟩ = f (x)g(x)dx. (Inner product of two functions)
−L
∞ L ∞ L
Z L X L nπx X L nπx
f (x)dx = A0 · x|L−L + An sin − Bn cos = 2A0 L + 0 + 0
−L n=1
nπ L n=1
nπ L
−L −L
Hence,
Z L
1
A0 = f (x)dx (5.62)
2L −L
Z L mπx Z L mπx ∞
X Z L nπx mπx
f (x) cos dx = A0 cos dx + An cos cos dx
−L L −L L n=1 −L L L
∞
X Z L nπx mπx
+ Bn sin cos dx
n=1 −L L L
So,
94 CHAPTER 5. FOURIER SERIES AND SEPARATION OF VARIABLES
Z L
1 mπx
Am = f (x) cos dx (5.63)
L −L L
Now, if we multiply both sides of (5.60) by sin mπx
and integrate over [−L, L] :
L
Z L mπx Z L mπx ∞
X Z L nπx mπx
f (x) sin dx = A0 sindx + An cos sin dx
−L L −LL n=1 −L L L
X∞ Z L nπx mπx
+ Bn sin sin dx
n=1 −L L L
i.e. (using (5.61b) and (5.61c))
Z L mπx L
L nπx
f (x) sin dx = − A0 cos + 0 + Bm L
−L L nπ L −L
So,
Z L
1 mπx
Bm = f (x) sin dx (5.64)
L −L L
So, in summary, the full Fourier series of f (x) is:
∞
a0 X nπx nπx
f (x) = + an cos + bn sin
2 n=1
L L
where
Z L
1 nπx
an = f (x) cos dx, n = 0, 1, 2, 3, . . . (5.65)
L −L L
and
Z L
1 mπx
bn = f (x) sin dx, n = 1, 2, 3, . . . (5.66)
L −L L
The final solution is:
∞
a0 X −α2 ( nπ
L )
2 h nπx nπx i
u(x, t) = + e t
an cos + bn sin (5.67)
2 n=1
L L
RL
We observe that as t → ∞ it follows that u(x, t) → a0
2
= 1
2L −L
f (x)dx, which is just the average
value of the initial heat f (x).
Example 5.2.5 (Full Fourier expansion). Let us solve the equation (5.44) with the initial condition
u(x, 0) = f (x), where
(
0, −π < x < 0
f (x) =
x, 0 ≤ x ≤ π
In this case, L = π. We need to write the full Fourier expansion of u(x, 0). We have,
5.2. SOLUTION TO THE HEAT EQUATION BY SEPARATION OF VARIABLES 95
Z π Z π
1 1 π
a0 = f (x)dx = x dx =
π −π π 0 2
1 π
Z
an = f (x) cos(nx)dx
π −π
1 π
Z
= x cos(nx)dx
π 0
π
1 π
Z
1 sin(nx)
= x − sin(nx)dx
π n 0 n 0
π
1 π sin(nπ) 1
= + 2 cos(nx)
π n n 0
1
= [(−1)n − 1] (5.68)
πn2
For even indices, a2m = 0 for m = 0, 1, . . .. For odd indices:
2
a2m+1 = − , m = 0, 1, 2, . . .
π(2m + 1)2
Now, we compute bn
1 π
Z
bn = f (x) sin(nx)dx
π −π
1 π
Z
= x sin(nx)dx
π 0
π
1 π
Z
1 cos(nx)
= −x + cos(nx)dx
π n 0 n 0
π
1 cos(nπ) 1
= −π + 2 sin(nx)
π n n 0
∞
a0 X
f (x) = + an cos(nx) + bn sin(nx)
2 n=1
∞ ∞
π 2 X cos[(2m + 1)x] X sin(nx)
= − 2
+ (−1)n+1 (5.69)
4 π m=0 (2m + 1) n=1
n
Important summary!
( (
X ′′ + λ2 X = 0 λn = nπ
L
, n = 1, 2, . . .
=⇒
X(0) = 0 = X(L) Xn (x) = sin nπx
L
( (
X ′′ + λ2 X = 0 λn = nπ
L
, n = 0, 1, 2, . . .
=⇒
X ′ (0) = 0 = X 0 (L) Xn (x) = cos nπx
L
′′ 2
X + λ X = 0
(
λn = nπ
L
, n = 0, 1, 2, . . .
X(−L) = X(L) =⇒ nπx nπx
′ Xn (x) ∈ {1, cos L , sin L }
X (−L) = X ′ (L)
IV: Mixed Boundary Value Problem A (Ice Left and Insulation Right)
5.3. FOURIER SERIES 97
( (
X 00 + λ2 X = 0 λk = (2k+1)π
2L
, k = 0, 1, 2, . . .
=⇒
X(0) = 0 = X 0 (L) Xn (x) = sin (2k+1)πx
2L
( (
X 00 + λ2 X = 0 λk = (2k+1)π
2L
, k = 0, 1, 2, . . .
=⇒
X 0 (0) = 0 = X(L) Xn (x) = cos (2k+1)πx
2L
where Z L Z L
1 nπx a0 1
an = f (x) cos dx, = f (x)dx = average value of f (5.72)
L −L L 2 2L −L
and Z L
1 nπx
bn = f (x) sin dx. (5.73)
L −L L
We recall that a function f (x) defined for all x is periodic with period T if f (x + T ) = f (x) for all
x.
98 CHAPTER 5. FOURIER SERIES AND SEPARATION OF VARIABLES
We observe that cos nπ (x + T ) = cos nπx provided nπT = 2π, T = 2L and similarly sin nπ
L L L n L
(x + 2L) =
sin nπx . Thus each of the terms of the Fourier Series S(x) on the RHS of (5.71) is a periodic function
L
with a maximal period 2L (a constant function is periodic with any period). As a result the function
S(x) is also periodic.
But the question is: How does this relate to f (x) which may not be periodic?
The function S(x) represented by the series is known as the periodic extension of f on [−L, L].
Definition 5.3.1 (Periodic extension). If f is defined on the interval [a, b] then the periodic
extension fper of f , which has period T = b − a, is defined simply by "repeating" f in all the
intervals [a + nT, b + nT ] for n = 0, ±1, . . ., so that for all x,
In Figure 5.6, we show a picture for a = −1, b = 1, and functions f (x) = x2 and f (x) = x.
Figure 5.6: Periodic extension fper (x) of the function f (x) = x2 (blue curve) and the function f (x) = x
(red curve) with a = −1 and b = 1.
Note that fper may be discontinuous at a, b, etc., even if f is continuous. A related fact is that in
defining fper we have taken fper (a) = f (b) and not fper (a) = f (a); some choice must be made but this
has no effect in practice.
Since the periodic extension is periodic with period (as are the basis functions nπx
f per 2L cos L
and sin nπx ), the interval [−L, L] over which the integration is carried out may be replaced by
L
any other interval of the same length: that is for any X,
5.3. FOURIER SERIES 99
Z X+2L Z X+2L
1 1 nπx
a0 = fper (x)dx, an = fper (x) cos dx, n≥1
2L X L X L
1 X+2L
Z
nπx
bn = fper (x) sin dx, n ≥ 1
L X L
Example 5.3.1. Consider the example given in Example 5.2.5. Then, we have
0 −π < x < 0
f (x) =
x 0≤x≤π
On [π, 3π],
(
0 π < x < 2π
fper (x) =
x − 2π 2π ≤ x ≤ 3π
Z 3π
1
an = fper (x) cos(nx)dx, change of variables: t = x − 2π dx = dt, x = t + 2π
π π
1 3π
Z
= (x − 2π) cos(nx)dx
π 2π
1 2π
Z
= t cos(nt)dt since cos n(t + 2π) = cos nt
π 0
Definition 5.3.2 (Even and odd functions). A function f (x) is said to be even if it is defined
for all x (or possibly in some interval symmetric about x = 0, that is, of the form ( −L, L ) or
[−L, L] ) and satisfies f (x) = f (−x); it is odd if it is similarly defined and satisfies f (−x) =
−f (x). We will frequently use the observation that if f (x) is defined for −L ≤ x ≤ L then,
Z L (
0, if f is odd
f (x)dx = RL (5.75)
−L 2 0 f (x)dx, if f is even
RL R0 RL
This formula is easily be derived by writing −L f (x)dx = −L f (x)dx + 0 f (x)dx and making the
change of variable y = −x in the first integral.
Note
Let E(x) represent an even function and O(x) an odd function. Then,
(a) If f (x) = E(x) · O(x) then f (−x) = E(−x)O(−x) = −E(x)O(x) = −f (x) ⇒ f is odd.
100 CHAPTER 5. FOURIER SERIES AND SEPARATION OF VARIABLES
Check: Let E(x) = 12 [f (x) + f (−x)]. Then E(−x) = 12 [f (−x) + f (x)] = E(x) (even.)
Similarly let O(x) = 12 [f (x) − f (−x)]. Then, O(−x) = 12 [f (−x) − f (x)] = −O(x) ( odd.)
One may use (5.75) to considerably simplify the formulas (5.72)-(5.73) when f is even or odd.
• If f is even then f (x) cos(nπx/L) is even and f (x) sin(nπx/L) is odd, so that from (5.75),
Z L Z L
1 2 nπx
a0 = f (x)dx, an = f (x) cos dx, bn = 0, n≥1 (5.76)
L 0 L 0 L
• If f is odd one has f (x) cos(nπx/L) is odd and f (x) sin(nπx/L) is even
Z L
2 nπx
a0 = 0, an = 0, bn = f (x) sin dx, n≥1 (5.77)
L 0 L
• Since any function can be written as the sum of an even and an odd part, we can interpret
the cosine and sine series as corresponding to even and odd functions:
1 1
f (x) = [f (x) + f (−x)] + [f (x) − f (−x)]
2 2
where the first term represents the even part of f (x) and the second term represents the odd part.
Thus, the Fourier series expansion can be expressed as:
( ∞
) (∞ )
a0 X nπx X nπx
f (x) = + an cos + bn sin ,
2 n=1
L n=1
L
where the cosine terms correspond to the even part and the sine terms correspond to the odd part
of the function. In addition,
2 L1 1 L
Z nπx Z nπx
an = [f (x) + f (−x)] cos dx = f (x) cos dx
L 0 2 L L −L L
2 L1 1 L
Z nπx Z nπx
bn = [f (x) − f (−x)] sin dx = f (x) sin dx
L 0 2 L L −L L
Let us emphasize that in (5.76)-(5.77) we are considering the Fourier series of a function defined on
the interval [−L, L].
5.3. FOURIER SERIES 101
Cosine series:
If f (x) is extended as an even function on [−L, L], it can be represented by a Fourier cosine series:
∞
a0 X nπx
f (x) = + an cos
2 n=1
L
where the Fourier coefficients are given by
2 L
Z nπx
an = f (x) cos dx
L 0 L
We note that the even periodic extension is obtained by simply computing the Fourier series repre-
sentation for the even function
f (x), 0 < x < L
fe (x) ≡
f (−x) −L < x < 0
Since fe (x) is an even function on a symmetric interval [−L, L], we expect that the resulting Fourier
series will not contain sine terms.
We can simplify this by noting that the integrand is even and the interval of integration can be
replaced by [0, L]. On this interval fe (x) = f (x). So, we have the Cosine Series representation of
f (x) for x ∈ [0, L] given as above.
Sine series:
If f (x) is extended as an odd function on [−L, L], it can be represented by a Fourier sine series:
∞
X nπx
f (x) = bn sin
n=1
L
where the Fourier coefficients are given by
2 L
Z nπx
bn = f (x) sin dx
L 0 L
Similarly as the case of the cosine series, given f (x) defined on [0, L], the odd periodic extension is
obtained by simply computing the Fourier series representation for the odd function
f (x), 0<x<L
fo (x) ≡
−f (−x) −L < x < 0
The resulting series expansion leads to defining the Sine Series representation of f (x) for x ∈ [0, L]
as described above.
Example 5.3.2 (Half-Range Expansion of f (x) = x). Expand f (x) = x on 0 < x < 2 in a
half-range (a) sine series, (b) cosine series.
102 CHAPTER 5. FOURIER SERIES AND SEPARATION OF VARIABLES
Hence ∞
4 X (−1)n+1 nπ
f (x) = sin 2 x ,
π n=1 n
and at x = 1: ∞
4 X (−1)n+1 nπ π
1= sin 2 =⇒ = 1 − 13 + 15 − 17 + · · · .
π n=1 n 4
(b) Cosine Series (L = 2).
2
2 2 x2
Z
a0 = x dx = = 2,
2 0 2 0
Z 2 2 2 2
Z 2 2 2
nπ nπ
an = x cos 2 x dx = x sin 2 x − sin nπ
2
x dx + 2
nπ
cos nπ
2
x
0 nπ 0 nπ 0 0
4
= 2 2 cos(nπ) − 1 .
nπ
Thus
∞ ∞ (2k+1)π
4 X (−1)n − 1 nπ 8 X cos 2
x
f (x) = 1 + 2 2
cos 2 x = 1 − 2 2
.
π n=1 n π k=0 (2k + 1)
At x = 2: ∞
8 X 1 π2 1 1
2=1+ 2 =⇒ =1+ 32
+ 52
+ ··· .
π k=0 (2k + 1)2 8
Example 5.3.3 (Cosine Series of sin x on 0 ≤ x ≤ π ). Find the Fourier cosine series of
f (x) = sin x on [0, π].
2 π 2 π 1 π
Z Z Z
4
a0 = sin x dx = , a1 = sin x cos x dx = sin 2x dx = 0.
π 0 π π 0 π 0
2 π 1 π
Z Z
an = sin x cos(nx) dx = [sin((n + 1)x) − sin((n − 1)x)] dx
π 0 π 0
1 h cos((n−1)x) cos((n+1)x) iπ 2 (−1)n−1 − 1
= n−1
− n+1
= .
π 0 π(n2 − 1)
5.3. FOURIER SERIES 103
Hence ∞ ∞
2 2 X (−1)n−1 − 1 2 4 X cos(2jx)
sin x = + cos(nx) = − .
π π n=2 n2 − 1 π π j=1 (2j)2 − 1
Example 5.3.4 (Periodic Extension of f (x) = x). Assume f (x) = x on 0 < x < 2 with period 2
so that L = 1. Compute its full Fourier series.
1 L
Z Z 1 Z 2
a0 = x dx = x dx = 0? (equivalently compute x dx = 2 for even part.)
L −L −1 0
For n ≥ 1:
1 1
Z Z 2
an = x cos(nπx) dx = x cos(nπx) dx
L −1 0
Z 2
h
x sin(nπx)
i2 1
= nπ
− sin(nπx) dx = 0,
0 nπ 0
1 1
Z Z 2
bn = x sin(nπx) dx = x sin(nπx) dx
L −1 0
Z 2
h
x cos(nπx)
i2 1 2
= − nπ + cos(nπx) dx = − .
0 nπ 0 nπ
Therefore
∞
2 X sin(nπx)
f (x) = 1 − .
π n=1 n
Why??
In the previous example, if we compute f (0) using the original definition of f , we obtain 0 . However,
if we use the Fourier expansion of f , we obtain f (0) = 1. What is wrong?
1
f x+ + f x−
2
where f (x+ )and f (x− ) represent the right-hand and left-hand limits of f (x) at the discontinuity,
respectively. Before stating the main result of this section, we introduce the following notion.
f t+
i = lim f (t) and
t↘ti
−
f ti+1 = lim f (t)
t↗ti+1
exist (and are finite). A function f : [a, b] → R is piecewise continuous if, roughly speaking, it is
made up of a finite number of continuous pieces. A function f : R → R is piecewise continuous
if it is piecewise continuous on every closed interval [a, b]. Thus it can have infinitely many
discontinuities, but only finitely many on any finite interval.
Example 5.3.5.
0 if −π < t ≤ 0
f (t) =
π if 0<t≤π
we have f (0− ) = 0 and f (0+ ) = π and f is continuous on ( −π, 0 ), ( 0, π ). Therefore, f is
piecewise continuous on [−π, π].
• The function f : R → R given by f (t) = tan t (and f (t) = 0 if t is an odd multiple of π/2 )
is not piecewise continuous. Although it has only finitely many discontinuities on any finite
interval,
the function "blows up" at these discontinuities, so that (for example) the limits
π− π+
f 2 and f 2 do not exist.
Theorem 5.3.1 (Convergence of Fourier Series). Let f and f ′ be piecewise continuous func-
tions on [−L, L] (i.e. f is piecewise continuously differentiable or piecewise C 1 ) and periodic
with period 2L, then f has a Fourier Series
∞
a0 X nπx nπx
f (x)] ≈ + an cos + bn sin = S(x)
2 n=1
L L
where
Z L Z L
1 nπx 1 nπx
an = f (x) cos dx and bn = f (x) sin dx
L −L L L −L L
The Fourier Series converges to f (x) at all points at which f is continuous and to 12 [f (x+ ) +
f (x− )]at all points at which f is discontinuous. Thus a Fourier Series converges to the average
value of the left and right limits at a point of discontinuity of the function f (x).
Important!
Under the hypothesis of Theorem 5.3.1, ≈ can be replaced by = and
if f is continuous at x
(
f (x),
S(x) = f (x+ )+f (x− )
2
, if f is discontinuous at the point x.
5.3. FOURIER SERIES 105
Remark 5.3.1. A way to look at the connection of Fourier series on an interval with the Fourier
series of periodic functions is to start with a piecewise continuous function g defined only on the
interval [−L, L]. Then gper , a periodic extension of g of period 2L, can play the role of f above;
in particular, the Fourier series of g converges to gper everywhere, in our usual sense:
(
gper (x), if gper is continuous at x
S(x) = gper (x+ )+gper (x− )
2
, if gper is discontinuous at the point x
Remark 5.3.2 (Gibbs phenomenon). The Fourier series has a difficult time converging at the
point of discontinuity and these graphs of the Fourier series show a distinct overshoot which does
not go away. This is called the Gibbs phenomenon and the amount of overshoot can be computed.
We refer to the Lectures notes of Prof. Peirce for more on this phenomenon.
Finally, everything said above applies also to the complex form of the Fourier series: a function g(x),
periodic with period 2L, has a complex Fourier series
∞
nπx
cn ei( )
X
g(x) ≈ L
n=−∞
with
Z L
1 nπx
cn = g(x)e−i( L ) dx
2L −L
106 CHAPTER 5. FOURIER SERIES AND SEPARATION OF VARIABLES
Example 5.3.6.
−1 −π ≤ x < 0
f (x) = L=π
1 0<x<π
Z 0 Z π
1 −inx −inx
cn = − e dx + e dx
2π −π 0
−inx 0
( )
e | −inx π
1 −π e |0
= − +
2π (−in) (−in)
i +inπ −inπ 0 n even
= −2 + e +e = 2
2πn iπn
n odd
Therefore,
∞
X 2
f (x) = ei((2n+1)x)
n=−∞
πi(2n + 1)
∞
a0 X h nπx nπx i
f (x) ∼ + an cos + bn sin = S∞
2 n=1
L L
N
a0 X h nπx nπx i
SN (x) = + an cos + bn sin
2 n=1
L L
a20 P∞
in particular the series 2
+ n=1 a2n + b2n is convergent.
1 L
Z
E2 [f, SN ] = [f (x) − SN (x)]2 dx
L −L
Z L Z L Z L
1 2 2
= f (x)dx − 2 f (x)SN (x)dx + SN (x)dx
L −L −L −L
1
= {⟨f, f ⟩ − 2 ⟨f, SN ⟩ + ⟨SN , SN ⟩}
L
Now, we compute:
" N
#2
Z L
a0 X nπx nπx
⟨SN , SN ⟩ = + an cos + bn sin dx
−L 2 n=1
L L
N Z L Z L
a20 X
2 2 nπx
2 2 nπx
= L+ an cos dx + bn sin dx
2 n=1 −L L −L L
" N
#
a20 X 2
an + b2n
=L +
2 n=1
In addition,
Z L
⟨f, SN ⟩ = f (x)SN (x)dx
−L
Z L N Z L Z L
a0 X nπx nπx
= f (x)dx + an f (x) cos dx + bn f (x) sin dx
2 −L n=1 −L L −L L
Therefore,
( N
)
L
a20 X 2
Z
1 1
[f (x) − SN (x)]2 dx = ⟨f, f ⟩ − an + b2n
E2 [f, SN ] = +
L −L L 2 n=1
it follows that
108 CHAPTER 5. FOURIER SERIES AND SEPARATION OF VARIABLES
N L
a20 X 2
Z
1 1
+ an + b2n ≤ f 2 (x)dx = ⟨f, f ⟩ = E[f ]
2 n=1
L −L L
where E[f ] is known as the energy of the 2L-periodic function f .
Theorem 5.4.2 (Parseval’s Identity). Let f ∈ L2 [−L, L]. Then the Fourier coefficients an
and bn satisfy Parseval’s Formula
∞ L
a20 X 2
Z
1
an + b2n = f 2 (x)dx = E[f ] (5.78)
+
2 n=1
L −L
if and only if Z L
lim [f (x) − SN (x)]2 dx = 0 (5.79)
N →∞ −L
Remark 5.4.1. The convergence in (5.79) should be understood in the L2 -sense (mean square
sense). This is a convergence in an average sense. When {SN } tends to f uniformly, {SN } must
tend to f in L2 -sense. The converse is not always true. Hence convergence in L2 -sense is weaker
than uniform convergence.
Important!: In practice...
• The Fourier series of every L2 -integrable function converges to the function in L2 -sense.
• Let f be a piecewise continuous function on [−L, L]. Then SN converges to f in the mean
square sense.
Example 5.4.1. Consider the Fourier cosine series of f (x) = x, 0 < x < 2:
∞
X 4 nπx
x≈1+ [cos(nπ) − 1] cos
n=1
π 2 n2 2
a) Write Parseval’s identity corresponding to the above Fourier series.
b) Determine from a) the sum of the series
1 1 1
+ + + ...
14 24 34
Solution 5.4.1 (Solution to Example 5.4.1). a) We first find the Fourier coefficient and the
period of the Fourier series just by comparing the given series with the standard Fourier series
4
a0 = 2, an = [cos(nπ) − 1], n = 1, 2, . . . , bn = 0,
π 2 n2
period: L = 2.
5.4. BESSEL’S INEQUALITY AND PARSEVAL IDENTITY 109
We note that Z 2
16
x2 dx = < ∞,
−2 3
so that f ∈ L2 (−2, 2). Thus, the conditions for Parseval’s identity are satisfied, and we can write
∞ 2 2
a20 X 2
Z Z
1
+ an + b2n = 2
f (x) dx = f 2 (x) dx.
2 n=1
2 −2 0
This implies
Z 2 ∞
4 X 16
x2 dx = + (cos(nπ) − 1)2 .
0 2 n=1 π 4 n4
This can be simplified to give
8 64 h 1 1 1 i
= 2 + 4 4 + 4 + 4 + ··· ,
3 π 1 3 5
and hence
1 1 1 π4
+ + + · · · = .
14 34 54 96
b) Let
1 1 1
S= 4
+ 4 + 4 + ··· .
1 2 3
Split the series as
1 1 1
S= 14
+ 34
+ 54
+ · · · + 214 + 1
44
+ 1
64
+ ···
π4 1
= + 4 S.
96 2
Solving for S gives
π4
S= .
90
Example 5.4.2. Find the Fourier series of x2 , −π < x < π and use it along with Parseval’s
theorem to show that ∞
X 1 π4
= .
n=1
(2n − 1)4 96
Solution 5.4.2 (Solution to Example 5.4.2). Since f (x) = x2 is an even function, bn = 0. For
n ≥ 1,
2 π 2 2 π
Z Z
2h i 4
an = x cos(nx) dx = 0− x sin(nx) dx = 2 (−1)n .
π 0 π n 0 n
The constant term is π
2π 2
Z
2 2
a0 = x dx = .
π 0 3
110 CHAPTER 5. FOURIER SERIES AND SEPARATION OF VARIABLES
Thus ∞
π2
2
X (−1)n
x = +4 cos(nx).
3 n=1
n2
Rπ 2π 5
Since −π
x4 dx = 5
< ∞, by Parseval’s theorem,
π ∞
a2 X 2
Z
1
f (x) dx = 0 +
2
an + b2n .
π −π 2 n=1
1
Rπ 2π 4
Using π −π
x4 dx = 5
leads to
∞
4π 4 X 16 2π 4
+ = ,
18 n=1
n4 5
P∞ 1 π4
so n=1 n4 = 90
. Finally,
∞ ∞ ∞
X 1 X 1 1 X 1 15 π 4 π4
= − = = .
n=1
(2n − 1)4 n=1
n4 16 n=1 n4 16 90 96
Dirichlet nonhomogeneous BC
Consider the Boundary Value Problem (BVP) modelling heat propagation in a rod where the end points
are kept at constant temperatures u0 and u1 :