Chapter6-Separation.of.variables
Chapter6-Separation.of.variables
In this chapter, we shall solve various partial differential equations that occur in physics.
The main method is by using seperation of variables and the Fourier series. Let’s list the
Fourier series formula here for convenient reference:
1 L
Z
a0 = f (x) dx, (6.2a)
L −L
1 L
Z nπx
an = f (x) cos dx, n = 1, 2, . . . (6.2b)
L −L L
1 L
Z nπx
bn = f (x) sin dx, n = 1, 2, . . . (6.2c)
L −L L
• If f is even on −L ≤ x ≤ L,
Z L Z L
2 2 nπx
a0 = f (x) dx, an = f (x) cos dx, bn = 0. (6.3)
L 0 L 0 L
• If f is odd on −L ≤ x ≤ L,
Z L
2 nπx
a0 = 0, an = 0, bn = f (x) sin dx. (6.4)
L 0 L
Consider a two-dimensional piece of flat metal, where we wish to measure its temperature
at any point. An example would be a square piece of sides L, shown in Fig. 6.1
1
2 CHAPTER 6. SEPARATION OF VARIABLES
O L x
Figure 6.1
Additionally, we wish to see how its temperature distribution changes over time. There-
fore, the temperature at location (x, y) at time t is given by the function
The evolution of the temperature distribution over time is given by the heat equation
∂ 2u ∂ 2u
∂u
=σ + . (6.6)
∂t ∂x2 ∂y 2
∂u ∂2u
where ut means ∂t
and uxx means ∂x2
. Sometimes wey may also write
∂u ~ 2 u.
= σ∇ (6.8)
∂t
Our task is is to determine the function u(t, x, y), then we will know the temperature of
the metal at any point and time.
Consider the problem of a one-dimensional metal bar of length L along the x-axis (so we
can ignore the y-coordinates). Initially the temperature of the metal bar is uniform at
T0 = 10◦ C. The metal bar is attached at both ends to cold reservoirs of 0◦ C.
Before solving the problem, our everday knowledge knows that the temperature at both
ends will drop first, and the entire metal will eventually cool down to 0◦ C. We can prove
this by solving the heat equation. Since there is no y-direction, the problem is described
6.1. THE HEAT EQUATION 3
by the following:
∂u ∂ 2u
= σ 2 , 0 ≤ x ≤ L, t ≥ 0, (6.9)
∂t ∂x
u(t, 0) = u(t, L) = 0, u(0, x) = f (x), (6.10)
where f (x) is some initial temperature distribution of the bar. Fig. 6.2 shows a visual
representation of the metal bar.
u = 0◦ C
u = 0◦ C
x=0 x=L
We solve this problem by separation of variables. That is, we assume that the solution
takes the form
In other words, our two-variable function u(t, x) is actually a single-variable function T (t)
multiplied with another single-variable function X(x). Because of this, note that the
partial derivative takes the form
∂u dT ∂u dX ∂ 2u d2 X
=X , =T , = T . (6.12)
∂t dt ∂x dx ∂x2 dx2
dT d2 X
X = σT
dt dx2
1 dT 1 d2 X
= . (6.13)
dx2}
|σT{zdt} |X {z
t only x only
Writing in this form, the left-hand side is a function of t only, and the right-hand side
is a function of x only. So, what function of t can be equal to a function of a different
variable x?
The only possibility is that they are both equal to the same constant. Let us call this
4 CHAPTER 6. SEPARATION OF VARIABLES
constant λ, therefore
1 dT
= λ, (6.14a)
σT dt
1 d2 X
= λ. (6.14b)
X dx2
We can solve (6.14b) using the methods of the previous chapter. But that depends on
whether λ is positive or negative. Let us consider both cases:
d2 X
= α2 X. (6.15)
dx2
u(t, 0) = 0 → X(0) = 0,
0 = A cosh 0 + B sinh 0 → A = 0. (6.17)
u(t, L) = 0 → X(L) = 0,
0 = 0 cosh αL + B sinh αL → B = 0. (6.18)
X = Ax + B, (6.19)
where A and B are constants. The left boundary gives X(0) = 0 which requires
B = 0. The right boundary X(L) = AL = 0 requires A = 0. Therefore Case 2 also
does not give a meaningful solution.
d2 X
= −k 2 X. (6.20)
dx2
6.1. THE HEAT EQUATION 5
u(t, 0) = 0 → X(0) = 0,
0 = A cos 0 + B sin 0 → A = 0. (6.22)
u(t, L) = 0 → X(L) = 0,
0 = 0 cos kL + B sin kL. (6.23)
kL = nπ, n = 1, 2, . . . . (6.24)
2 2
Therefore, we now have found that λ is negative where λ = −k 2 = − nLπ2 , and the solution
for X is
nπx
X(x) = B sin (6.25)
L
dT n2 π 2 σ
= −λσT = − T. (6.26)
dt L2
The solution is
This solution will work for any positive integer n. So, we shall assume that a complete
6 CHAPTER 6. SEPARATION OF VARIABLES
At this point, we have used the two boundary conditions to determine our solution at its
current state. The coefficients bn are finally determined using the last condition, which is
u(0, x) = f (x). Putting t = 0, we have
∞
X nπx
u(0, x) = f (x) = bn sin . (6.30)
n=0
L
Therefore this is a Fourier series for the function f (x), which requires a specific function
to be given.
Example 6.1.1:
A metal rod of length L is initially at a temperature T0 for the entire rod. Both
ends attached to zero temperature sources, u = 0. Determine the temperature of
the metal rod as a function of time t and position x.
∂u ∂ 2u
= σ 2 , 0 ≤ x ≤ L, t ≥ 0, (6.31)
∂t ∂x
u(t, 0) = u(t, L) = 0, u(0, x) = T0 , (6.32)
This is just the Fourier series for a constant on the interval 0 ≤ x ≤ L. Notice that this
is just the right half of Example 5.1.1 in the previous chapter. Therefore we can just use
6.1. THE HEAT EQUATION 7
2T0
bn = (1 − (−1)n ) , (6.35)
nπ
Fig. 6.3 plots the solution for t = 0, t = 0.01, t = 0.10, and t = 0.30 for the case
L = 1 and T0 = 10◦ C. We see that as as time increases, the temperature at both ends
drops quickly first. The temperature near the centre drops the slowest because they are the
furthest away from the cold source. Eventually the whole bar will be cooled down to 0◦ C.
#
t=0
12 t = 0.01
t = 0.10
t = 0.30
10
8
u
0
0 0.2 0.4 0.6 0.8 1
x
Figure 6.3: Temperature distribution of a metal bar initialy at uniform temperature 10◦ C,
attached to cold sources of 0◦ C at both ends.
8 CHAPTER 6. SEPARATION OF VARIABLES
We shall now use this knowledge to solve the problem of a metal bar with insulated ends.
Let us suppose that, initially, the left side of the bar is at zero temperature, and the right
end of the bar is at 10◦ C. Then the function u(t, x) is determined by the boundary value
problem where the derivatives are fixed at the endpoints.
Example 6.1.2:
Solve the boundary value problem
∂u ∂ 2u
= σ 2 , 0 ≤ x ≤ L, t ≥ 0, (6.37)
∂t ∂x
∂u ∂u T0
(t, 0) = (t, L) = 0, u(0, x) = x. (6.38)
∂x ∂x L
1 dT 1 d2 X
= . (6.40)
σT dt X dx2
Same as before, we conclude that this equation is only possible if both sides are equal to
the same constant. Therefore
1 dT
=λ (6.41)
σT dt
1 d2 X
= λ. (6.42)
X dx2
There are three cases, depending on whether λ is positive, negative, or zero. We shall
investigate:
6.1. THE HEAT EQUATION 9
d2 X
= α2 X. (6.43)
dx2
∂u dX
(t, 0) = 0 → (0) = 0,
∂x dx
0 = kA sinh 0 + kB cosh 0 → B = 0. (6.46)
∂u dX
(t, L) = 0 → (L) = 0,
∂x dx
0 = kA sinh kL + 0 cosh kL → A = 0. (6.47)
d2 X
=0 (6.48)
dx2
X(x) = Ax + B. (6.49)
dX
(0) = 0 = A → A = 0, (6.50)
dx
X(L) = 0 = AL + 0 → A = 0. (6.51)
a0
This does not impose any constraints on B. Let us rename B = 2
, the possible
solution is
a0
X(x) = . (6.52)
2
10 CHAPTER 6. SEPARATION OF VARIABLES
d2 X
= −k 2 X (6.53)
dx2
The solution is
dX
(0) = 0 = −kA sin 0 + kB cos 0 → B = 0, (6.55)
dx
dX
(L) = 0 = −kA sin kL + 0 cos kL. (6.56)
dx
kL = nπ, n = 1, 2, . . . (6.57)
dT n2 π 2 σ
= −λσT = − T. (6.58)
dt L2
2 π 2 σt/L2
T (t) = Ce−n . (6.59)
2 π 2 σt/L2
nπx
u(t, x) = T (t)X(x) = BCe−n sin . (6.60)
L
As before, we rename the constants and assume a complete solution is a sum over all n:
∞
a0 X −n2 π 2 t/L2
nπx
u(t, x) = + an e cos . (6.61)
2 n=1
L
T0
We now use the final condition u(0, x) = L
x. Then we obtain
∞
T0 a0 X nπx
u(0, x) = x = + an cos . (6.62)
L 2 n=1
L
This is a Fourier series expansion for the function f (x) = TL0 x. We have solve this Fourier
series in Example 5.1.2 for the interval −L ≤ x ≤ L. Now we just take the part 0 ≤ x ≤ L
6.1. THE HEAT EQUATION 11
10
t=0
t = 0.05
t = 0.20
t = 0.30
8
6
u
0
0 0.2 0.4 0.6 0.8 1
x
Suppose the metal bar in question has additional effects. The PDE to be solve is now
∂ 2u
∂u ∂u
=σ +η + ξu , 0 ≤ x ≤ L, t ≥ 0, (6.64)
∂t ∂x2 ∂x
u(t, 0) = u(t, L) = 0, u(o, x) = f (x). (6.65)
Substitute into the PDE and collecting the terms, we find that
∂v ∂ 2 v
∂v 2 ∂v
βv + = σ α v + 2α + + ηαv + η + ξv
∂t ∂x ∂x2 ∂x
∂ 2v
∂v 2 β ∂v
= σ 2 + σ α − + αη + ξ v + (2α + η) (6.67)
∂t ∂x σ ∂x
If the terms in the square brackets become zero, it reduces to the PDE we know how to
solve. Therefore, let us choose α and β to make it zero by solving the equations
β
α2 − + αη + ξ = 0 (6.68)
σ
2α + η = 0. (6.69)
2 /4)t
u(t, x) = e−ηx/2+σ(ξ−η v(t, x) (6.71)
Let us see how the boundary conditions are expressed in this form. The first condition is
2 /4)t
u(t, 0) = 0 = e0+σ(ξ−η v(t, 0) → v(t, 0) = 0. (6.72)
2 /4)t
u(t, L) = 0 = e−ηL/2+σ(ξ−η v(t, L) = 0 → v(t, L) = 0. (6.73)
6.1. THE HEAT EQUATION 13
Therefore the problem has been reduced to the earlier problem where we can solve by
using the Fourier series method.
Example 6.1.3:
Solve the problem
d2 u
∂u ∂u
=4 +2 + 2u , 0 ≤ x ≤ π, t ≥ 0, (6.75)
∂t dx2 ∂x
u(t, 0) = u(t, π) = 0, u(0, x) = sin (3x) . (6.76)
L = π, σ = 4, η = ξ = 2. (6.77)
α = −1, β = 4. (6.78)
Therefore we let
Substituting into the PDE, we find that v satisfies the boundary-value problem
∂v ∂ 2v
= 4 2 , 0 ≤ x ≤ π, t ≥ 0, (6.80)
∂t ∂x
v(t, 0) = v(t, π) = 0, v(0, x) = ex sin(3x). (6.81)
Let us consider a wave equation in one spatial direction which is bounded. A wave
equation is given by
∂ 2u 2
2∂ u
= c , 0 ≤ x ≤ L, t ≥ 0. (6.84)
∂t2 ∂x2
We can again apply the idea of separation of variables to solve this problem. As before,
we assume that u takes the form
where T (t) is a function that depends on t only and X(x) is a function that depends on
x only. Substituting Eq. (6.85) into (6.84), we have
d2 T 2 d X
2
X = c T
dt2 dx2
2 2
1 dT 1 dX
2 2
= . (6.86)
|c T{zdt } |X {z dx2 }
t only x only
The terms on the left hand side depend on t only, while the term on the right hand side
depend on x only. The only way that ‘functions’ of two different variables be equal to each
other is that they are equal to the same constant. We let the constant be −λ. Therefore
6.2. THE WAVE EQUATION 15
we have
d2 X
= λX (6.87)
dx2
d2 T
= λc2 T. (6.88)
dt2
X(x) = Ax + B, (6.91)
T (t) = Ct + D. (6.92)
Note that since the time derivative of Eq. (6.84) is of second order, the boundary condi-
tions may include specifying the value of
du
(6.95)
dt
du
at a certain time or position. Usually at t = 0. The quantity dt
is called the velocity
since it describes how fast u changes over time.
16 CHAPTER 6. SEPARATION OF VARIABLES
Example 6.2.1:
Suppose a string with ends fixed at x = 0 and x = π and initialy has the configu-
ration
The string is then released with an initial velocity g(x) = 0. Describe the motion
of the string if c = 1.
Applying separation of variables, the boundary conditions only allows Case 3, with A = 0
and kL = nπ. The solution for X is
nπx
X(x) = B sin , n = 1, 2, . . . (6.97)
L
We rename the constants, and assume the complete solution is the sum over all n. There-
fore
∞
X
u(t, x) = [An cos (nt) + Bn sin (nt)] sin nx. (6.100)
n=1
This is the Fourier series expansion for the function f (x) = x(π − x). Therefore our
6.2. THE WAVE EQUATION 17
coefficients An are
4
An = 3
(1 − (−1)n ) . (6.102)
πn
∂u
Using the boundary condition ∂t
(0, x) = 0, we just have Bn = 0. Therefore our solution
is
∞
X 4
u(t, x) = 3
(1 − (−1)n ) cos nt sin nx. (6.104)
n=1
πn
Example 6.2.2:
Suppose a string with ends fixed at x = 0 and x = π and initialy has the configura-
tion u(0, x) = 0. The string is then released with an initial velocity g(x) = x(π − x).
Describe the motion of the string if c = 1.
∂u
The the initial condition is ∂t
(0, x) = x(π − x). Therefore
∞
∂u X
(0, x) = x(π − x) = [−nAn sin 0 + nBn cos 0] sin nx
∂t n=1
∞
X
= nBn sin nx. (6.106)
n=1
This is the Fourier series expansion for the function x(π −x) with coefficients bn = (nBn ).
18 CHAPTER 6. SEPARATION OF VARIABLES
4
bn = nBn = 3
(1 − (−1)n )
πn
4
Bn = 4
(1 − (−1)n ). (6.107)
πn
Example 6.2.3:
Suppose a string can be described by its vertical displacement as a function of time
t and position x according to the wave equation
∂ 2u 2
2∂ u
= c . (6.109)
∂t2 ∂x2
Its ends are fixed at 0 and π. The string is initially picked up at the middle point
to the position
(
x for 0 ≤ x < π2 ,
f (x) = (6.110)
π−x for π2 ≤ x ≤ π,
and released with an intial velocity g(x) = x(1 + cos x). Describe the motion of the
string if c = 1.
where we have renamed the constants An = BC and Bn = BD. We assume the complete
solution to be a sum over all n,
∞
X
u(t, x) = (An cos nt + Bn sin nt) sin nx. (6.116)
n=1
We now apply the initial condition, where u(0, x) = f (x), where f (x) is given by Eq. 6.110.
Therefore
∞
X
u(0, x) = f (x) = (An cos 0 + Bn sin 0) sin nx
n=0
X∞
= An sin nx. (6.117)
n=0
To determine the coefficient, let us suppose that f (x) is the right half of a function
(
−f (x), if − L ≤ x < 0,
F (x) = (6.118)
f (x), if 0 ≤ x ≤ L,
where f (x) is given by (6.110). In other words, we consider f (x) as the right half of an
odd function, so that its Fourier series only contains sine terms. Using the formula (6.2),
1 π
Z
An = f (x) sin nx dx
π −π
Z π
2
= f (x) sin nx dx
π 0
2 π/2 2 π
Z Z
= x sin nx dx + (π − x) sin nx dx
π 0 π π/2
2 π/2
Z π
2 π
Z Z
= x sin nx + 2 sin nx dx + x sin nx dx
π 0 π/2 π π/2
π/2 π
2 x 1 2h π iπ 2 x 1
= − cos nx + 2 sin nx + − cos nx − − cos nx + 2 sin nx
π n n 0 π n π/2 π n n π/2
2 π nπ 1 nπ π nπ
= − cos + 2 sin − cos nπ − cos
π 2n 2 n 2 n 2
π π nπ 1 nπ
− − cos nπ + cos + 0 − 2 sin
n 2n 2 n 2
2 2 nπ 4 sin(nπ/2)
= sin = .
π n2 2 πn2
20 CHAPTER 6. SEPARATION OF VARIABLES
∂u
To determine Bn , we use the intial velocity, ∂t
(0, x) = g(x) = x(1 + cos x).
∞
∂u X
(t, x) = (−nAn sin nt + nBn cos nt) sin nx
∂t n=1
∞
∂u X
(0, x) = g(x) = nBn sin nx.
∂t n=1
Similar to the above, we consider g(x) as the right half of an odd function. Using the
formula, then this is the Fourier series expansion for the function g(x) with coefficients
nBn . Therefore we use the formula
2 π 2 π
Z Z
nBn = g(x) sin nxdx = x(1 + cos x) sin nx dx
π 0 π 0
2 π
Z
= (x sin nx + x cos x sin nx) dx
π 0
2 π 2 π
Z Z
= x sin nx dx + x cos x sin nx dx
π 0 π 0
2 π
Z
2 n
= − (−1) + x cos x sin nx dx.
n π 0
Using the identity sin nx cos mx = 12 [sin(n + m)x + sin(n − m)x], the second integral is
(
π
− 21 if n = 1,
Z
2
x cos x sin nx dx = (6.119)
π 0 2(−1)n n(n21−1) if n = 2, 3, . . .
#
6.2. THE WAVE EQUATION 21
∂ 2u 2
2∂ u
= c + F (x),
∂t2 ∂x2
∂u
u(t, 0) = 0, u(t, L) = 0, u(0, x) = f (x), (0, x) = g(x), (6.121)
∂t
To solve such a problem in the presence of F (x), we try a solution of the form
2 2
∂v 2∂ v 2d ψ
= c + c + F,
∂t2 ∂x2 dx2
v(t, 0) + ψ(0) = 0 = v(t, L) + ψ(L),
∂v
v(0, x) + ψ(x) = f (x), (0, x) + 0 = g(x). (6.123)
∂t
If we purposely choose
d2 ψ
c2 + F = 0, (6.124)
dx2
Example 6.2.4:
Solve the wave equation problem
∂ 2u 2
2∂ u
= c + x,
∂t2 ∂x2
u(t, 0) = u(t, L) = 0,
∂u πx
u(0, x) = x(L − x), (0, x) = x 1 + cos . (6.126)
∂t L
Substitute this into the problem (6.126), the problem is converted into
∂ 2v 2
2∂ v
2
2d ψ
=c +c + x,
∂t2 ∂x2 dx2
v(t, 0) + ψ(0) = v(t, L) + ψ(L) = 0,
∂v πx
v(0, x) + ψ(x) = x(L − x), (0, x) = x 1 + cos . (6.128)
∂t L
d2 ψ x
2
= − 2,
dx c
x3
ψ(x) = − 2 + αx + β. (6.129)
6c
L3
v(t, L) + ψ(L) = 0 = v(t, L) − + αL + 0. (6.131)
6c2
L2
If we choose α = 6c2
, then the boundary condition becomes v(t, L) = 0.
6.2. THE WAVE EQUATION 23
x3 L2 x
ψ(x) = − + . (6.132)
6c2 6c2
∂ 2v 2
2∂ v
= c ,
∂t2 ∂x2
v(t, 0) = 0 = v(t, L),
x3 L2 x ∂v
v(0, x) = f (x) + − , (0, x) = g(x). (6.133)
6c2 6c2 ∂t
We can now solve this using separation of variables. Letting v(t, x) = T (t)X(x). The
fixed endpoints for v gives case 3 with A = 0 and kL = nπ. The solution is
nπx
X(x) = B sin , (6.134)
L
nπct nπct
T (t) = C cos + D sin . (6.135)
L L
We proceed in the usual way in renaming the constants and assuming a complete solution
is a sum over n,
∞
X nπct nπct nπx
v(t, x) = An cos + Bn sin sin (6.136)
n=1
L L L
x3 L2 x
The initial condition is v(0, x) = x(L − x) + 6c
− 6c2
,
∞
x3 L2 x X nπx
v(0, x) = x(L − x) + − 2 = An sin . (6.137)
6c 6c n=1
L
x3 L2 x
We can consider x(L − x) + 6c
− 6c2
to be a right half of an odd function, we use the
formula for the coefficient
2 L x3 L 2 x
Z nπx
An = x(L − x) + − 2 sin dx
L 0 6c 6c L
2
= 3
[2 (1 − (−1)n ) + π(−1)n ] . (6.138)
πn
πx
We consider x 1 + cos L
as the right half of an odd function. The coefficients are
24 CHAPTER 6. SEPARATION OF VARIABLES
#
6.2. THE WAVE EQUATION 25
If t is time and x is position, a function where its graph translates linearly in time is also
a solution to the wave equation. An example is shown in Fig. 6.5. The top figure shows
the graph y = f (x) at time t = 0. At some later time t 6= 0, the graph have moved to the
positive-x direction by ct units. That means, the function of the new graph is given by
f (x − ct)
y A
t=0
x
y A
Some later t
x = ct x
Figure 6.5
where k and ω are constants satisfies the eave equation. That means, as t changes, the
graph y = f (kx − ωt) shifts along the x-axis. We can calculate the wave velocity by
the following method: First, let u = kx − ωt. Take for example, the point A in Fig. 6.5.
Let us track the motion of one particular point on the graph, f (u0 ) for some choice of u0 .
We have
u0 = kx − ωt
u0 ω
x= + t. (6.142)
k k
This gives the x-coordinate of point A. Assuming ω and k are positive, then as t increases,
26 CHAPTER 6. SEPARATION OF VARIABLES
dx ω
c= = . (wave velocity) (6.143)
dt k
Let us see the differential equation obeyed by a wave. Again, we let u = kx − ωt, so that
Take the partial derivative with respect to t. Using the chain rule,
∂f df ∂u df
= = (−ω). (6.145)
∂t du ∂t du
∂ 2f d2 f 2
2d f
= (−ω)(−ω) = ω . (6.146)
∂t2 du2 du2
∂ 2f 2
2d f
= k . (6.147)
∂x2 du2
∂2f 2
∂t2
ω 2 dduf2 ∂ 2f k2 ∂ 2f
∂2f
= → = (6.148)
2
k 2 dduf2 ∂x2 ω 2 ∂t2
∂x2
From Eq. (6.143), ω/k is the wave velocity. Therefore we have shown that the function
satisfies the wave equation
∂ 2f 1 ∂ 2f
= . (6.149)
∂x2 c2 ∂t2
6.3. THE LAPLACE AND POISSON EQUATIONS 27
The Laplace and Poisson equation typically occurs in electrostatics, among other fields.
Suppose an electric field is given by a gradient of an electrostatic potential,
~ = −∇Φ.
E ~ (6.150)
Maxwell’s equation is
~ = ρ
~ ·E
∇
0
~ · ∇Φ
~
ρ
−∇ =
0
ρ
∇2 Φ = − , (6.151)
0
where ρ is the charge density. This is Poisson’s equation. The case where ρ = 0,
∇2 Φ = 0, (6.152)
We consider the two-dimensional case, and use our usual notation u(x, y) instead of Φ.
2 2
~ 2 u = ∂ u + ∂ u = 0.
∇ (6.153)
∂x2 ∂y 2
∂ 2u ∂ 2u
+ = 0, 0 ≤ x ≤ L, 0 ≤ y ≤ K,
∂x2 ∂y 2
u(x, 0) = u(0, y) = u(L, y) = 0, u(x, K) = f (x). (6.154)
Here, the range of x and y in the problem lies in a rectangle of width L and height K.
The boundary conditions are that u = 0 at three of the sides, and the condition on the
top side is u(x, K) = f (x), where f is some function of x. This problem can be visualised
in Fig. 6.6.
28 CHAPTER 6. SEPARATION OF VARIABLES
u = f (x)
K
u=0
u=0 u=0
L x
Figure 6.6: The Dirichlet problem on a rectangle defined by Eq. (6.154).
To perform separation of variables, we let u(x, y) = X(x)Y (y). Substitute into the PDE,
we find that
d2 X d2 Y
Y + X = 0.
dx2 dy 2
1 d2 X 1 d2 Y
+ = 0. (6.155)
dx2} Y dy 2
|X {z | {z }
x only y only
The first term is a function of x only, and the second term is a function of y only. The
only way two functions of different variables adds up to zero for any x and y is that the
‘functions’ are constants, each of opposite signs. Therefore there must exist a constant λ
such that
1 d2 X 1 d2 Y
= λ, = −λ. (6.156)
X dx2 Y dy 2
u(0, x) = 0 → X(0) = 0
0 = A cosh 0 + B sinh 0 → A = 0. (6.158)
6.3. THE LAPLACE AND POISSON EQUATIONS 29
u(L, x) = 0 → X(L) = 0
0 = 0 cosh αL + B sinh αL → B = 0. (6.159)
X(x) = Ax + B. (6.160)
X(0) = 0 = A0 + B → B = 0, (6.161)
X(L) = 0 = AL + 0 → A = 0. (6.162)
kL = nπ, n = 1, 2, . . . (6.166)
1 d2 Y n2 π 2
= + . (6.168)
Y dy 2 L2
30 CHAPTER 6. SEPARATION OF VARIABLES
n2 π 2 y
nπy
Y (y) = C cosh + D sinh . (6.169)
L L
u(x, 0) = 0 → Y (0) = 0,
0 = C cosh 0 + D sinh 0 → C = 0. (6.170)
As usual, we rename the constant BD, and assume the complete solution to be the sum
over all n,
∞
X nπx nπy
u(x, y) = Bn sin sinh . (6.173)
n=1
L L
This is a Fourier series for the function f (x) with coefficients bn = Bn sinh nπy
L
. Given
a particular f (x) for a problem, we can use the Fourier series formula to determine bn ,
then solve for Bn .
Example 6.3.1:
Solve the Dirichlet problem on a rectangle
∂ 2u ∂ 2u
+ = 0, 0 ≤ x ≤ π, 0 ≤ y ≤ π,
∂x2 ∂y 2
u(x, 0) = u(0, y) = u(π, y) = 0, u(x, π) = x(π − x). (6.175)
6.3. THE LAPLACE AND POISSON EQUATIONS 31
Let us consider f (x) as the right half of an odd function, so that the sine series has
coefficients given by
Z π
2
Bn sinh nπ = x(π − x) sin nx dx
π 0
π
2 π 2
Z Z
=2 x sin nx dx − x sin nx dx,
0 π 0
4
= 3
(1 − (−1)n ) . (6.178)
πn
Therefore,
4(1 − (−1)n
Bn = (6.179)
πn3 sinh nπ
We have learned how to solve Dirichlet problems on a rectangle where the boundary
conditions on three sides are zero, and one side non-zero. What about the case with two
boundaries non-zero?
We simply split this into two problems with three zero boundaries. For instance, suppose
32 CHAPTER 6. SEPARATION OF VARIABLES
∂ 2u ∂ 2u
+ = 0, 0 ≤ x ≤ L, 0 ≤ x ≤ K,
∂x2 ∂y 2
u(0, y) = u(x, 0) = 0, u(x, K) = f (x), u(L, y) = g(y), (6.181)
∂ 2v ∂ 2v
Problem I : + = 0, 0 ≤ x ≤ L, 0 ≤ y ≤ K,
∂x2 ∂y 2
v(0, y) = v(x, 0) = v(x, K) = 0, v(L, y) = g(y). (6.183)
∂ 2w ∂ 2w
Problem II : + = 0, 0 ≤ x ≤ L, 0 ≤ y ≤ K,
∂x2 ∂y 2
w(0, y) = w(x, 0) = w(L, 0) = 0, w(x, K) = f (x) (6.184)
u = f (x)
K
u = g(y)
u=0
u=0
L x
v=0 w = f (x)
v = g(y)
w=0
w=0
v=0
v=0 w=0
Problem I Problem II
Figure 6.7: Splitting the Dirichlet problem into two simpler problems.
6.3. THE LAPLACE AND POISSON EQUATIONS 33
Then, Problems I and II are solved using the methods already discussed to find v and w.
Then add them up to get the full solution u(x, y) = v(x, y) + w(x, y).
Example 6.3.2:
Solve the problem
∂ 2u ∂ 2u
+ = 0, 0 ≤ x ≤ 2, 0 ≤ y ≤ π,
∂x2 ∂y 2
u(0, y) = u(x, 0) = 0, u(2, y) = sin y, u(x, π) = x sin πx. (6.185)
∂ 2v ∂ 2v
Problem I : + = 0, 0 ≤ x ≤ 2, 0 ≤ y ≤ π,
∂x2 ∂y 2
v(0, y) = v(x, 0) = v(x, π) = 0, v(2, y) = sin y.
∂ 2w ∂ 2w
Problem II : + = 0, 0 ≤ x ≤ 2, 0 ≤ y ≤ π,
∂x2 ∂y 2
w(0, y) = w(x, 0) = w(2, 0) = 0, w(x, π) = x sin πx.
sinh nx
v(x, y) = sin y.
sinh 2
34 CHAPTER 6. SEPARATION OF VARIABLES
nπ 2 2 2
Z nπx
bn = Bn sinh = x sin πx sin dx
2 2 0 2
2
nπ 16n ((−1)n − 1)
Bn sinh =
2 π 2 (n2 − 4)2
16n((−1)n − 1)
Bn = 2 2 , n 6= 2
π (n − 4)2 sinh (nπ 2 /2)
Notice that the above calculation is only valid for n 6= 2. For the case n = 2, we
start again from the beginning to find that
2π 2 2 2
Z
2πx
B2 sinh = x sin πx sin dx
2 2 0 2
2 Z 2
2π
B2 sinh = x sin2 πx dx
2 0
2
2π
B2 sinh =1
2
1
B2 =
sinh (nπ 2 /2)
We have now solved Problems I and II to obtain v and w. The final solution is
What if we are given a Lapalce equation problem, but the boundary shape is not rectan-
gular. Suppose the boundary is a circle of radius R, as shwon in Fig. 6.8.
x2 + y 2 ≤ ρ2
u = f (φ)
∂ 2u ∂ 2u ∂ 2 u 1 ∂u 1 ∂ 2u
+ = + + . (6.187)
∂x2 ∂y 2 ∂r2 r ∂r r2 ∂φ2
∂ 2 u 1 ∂u 1 ∂ 2u
+ + = 0, (6.188)
∂r2 r ∂r r2 ∂φ2
36 CHAPTER 6. SEPARATION OF VARIABLES
∂ 2 u 1 ∂u 1 ∂ 2u
+ + = 0, 0 ≤ r ≤ ρ, −π ≤ φ ≤ π,
∂r2 r ∂r r2 ∂φ2
u(ρ, φ) = f (φ), (6.189)
d2 R 1 dR 1 d2 Φ
Φ + Φ + R = 0. (6.191)
dr2 r dr r2 dφ2
1 d2 R 1 dR 1 d2 Φ
+ + =0
R dr2 Rr dr r2 Φ dφ2
2
1 d2 Φ
1 2d R dR
r + r + = 0. (6.192)
R dr2 dR Φ dφ2
| {z } | {z }
r only φ only
We have managed to separate the equation into terms depending on r only and terms
depending on φ only. This implies a separation constant λ such that
1 d2 Φ d2 R
1 dR
= λ, r2 2 +r = λ. (6.193)
Φ dφ2 R dr dr
Notice that φ is an angle. Therefore φ + 2π comes back to the same point. The
condition is
But, cosh αφ 6= cosh α(φ + 2π) and sinh αφ 6= sinh α(φ + 2π). Therefore λ cannot
6.3. THE LAPLACE AND POISSON EQUATIONS 37
be negative.
Φ(φ) = A0 φ + B0 . (6.196)
But Φ(φ + 2π) = A0 φ + 2A0 π + B0 . This combination will still be equal to Φ(φ) if
A = 0. So a possible solution for case 2 is
Φ = B0 . (6.197)
The condition is
d2 R dR
r2 2
+r − n2 R = 0. (6.201)
dr dr
All the terms involve differentiations of r and powers of r. So we guess that our solution
is R(r) = rn . To see whether this is correct, we substitute into Eq. (6.201),
r2 (n − 1)nrn−2 + r nrn−1 − n2 rn
We have confirmed that Eq. (6.201) is solved. We then assemble our solution, u(r, φ) =
R(r)Φ(φ). We rename the constants, and assuming the complete solution is a sum over
38 CHAPTER 6. SEPARATION OF VARIABLES
n,
∞
a0 X n
u(r, φ) = + r (an cos nφ + bn sin nφ) . (6.203)
2 n=1
This is a Fourier series for the function f (φ) on the interval 0 ≤ x ≤ 2π. Because all
functions in this problem are periodic, we can shift the interval to −π ≤ φ ≤ π. Therefore
the coefficients are determined by
1 π
Z
a0 = f (φ) dφ, (6.205)
π −π
1 π
Z
n
ρ an = f (φ) cos nφ dφ, (6.206)
π −π
1 π
Z
n
ρ bn = f (φ) sin nφ, dφ. (6.207)
π −π
Example 6.3.3:
Solve the Dirichlet problem on a disk
∂ 2 u 1 ∂u 1 ∂ 2u
+ + = 0, 0 ≤ r ≤ 4, −π ≤ φ ≤ π,
∂r2 r ∂r r2 ∂φ2
u(ρ, φ) = φ2 , (6.208)
At the boundary, r = 4, it is
∞
a0 X n
2
u(4, φ) = φ = + 4 (an cos nφ + bn sin nφ) .
2 n=1
6.3. THE LAPLACE AND POISSON EQUATIONS 39
Next for an ,
1 π 2 2 π 2
Z Z
n
4 an = φ cos nφ dφ = φ cos nφ dφ
π −π π 0
2 π
2 φ 2 2φ
= + 3 sin nφ + 2 cos nφ
π n n n 0
n
2 2π 4(−1)
= cos nπ =
π n2 n2
n
4(−1)
an =
4n n2
∂ 2u ∂ 2u
+ = P (x, y), 0 ≤ x ≤ L, 0 ≤ y ≤ K,
∂x2 ∂y 2
u(0, y) = u(L, y) = u(x, 0) = u(x, K) = 0. (6.209)
The boundary conditions at x = 0 and x = L are zero. Our previous experience tells us
that the solution for X(x) is probably a solution of the form
nπx
X(x) = B sin , n = 1, 2, . . . . (6.210)
L
Similarly, the boundary conditions at y = 0 and y = K are also zero. By the same
40 CHAPTER 6. SEPARATION OF VARIABLES
Constructing our solution this way, we have guaranteed that u(x, y) satisfies all four
boundary conditions.
We still need to make sure that this satisfies the full PDE. Substituting into the PDE,
∞ X ∞
∂ 2u X n2 π 2 nπx mπx
= − c nm sin sin ,
∂x2 n=1 m=1
L 2 L L
2 ∞ X ∞
∂ u X m2 π 2 nπx mπx
= − c nm sin sin . (6.213)
∂y 2 n=1 m=1
L2 L L
∂ 2u ∂ 2u
+ = P (x, y)
∂x2 ∂y 2
∞ X ∞ 2 2
m2 π 2
X nπ nπx mπx
−cnm 2
+ 2
sin sin = P (x, y). (6.214)
n=1 m=1
L K L L
This is a double Fourier expansion for P (x, y). The coefficients cnm are determined by
L K
n2 π 2 m2 π 2
Z Z
4 nπx mπy
−cnm + = P (x, y) sin sin dxdy. (6.215)
L2 K2 LK 0 0 L K
Example 6.3.4:
Solve the Poisson problem
∂ 2u ∂ 2u
+ = xy 2 , 0 ≤ x ≤ 1, 0 ≤ y ≤ 1,
∂x2 ∂y 2
u(x, 0) = u(x, 1) = u(0, y) = u(1, y) = 0. (6.216)