Seperation of Var M415

Download as pdf or txt
Download as pdf or txt
You are on page 1of 36

Chapter 5.

Separation of Variables

At this point we are ready to now resume our work on solving the three
main equations: the heat equation, Laplaces equation and the wave equation using the method of separation of variables.

4.1

The heat equation

Consider, for example, the heat equation


ut = u xx , 0 < x < 1,

t>0

(4.1)

subject to the initial and boundary conditions


u(x, 0) = x x2 ,

u(0, t) = u(1, t) = 0.

(4.2)

Assuming separable solutions


u(x, t) = X(x)T(t),

(4.3)

shows that the heat equation (4.1) becomes


XT 0 = X 00 T,
which, after dividing by XT and expanding gives
T0
X 00
=
,
T
X

(4.4)

implying that
T 0 = T,

X 00 = X,

(4.5)

where is a constant. From (4.2) and (4.3), the boundary conditions becomes
X(0) = X(1) = 0.

(4.6)

Chapter 5. Separation of Variables

Integrating the X equation in (4.5) gives rise to three cases depending on


the sign of but as seen in the last chapter, only the case where = k2
for some constant k is applicable which we have as the solution
X(x) = c1 sin kx + c2 cos kx.

(4.7)

Imposing the boundary conditions (4.6) shows that


c1 sin 0 + c2 cos 0 = 0,

c1 sin k + c2 cos k = 0,

(4.8)

c1 sin k = 0 k = 0, , 2, . . . n,

(4.9)

which leads to
c2 = 0,

where n is an integer. From (4.5), we further deduce that


T(t) = c3 en

2 2 t

giving the solution

u(x, t) =

bn en t sin nx,

n=1

where we have set c1 c3 = bn . Using the initial condition gives


u(x, 0) = x x2 =

bn sin nx.

n=1

At this point, we recognize that we have a Fourier sine series and that the
coefficients bn are chosen such that
Z 1
bn = 2
(x x2 ) sin nx dx
0

1 2x
= 2
cos nx +
n2 2
4
=
(1 (1)n ).
3
n 3

2
x2 x
3 3
n
n

cos nx
0

Thus, the solution of the PDE as


u(x, t) =

4
3

1 (1)n n2 2 t
sin nx.
n3 e
n=1

(4.10)

4.1. The heat equation

Figure 1 shows the solution at times t = 0, 0.1 and 0.2.


Example 1
Solve
ut = u xx , 0 < x < 1,

t>0

(4.11)

subject to
u(x, 0) = x x2 ,

u x (0, t) = u x (1, t) = 0.

(4.12)

This problem is similar to the proceeding problem except the boundary


conditions are different. The last problem had the boundaries fixed at zero
whereas in this problem, the boundaries are insulated (i.e. no flux boundary conditions). Assuming that the solutions are separable
u(x, t) = X(x)T(t),

(4.13)

then from the heat equation, we obtain


T 0 = T,

X 00 = X,

(4.14)

where is a constant. The boundary conditions in (4.12) become, accordingly


X 0 (0) = X 0 (1) = 0.

(4.15)

Integrating the X equation in (4.14) gives rise to again three cases depending on the sign of but as seen earlier, only the case where = k2 for
some constant k is relevant. Thus, we have
X(x) = c1 sin kx + c2 cos kx.

(4.16)

Imposing the boundary conditions (4.15) shows that


c1 k cos 0 c2 k sin 0 = 0,

c1 k cos k c2 k sin k = 0,

(4.17)

which leads to
c1 = 0, sin k = 0 k = 0, , 2, . . . , n,

(4.18)

Chapter 5. Separation of Variables

where n is an integer. From (4.14), we also deduce that


T(t) = c3 en

2 2 t

giving the solution

u(x, t) =

an en t cos nx,

n=0

where we have set c1 c3 = an . Using the initial condition gives


u(x, 0) = x x

an cos nx

n=0

a0
=
+ an cos nx.
2
n=1

We again recognize that we have a Fourier cosine series and that the coefficients an are chosen such that
Z
a0 = 2
Z
an = 2

1
0
1

1
x2 x3
1

= ,
(x x ) dx = 2

2
3 0 3

(x x2 ) cos nx dx

1 2x
= 2
sin nx
n2 2
2
= 3 3 (1 + (1)n ).
n

2
x2 x
3 3
n
n

sin nx
0

Thus, the solution of the PDE as


u(x, t) =

2
1
+ 3
3

(1)( n + 1) 1 n2 2 t
e
cos nx.
n3
n=1

(4.19)

Figure 1 shows the solution at times t = 0, 0.25 and 0.5. It is interesting


to note that even though that same initial condition are used for each of
the two problems, fixing the boundaries and insulated them gives rise two
totally different behaviors after t 0.

4.1. The heat equation

0.3

0.3

t=0

t=0

0.2

0.2

t = .05
t = 0.1

t = .025

0.1

0.1

t = 0.2
0.0

0.0
0.0

0.5

1.0

0.0

0.5

1.0

Figure 1. The solution of the heat equation with the same initial condition with
fixed and no flux boundary conditions.

Example 2
Solve
ut = u xx , 0 < x < 2,

t>0

(4.20)

subject to
(
u(x, 0) =

x
2x

if 0 < x < 1,
if 1 < x < 2,

u(0, t) = u x (2, t) = 0.

(4.21)

In this problem, we have a mixture of both fixed and no flux boundary


conditions. Again, assuming separable solutions
u(x, t) = X(x)T(t),

(4.22)

gives rise to
T 0 = T,

X 00 = X,

(4.23)

where is a constant. The boundary conditions in (4.21) becomes, accordingly


X(0) = X 0 (1) = 0.

(4.24)

Integrating the X equation in (4.23) with = k2 for some constant k gives


X(x) = c1 sin kx + c2 cos kx.

(4.25)

Chapter 5. Separation of Variables

Imposing the boundary conditions (4.24) shows that


c1 sin 0 + c2 cos 0 = 0,

c1 k cos 2k c2 k sin 2k = 0,

which leads to
3 5
(2n 1)
,
,
,...,
,
4 4 4
4

c2 = 0, cos 2k = 0 k =

for integer n. From (4.23), we then deduce that


T(t) = c3 e

(2n1)2 2
t
16

giving the solution

u(x, t) =

bn e

(2n1)2 2
t
16

n=1

sin

(2n 1)
x,
4

where we have set c1 c3 = bn . Using the initial condition give

u(x, 0) =

bn sin

n=1

(2n 1)
x.
4

Recognizing that we have a Fourier sine series, we obtain the coefficients


bn as
Z
bn = 2

1
0

(2n 1)
x sin
x dx +
4

(2 x) sin
1

(2n 1)
x dx
4

32
(2n 1)
8x
2n 1
=
sin
x
cos
x
2
2
4
(2n 1)
4
(2n 1)
0

32
(2n 1)
8(x 2)
2n 1

sin
+

x
+
cos
x

4
(2n 1)
4
(2n 1)2 2
1

32
(2n 1)
sin
+ cos n .
=
4
(2n 1)2 2
Hence, the solution of the PDE is

(2n1)

sin
+
cos
n
(2n1)2
4
32
2n 1
16 2 t
x. (4.26)
u(x, t) = 2
e
sin
2
4
n=1
(2n 1)
Figure 2 shows the solution both in short time t = 0, 0.1, 0.2 and long time
t = 10, 20, 30.

4.1. The heat equation

0.8

t=0

t = 10

t=2

t = 20

0.4

t = 30
t=1

x
0.0

x
0

Figure 2. Short time and long time behavior of the solution (4.26).

Example 3
Solve
ut = u xx , 0 < x < 2,

t>0

(4.27)

subject to
u(x, 0) = 2x x2 u(0, t) = 0, u x (2, t) = u(2, t).

(4.28)

In this problem, we have a fixed left endpoint and a radiating right end
point. Assuming separable solutions
u(x, t) = X(x)T(t),

(4.29)

gives rise to
T 0 = T,

X 00 = X,

(4.30)

where is a constant. The boundary conditions in (4.28) becomes, accordingly


X(0) = 0,

X 0 (2) = X(2).

(4.31)

Integrating the X equation in (4.30) with = k2 for some constant k gives


X(x) = c1 sin kx + c2 cos kx.
Imposing the first boundary condition of (4.31) shows that
c1 sin 0 + c2 cos 0 = 0, c2 = 0

(4.32)

Chapter 5. Separation of Variables

and the second boundary condition of (4.31) gives


tan 2k = k.

(4.33)

It is very important that we recognize that the solutions of (4.33) are not
equally spaced as seen in earlier problems. In fact, there are an infinite
number of solutions of this equation. Figure 3 shows graphically the curves
y = k and y = tan 2k. The first three intersection points are the first three
solutions of (4.33).
y
4

0
0

k3
1

Figure 3. The graph of y = tan 2k and y = k.

Thus, it is necessary that we solve for k numerically. The first 10 solutions


are given in table 1.
n
1
2
3
4
5

kn
1.144465
2.54349
4.048082
5.586353
7.138177

n
6
7
8
9
10

kn
8.696622
10.258761
11.823162
13.389044
14.955947

Table 1. The first ten solution of tan 2k = k.

Therefore, we have
X(x) = c1 sin k n x.

(4.34)

Further, integrating (4.30) for T gives


2

T(t) = c3 ekn t

(4.35)

4.1. The heat equation

and together with X, we have the solution to the PDE as

u(x, t) =

cn ekn t sin kn x,

(4.36)

n=1

Imposing the boundary conditions (4.28) gives

u(0, t) = 2x x2 =

cn sin kn x,

(4.37)

n=1

It is important to know that the cn s are not given by the formula


Z
2 2
cn =
(2x x2 )sink n x, dx
2 0
as usual. The reason for this is that the k n s are not equally spaced. So
it is necessary to examine (4.37) on its own. Multiplying by sin k m x and
integrating over [0,2] gives
Z

2
0

(2x x ) sin k m x dx =

cn

n=1

2
0

sin k m x sin k n x dx,

For n 6= m, we have
Z 2
k m sin 2k n cos 2k m k n sin 2k m cos 2k n
sin k m x sin k n x dx =
k2n k2m
0

(4.38)

and imposing (4.33) for each of k m and k n shows (4.38) to be identically


satisfied. Therefore, we obtain the following when n = m
Z 2
Z 2
2
(2x x ) sin k n x dx = cn
sin2 k n x dx,
0

or

R2
cn =

(2x x2 ) sin k n x dx
R2
2
0 sin k n x dx,

Table 2 gives the first ten cn s that correspond to each k n .


n
1
2
3
4
5

cn
0.873214
0.341898
-.078839
0.071427
-.032299

n
6
7
8
9
10

cn
0.028777
-.016803
0.015310
-.010202
0.009458

Table 2. The coefficients cn from (4.77).

(4.39)

10

Chapter 5. Separation of Variables

Having obtain k n and cn , the solution to the problem is found in (4.36).


Figure 4 show plots at time t = 0, 1, and 2 when 20 terms are used.

y
1.0

t =

t =

t =

0.5

0.0

x
0

Figure 4. The solution (4.36).

4.1.1 Nonhomogeneous boundary conditions


In the preceding examples, the boundary conditions where either fixed
to zero, insulted or radiating. Often, we encounter boundary condition
which are non standard or nonhomogeneous. For example, the boundary
may be fixed to particular constant or the flux is maintained at a constant
value. The following examples illustrate.
Example 4
Solve
ut = u xx , 0 < x < 3,

t>0

(4.40)

subject to
u(x, 0) = 4x x2 u(0, t) = 0, u(3, t) = 3.

(4.41)

If we seek separable solutions u(x, t) = X(x)T(t), then from (4.41) we have


X(0)T(t) = 0,

X(3)T(t) = 3,

(4.42)

and we have a problem the second boundary condition doesnt separate.


To over come this we introduce the transformation u = v + ax + b and ask,

4.1. The heat equation

11

Can we choose the constants a and b as to fix both boundary conditions


to zero. Upon substitution of both boundary conditions (4.41), we obtain
0 = v(0, t) + a(0) + b, 3 = v(3, t) + 3a + b

(4.43)

Now we require that v(0, t) = 0 and v(3, t) = 0 which implies that we


must choose a = 1 and b = 0. Therefore, we have
u = v + x.

(4.44)

We notice that under the transformation (4.44), the original equation doesnt
change form, i.e.
ut = u xx

vt = v xx

however, the initial condition does change, it becomes


v(x, 0) = 3x x2 .
Thus, we have the new problem to solve
vt = v xx , 0 < x < 3,

t>0

(4.45)

subject to
v(x, 0) = 3x x2 v(0, t) = 0, v(3, t) = 3.

(4.46)

At this point, we seek the usual separable solutions V(x, t) = X(x)T(t)


which lead to the and the systems X 00 = k2 X and T 0 = k2 T with the
boundary conditions X(0) = 0 and X(3) = 0. Solving for X gives
X(x) = c1 sin kx + c2 cos kx,

(4.47)

and imposing both boundary conditions gives


X(x) = c1 sin

n
x,
3

and
T(t) = c3 e

n2 2
9 t

(4.48)

12

Chapter 5. Separation of Variables

where n is an integer. Therefore, we have the solution of (4.45) as

v(x, t) =

bn e

n2 2
9 t

sin

n=1

n
x.
3

Recognizing that we have a Fourier sine series, we obtain the coefficients


bn as

bn

Z
2 3
n
=
(3x x2 ) sin
x dx
3 0
3

3
6(2x 3)
n
3(n2 2 x2 3n2 2 x 18)
n
=

sin
x+
cos
x
3
3
n2 2
n3 3
0
n
32(1 (1) )
=
.
n3 3

This gives
v(x, t) =

32
3

(1 (1)n ) n2 2 t
n
9
e
sin
x.

3
3
n
n=1

and since u = v + x, we obtain the solution for u as


u(x, t) = x +

32
3

n
(1 (1)n ) n2 2 t
e 9 sin
x.

3
3
n
n=1

(4.49)

t =

t =

t =

0
0

Figure 5. The solution (4.49) at time t = 0, 1 and 2.

Example 5
Solve
ut = u xx , 0 < x < 1,

t>0

(4.50)

subject to
u(x, 0) = 0 u x (0, t) = 1, u x (1, t) = 0.

(4.51)

4.1. The heat equation

13

Unfortunately, the trick u = v + ax + b wont work since u x = v x + a and


choosing a to fix the right boundary to zero only makes the left boundary
nonzero. To overcome this we might try u = v + ax2 + bx but the original
equation changes
ut = u xx , vt = v xx + 2a

(4.52)

As a second attempt, we try


u = v + a(x2 + 2t) + bx

(4.53)

ut = u xx , vt = v xx .

(4.54)

noting now

Since u x = v x + 2ax + b, then choosing a = 1/2 and b = 1 gives the


the new boundary conditions as v x (0, t) = 0 and v x (2, t) = 0 and the
transformation becomes
1
u = v + (x2 + 2t) x,
2

(4.55)

Finally, we consider the initial condition. From (4.55), we have v(x, 0) =


u(x, 0) 21 x2 + x = x

x2
2

and our problem is transformed to the new

problem
vt = v xx , 0 < x < 1, t > 0

(4.56)

subject to

1
v(x, 0) = x x2 , v x (0, t) = v x (1, t) = 0
(4.57)
2
A separation of variables v = XT leads to X 00 = k2 X and T 0 = k2 T
from which we obtain
X = c1 sin kx + c2 cos kx,

X = c1 k cos kx c2 k sin kx,

(4.58)

and imposing the boundary conditions (4.57) gives


c1 = 0,

k = n,

(4.59)

where n is an integer. This then leads to


X(x) = c2 cos nx

(4.60)

14

Chapter 5. Separation of Variables

and further
T(t) = c3 en

2 2 t

(4.61)

Finally we arrive at
v(x, t) =

2 2
a0
+ an en t cos nx.
2
n=1

noting that we have chosen an = c1 c3 . Upon substitution of t = 0 and


using the initial condition (4.57), we have

1 2
a0
x x =
+ an cos nx.
2
2
n=1

a Fourier cosine series. The coefficients are obtained by


a0
an

2
=
1

Z
Z

1 2
1
2
x x , dx = x2 x3 = ,
2
3 0 3

1
2 1
(x x2 ) cos nx dx
=
1 0
2

(2x x2 )
2
2(x 1)

cos
nx

+
sin
nx
=

n
n2 2
n3 3
0
2
= 2 2.
n

Thus, we obtain the solution for v as


v(x, t) =

1
2
2
3

1 n2 2 t
e
cos nx.
n2
n=1

and this, together with the transformation (4.55) gives


1
1
2
u(x, t) = (x2 + 2t) x + 2
2
3

1 n2 2 t
e
cos nx.
n2
n=1

(4.62)

Figure 6 shows plots at time t = 0.01, 0.5, 1.0 and 1.5. It is interesting to
note that at the left boundary u x = 1 and since the flux = ku x implies
that = k > 0 which gives that the flux is position and that heat is being
added at the left boundary. Hence the profile increase at the left while
insulated at the right boundary (no flux).

4.1. The heat equation

15

t = 1.5
1
t = 1.0

t = 0.5
t = 0.1

x
0.0

0.5

1.0

Figure 6. The solution (4.62) at time t = 0, 1 and 2.

A natural question is, can we transform


ut = u xx , 0 < x < L, t > 0,

(4.63)

u(x, 0) = f (x), u(0, t) = p(t), u(L, t) = q(t)

(4.64)

to a problem with standard boundary conditions. The answer is yes. We


seek a transformation of the form
u = v + A(t)x + B(t)

(4.65)

as to transform the nonstandard boundary conditions to standard ones.


On substitution of the u and v boundary conditions, we obtain
p(t) = 0 + A(t)0 + B(t), q(t) = 0 + A(t)L + B(t)

(4.66)

and solving for A(t) and B(t) gives


q(t) p(t)
, B(t) = p(t),
(4.67)
L
which results in the transformation
q(t) p(t)
u = v+
x + p(t)
L
x
(L x)
= v + q(t) + p(t)
.
(4.68)
L
L
However in doing so, we change not only the original equation but also
A(t) =

the initial condition. They becomes, respectively


x
(L x)
+ p0 (t)
,
L
L
x
(L x)
v(x, 0) = f (x) q(0) p(0)
.
L
L
vt = v xx q0 (t)

16

Chapter 5. Separation of Variables

The new initial condition doesnt pose a problem but how do we solve the
heat equation with a term added to the equation.

4.1.2 Nonhomogeneous equations


We now focus our attention to solving the heat equation with a source
term
ut = u xx + Q(x),
u(0, t) = 0,

0 < x < L,

u(L, t) = 0,

t > 0,

(4.69)

u(x, 0) = f (x).

To investigate this problem, we will considered a particular example where


L = 2, f (x) = 2x x2 and Q(x) = 1 |x 1|. If we were to consider this
problem without a source term we would have solutions of the form

u(x, t) =

Tn (t) sin

n=1

where
Tn (t) =

nx
,
2

16(1 (1)n ) n2 2 t
e 4
n3 3

(4.70)

(4.71)

We note that even if this Tn wasnt known, we could find it as substitution


of (4.70) into the heat equation and isolating coefficients of sin nx
2 , would
lead to
Tn0 (t) =

n2 2
Tn (t),
4

leading to the solution (4.71). For the problem with a source term we look
for solutions of the same form i.e. (4.70). However, in order that this technique works, it is necessary to expand the source term also in terms of a
Fourier sine series, i.e.

Q(x) =

n=1

For

(
Q(x) =

nx
.
2

(4.72)

if 0 < x < 1,
if 1 < x < 2,

(4.73)

qn sin

x
2x

4.1. The heat equation

17

where
Z

qn =
=
=
+
=

nx
dx.
2
0
Z 1
Z 2
nx
nx
x sin
dx +
(2 x) sin
dx,
2
2
0
x

4
nx
nx 1
sin
2xn cos
2
2 0
n2 2

4
nx 2x4
nx 2
2 2 sin
,
+
cos
2
n
2 1
n
8
nx
sin
.
2
n2 2
Q(x) sin

(4.74)

Substituting both (4.70) and (4.72) into (4.69) gives

Tn0 (t) sin

n=1

nx 2

nx
nx
nx
Tn (t) sin
=
+ qn sin
,
2
2
2
2
n=1
n=1

and re-grouping and isolating the coefficients of sin nx


2 gives
Tn0 (t) +

n2 2
Tn (t) = qn ,
4

(4.75)

a linear ODE in Tn (t)! On solving (4.75) we obtain


Tn (t) =

qn
n2 2

+ bn e(

n 2
2 ) t

giving the final solution

u(x, t) =

n=1

4
nx
)2 t
( n
2
sin
.
q n + bn e
2
2
2
n

Imposing the initial condition gives (4.70)


4
nx
2
2x x =
qn + bn sin
.
2
2
2
n
n=1
If we set
cn =
then we have
2

qn
n2 2

2x x =

+ bn ,

cn sin

n=1

nx
.
2

(4.76)

18

Chapter 5. Separation of Variables

a regular Fourier sine series. Therefore


Z

nx
2x x2 sin
dx.
2
0
16
n
1

cos
=
,
2
n3 3

cn =

which in turn, gives


bn = c n

(4.77)

qn ,
n2 2

and finally, the solution as


2t
4
4
nx
( n
)
qn + cn 2 2 qn e 2
u(x, t) =
sin
,
2
2
2
n
n
n=1

(4.78)

where qn and cn are given in (4.74) and (4.77), respectively. Typical plots
are given in figure 7 at times t = 0, 1, 2 and 3.
1.0

y
t =

t =

t =

t =

0.5

0.0

x
0

Figure 7. The solution (4.78) at time t = 0, 1, 2 and 3.

It is interesting to note that if we let t the solution approaches the


same curve at t = 3. This is what is called steady state (no changes in
time). It is natural to ask Can we find this steady state solution.? The
answer is yes. For the steady state, ut 0 as t and the original PDE
becomes
u xx + Q(x) = 0.
Integrating twice with Q(x) given in (4.73) gives
( 3
x + c1 x + c2
if 0 < x < 1,
u = x3 6 2
6 x + k 1 x + k 2 if 1 < x < 2,

(4.79)

(4.80)

4.1. The heat equation

19

where c1 , c2 , k1 and k2 are constants of integration. Imposing that the solution and its first derivative are continuous at x = 1 and that the solution is
zer0 at the endpoints gives
c1 c1 + 1 = 0, c1 + c2 k1 k2 +
c2 = 0, 2k1 + k2

2
= 0,
3

8
= 0,
3

which gives, upon solving


1
3
1
c1 = , c2 = 0, k1 = , k2 =
2
2
3
This, in turn gives the steady state solution as
( 3
x6 + 2x
if 0 < x < 1,
u = x3
3x
1
2
6 x + 2 3 if 1 < x < 2.

(4.81)

(4.82)

4.1.3 Equations with a solution dependent source term


We now consider the heat equation with a solution dependent source term.
For simplicity we will consider a source term that is linear. Take, for example
ut = u xx + u, 0 < x < 1, t > 0,
u(0, t) = 0,

u(1, t) = 0,

u(x, 0) = x x2 ,

(4.83)

where is some constant. We could try a separation of variables to obtain solutions for this problem, but for more complicated source terms like
Q(x, t)u, a separation of variables is unsuccessful. Therefore, we try a different technique. Here we will try and transform the PDE to one that has
no source term. In attempting to do so, we seek a transformation of the
form
u(x, t) = A(x, t)v

(4.84)

and ask Is is possible to find A such that the source term in (4.83) can be
removed? Substituting of (4.84) in (4.83) gives
Avt + At v = Av xx + 2A x v x + A xx v + Av,

20

Chapter 5. Separation of Variables

and dividing by A and expanding and regrouping gives

Ax
A xx
At
vt = v xx + 2 v x +

+ v.
A
A
A
In order to target the standard heat equation, we choose
A x = 0,

A xx
At

+ = 0.
A
A

(4.85)

From the first we obtain that A = A(t) and from the second we obtain
A0 = A which has the solution A(t) = A0 et for some constant A0 . The
boundary conditions becomes
u(0, t) = 0 A0 et v(0, t) = 0 v(0, t) = 0,
v(1, t) = 0 A0 et v(1, t) = 0 v(1, t) = 0,
so the boundary conditions become unchanged. Next, we consider the
initial condition, so
u(x, 0) = x x2 A0 e0 v(x, 0) = 0 A0 v(x, 0) = x x2 ,
and as to leave the initial condition unchanged, we choose A0 = 1. Thus,
under the transformation
u = et v

(4.86)

the problem (4.83) becomes


vt = v xx , 0 < x < 1, t > 0,
v(x, 0) = 0,

v(1, t) = 0,

v(x, 0) = x x2 ,

(4.87)

This particular problem was considered at the beginning of this chapter,


(4.1) where the solution was given in (4.26), namely
v(x, t) =

4
3

1 (1)n n2 2 t
sin nx,
n3 e
n=1

and so, from (4.86) we obtain the solution of (4.83) as


4 t 1 (1)n n2 2 t
u(x, t) = 3 e
e
sin nx.

n3
n=1

(4.88)

4.1. The heat equation

21

Figure 8 shows plots at times t = 0, 0.1 and 0.2 when = 5 and 12. It
is interesting to note that in the case where = 5, the diffusion is slower
in comparison with no source term (i.e = 0 see Figure 1) and there is no
diffusion at all when = 12.
t = 0.2
0.4

0.3

t= 0
t = 0.1
t= 0

0.2
t = 0.1
0.2
t = 0.2
0.1

0.0

x
0.0

0.5

1.0

0.0

x
0.0

0.5

1.0

Figure 8. The solution (4.88) of the heat equation with a source (4.83) with = 5
and = 12.

It is natural to ask, for what value of do we achieve a steady state


solution. To answer this consider the first few terms of the solution (4.88)

8 t 2 t
1 92 t
u = 3e
e
sin x + e
sin 3x + . . . .
(4.89)
27

Now clearly the exponential terms in () will decay to zero with the first
term decaying the slowest. Therefore, it is the balance between et and
2

e t which determine whether the solution will decay to zero or not. It is


equality = 2 that gives the steady state solution.
Example 6
Solve
ut = u xx + u, 0 < x < 2,

t>0

u(x, 0) = 4x x3 u x (0, t) = 0, u x (2, t) = 0.

(4.90)

Established already is that the transformation (4.86) will transform the


equation to the heat equation and will leave the initial condition unchanged.

22

Chapter 5. Separation of Variables

It is now necessary to determine what happens to the boundary conditions. Using (4.86) we have
u x (0, t) = 0 A0 et v x (0, t) = 0 v x (0, t) = 0,

(4.91)

v x (2, t) = 0 A0 et v x (2, t) = 0 v x (2, t) = 0,

(4.92)

and so the insulted boundary conditions also remain insulated! Thus, the
problem (4.90) becomes
vt = v xx , 0 < x < 2, t > 0
v(x, 0) = 4x x2 ,

v x (0, t) = 0,

v x (2, t) = 0.

(4.93)

Using a separation of variables and imposing the boundary conditions


gives (see example 1)
v=

n2 2
n
1
a0 + an e 4 t cos
x,
2
2
n=1

(4.94)

where
a0

2
=
2

Z
Z

2
0

2
x4
= 4,
(4x x ) dx = 2x
4 0
3

2 2
n
(4x x3 ) cos
x dx
(4.95)
2 0
2

2
2(4x x3 )
48
n
4(4 3x2 )
96
n
=
+ 3 3 sin
x+
+ 4 4 cos
x
n
2
2
n
n2 2
n
0

6
4
16
96
48
n
96
n
= 2 2 4 4+
+ 3 3 sin
+
+ 4 4 cos
.
2
2
n n
2
2
n
n
n
n

an =

Together with the transformation (4.86), the solution of (4.90) is


u = 2et + et

an e

n=1

n2 2
4 t

cos

n
x,
2

(4.96)

where an is given in (4.95). Figure 9 show plots at t = 0, 0.2, 0.4 and 0.6
when = 2 and 2. It is interesting to note that the sign of will determine whether the solution will grow or decay exponentially.

4.1. The heat equation


y

23

t= 0

8
t = 0.6
6

2
t = 0.4

t = 0.2

4
t = 0.2

t = 0.4
t = 0.6

2
t= 0

x
0

x
0

Figure 9. The solution (4.96) of the heat equation with a source (4.90) with no
flux boundary condition with = 2 and = 2.

4.1.4 Equations with a solution dependent convective term


We now consider the heat equation with a solution dependent linear convection term, i.e.
ut = u xx + u x , 0 < x < 1, t > 0
u(0, t) = 0,

u(1, t) = 0,

u(x, 0) = x x2 ,

(4.97)

where is some constant. We consider the same initial and boundary


conditions as in the previous section as it provides a means of comparing
the two respective problems. Again, we could try a separation of variables
to obtain solutions for this problem, but for more complicated convection
terms like P(x, t)u x , a separation of variable is unsuccessful. Therefore,
we again try a different technique. We will try and transform the PDE
to one that has no convection term. In attempting to do so, we seek a
transformation of the form
u(x, t) = A(x, t)v

(4.98)

and ask Is is possible to find A such that the convection term can be removed? Substituting of (4.98) in (4.97) gives
Avt + At v = Av xx + 2A x v x + A xx v + (Av x + A x v) ,

24

Chapter 5. Separation of Variables

and dividing by A and expanding and regrouping gives


vt = v xx +

2A x + A
A xx At + A x
vx +
v.
A
A

(4.99)

In order to target the standard heat equation, we choose


2A x + A = 0,

A xx At + A x = 0.

(4.100)

From the first we obtain that A(x, t) = C(t)e 2 x and from the second
we obtain C 0 +

2
4 C

1 2

= 0 which has the solution C(t) = A0 e 4 t for some

constant A0 . This then gives


1 2
t

A(x, t) = A0 e 2 x 4

(4.101)

The boundary conditions becomes


1 2

u(0, t) = 0 C0 e 4 t v(0, t) = 0 v(0, t) = 0,


v(1, t) = 0 C0 e

21 14 2 t

v(1, t) = 0 v(1, t) = 0,

(4.102)
(4.103)

so the boundary conditions become unchanged. Next, we consider the


initial condition, so
1

u(x, 0) = x x2 v(x, 0) = (x x2 )e 2 x ,

(4.104)

where we have chosen A0 = 1. So here, the initial condition actually


changes. Thus, under the transformation
1

1 2

u = e 2 x 4 t v,

(4.105)

the problem (4.97) becomes


vt = v xx , 0 < x < 1,
v(x, 0) = 0,

v(1, t) = 0,

t > 0,
1

v(x, 0) = (x x2 )e 2 x .

(4.106)

As in the previous section, the solution is given by

v(x, t) =

bn en t sin nx,

n=1

(4.107)

4.1. The heat equation

25

where bn is now given by


2
bn =
1

(x x2 )e 2 x sin nx dx,

(4.108)

and from (4.105)


1

1 2
t

u(x, t) = e 2 x 4

bn en t sin nx,

(4.109)

n=1

At this point we consider two particular examples: = 6 and = 12.


For = 6
Z
bn = 2

(x x2 )e3x sin nx dx

= 4n

27 + n2 2 + 2n2 2 e3 cos n
.
(9 + n2 2 )3

(4.110)

For = 12
Z
bn = 2

(x x2 )e6x sin nx dx

= 2n

7n2 2 + 108 + (5n2 2 + 324)e6 cos n


.
(36 + n2 2 )3

(4.111)

The respective solutions for each are


1

1 2

u(x, t) = 4e 2 x 4 t
(4.112)

2
2
2
2
3
27 + n + 2n e cos n n2 2 t
n
e
sin nx,
(9 + n2 2 )3
n=1

1 2

u(x, t) = 2e 2 x 4 t
(4.113)

2
2
2
2
6
7n + 108 + (5n + 324)e cos n n2 2 t
n
e
sin nx.
2 2 )3
(36
+
n
n=1
Figure 10 shows graphs at a variety of times for = 6 and = 12.

26

Chapter 5. Separation of Variables

0.3

0.3

t= 0

t= 0

0.2

t = 0.025

0.2
t = 0.05

t = 0.05
0.1

0.1

t = 0.1

0.0

0.0

x
0.0

0.5

1.0

x
0.0

0.5

1.0

Figure 10. The solution (4.112) of the heat equation with convection with fixed
boundary conditions with = 6 and = 12.

Example 7
As a final example, we consider
ut = u xx + u x ,

0 < x < 2,

t>0

(4.114)

subject to
u(x, 0) = 4x x3 u x (0, t) = 0, u x (2, t) = 0.

(4.115)

This problem is like problem 6 but with insulated boundary conditions.


Here, we will simply transform the problem to one that is in standard form
as to contrast the differences between the two problems. The transformation (4.105) transforms (4.114) to the heat equation so we will primarily focus on the boundary and initial conditions. For the boundary conditions,
upon differentiating (4.105) with respect to x gives
1

1 2

u x = e 2 x 4 t v x

1 x 1 2 t
4
e 2
v,
2

(4.116)

and so

v(0, t) = 0,
2

u x (2, t) = 0 v x (2, t) v(2, t) = 0.


2

u x (0, t) = 0 v x (0, t)

(4.117)
(4.118)

4.2. Laplaces equation

27

Thus, the insulated boundary condition become radiating boundary conditions. As for the initial condition
1

u(x, 0) = 4x x3 v(x, 0) = (4x x3 )e 2 x ,

(4.119)

so again, the initial condition changes.

4.2

Laplaces equation

The two dimensional Laplaces equation is


u xx + uyy = 0

(4.120)

We will show that a separation of variables also works for this equation
As an example consider the boundary conditions
u(x, 0) = 0, u(x, 1) = x x2

(4.121a)

u(0, y) = 0, u(1, 0) = 0.

(4.121b)

If we assume separable solutions of the form


u(x, y) = X(x)Y(y),

(4.122)

then substituting this into (4.120) gives


X 00 Y + XY 00 = 0.

(4.123)

Dividing by XY and expanding gives


X 00 Y 00
+
= 0,
X
Y

(4.124)

and since each term is only a function of x or y, then each must be constant
giving

X 00
Y 00
= ,
= .
(4.125)
X
Y
From the first of (4.121a) and both of (4.121b) we deduce the boundary
conditions
X(0) = 0,

X(1) = 0, Y(0) = 0.

(4.126)

28

Chapter 5. Separation of Variables

The remaining boundary condition in (4.121a) will be used later. As seen


the in previous section, in order to solve the X equation in (4.125) subject
to the boundary conditions (4.126), it is necessary to set = k2 . The X
equation (4.125) as the general solution
X = c1 sin kx + c2 cos kx

(4.127)

To satisfy the boundary conditions in (4.126) it is necessary to have c2 = 0


and k = n, k Z+ so
X(x) = c1 sin nx.

(4.128)

From (4.125), we obtain the solution to the Y equation


Y(y) = c3 sinh ny + c4 cosh ny

(4.129)

Since Y(0) = 0 this implies c4 = 0 so


X(x)Y(y) = an sin nx sinh ny

(4.130)

where we have chosen an = c1 c3 . Therefore, we obtain the solution to


(4.120) subject to three of the four boundary conditions in (4.121)

u=

an sin nx sinh ny.

(4.131)

n=1

The remaining boundary condition is (4.121a) now needs to be satisfied,


thus
2

u(x, 1) = x x =

an sin nx sinh n.

(4.132)

n=1

This looks like a Fourier sine series and if we let An = an sinh n, this
becomes

An sin nx = x x2.

(4.133)

n=1

which is precisely a Fourier sine series. The coefficients An are given by


Z

2 2
x x2 sin nx dx
An =
1 0
16
= 3 3 (1 cos n),
(4.134)
n

4.2. Laplaces equation

29

and since An = an sinh n, this gives


an =

4(1 (1)n )
.
n3 3 sinh n

(4.135)

Thus, the solution to Laplaces equation with the boundary conditions


given in (4.121) is
4
u(x, y) = 3

1 (1)n
sinh ny
sin nx
.
3
sinh n
n
n=1

(4.136)

Figure 11 show both a top view and a 3 D view of the solution.

y
1.0

0.2
u = 0.2

u = 0.1

0.1

0.5
u = 0.05

0.0

u = 0.025

0.5

u = 0.001
0.0

x
0.0

0.5

1.0

1.0

1.0

Figure 11. The solution (4.120) with the boundary conditions (4.121)

In general, using separation of variables, the solution of


u xx + uyy = 0,

0 < x < L x , 0 < y < Ly ,

(4.137)

subject to
u(x, 0) = 0, u(x, 1) = f (x),
u(0, y) = 0, u(1, y) = 0,
is

ny

nx sinh Ly
u = bn sin
,
L x sinh n
Ly
n=1

(4.139)

30

Chapter 5. Separation of Variables

where
2
bn =
Lx

Lx

f (x) sin

nx
dx.
Lx

(4.140)

In the next three examples, we will construct solutions of Laplaces equation when we have nonzero boundary condition on each of the remaining
three sides of the region 0 < 1, 0 < y < 1.
Example 8
Solve
u xx + uyy = 0,

(4.141)

subject to
u(x, 0) = 0, u(x, 1) = 0,

(4.142a)

u(0, y) = 0, u(1, y) = y y2 .

(4.142b)

Assume separable solutions of the form


u(x, y) = X(x)Y(y)

(4.143)

Then substituting this into (4.141) gives


X 00 Y + XY 00 = 0.

(4.144)

Dividing by XY and expanding gives


X 00 Y 00
+
= 0,
X
Y

(4.145)

from which we obtain


X 00
= ,
X

Y 00
=
Y

(4.146)

From (4.186) we deduce the boundary conditions


X(0) = 0, Y(0) = 0, Y(1) = 0.

(4.147)

4.2. Laplaces equation

31

The remaining boundary condition in (4.186) will be used later. As seen


the in previous problem, in order to solve the Y equation in (4.146) subject
to the boundary conditions (4.147), it is necessary to set = k2 . The Y
equation (4.146) as the general solution
Y = c1 sin ky + c2 cos ky

(4.148)

To satisfy the boundary conditions in (4.147) it is necessary to have c2 = 0


and k = n so
Y(y) = c1 sin ny.

(4.149)

From (4.146), we obtain the solution to the X equation


X(x) = c3 sinh nx + c4 cosh nx

(4.150)

Since X(0) = 0 this implies c4 = 0. This gives


X(x)Y(y) = an sinh nx sin ny

(4.151)

where we have chosen an = c1 c3 . Therefore, we obtain

u=

an sinh nx sin ny.

(4.152)

n=1

The remaining boundary condition is (4.186) now needs to be satisfied,


thus
u(1, y) = y y2 =

an sinh n sin ny.

(4.153)

n=1

If we let An = an sinh n, this becomes

An sin ny = y y2.

(4.154)

n=1

Comparing with previous problem, we find that interchanging x and y


interchanges the two problems and thus we con conclude that
An =

16
(1 cos n),
n3 3

(4.155)

32

Chapter 5. Separation of Variables

and further that the solution to Laplaces equation with the boundary conditions given in (4.141) subject to (4.186) is
4
u= 3

1 (1)n sinh nx
sin ny.
n3
sinh n
n=1

(4.156)

Figure 12 show both a top view and a 3 D view of the solution. In comparing the solutions (4.136) and (4.156) shows that if we interchange x and
y they are the same. This should not be surprising because if we consider Laplace equations with the boundary conditions given in (4.121) and
(4.186), that if we interchange x and y, the problems are transformed to
each other.
In general, using separation of variables, the solution of
u xx + uyy = 0, 0 < x < L x ,

0 < y < Ly

(4.157)

subject to
u(x, 0) = 0, u(x, 1) = 0
u(0, y) = 0, u(1, y) = g(y).
is

sinh nx
Lx

u=

bn sinh n
Lx

n=1

where

2
bn =
Ly

sin

Ly

g(y) sin

ny
Ly

ny
dy
Ly

(4.159)

(4.160)

Example 9
Solve
u xx + uyy = 0

(4.161)

u(x, 0) = x x2 , u(x, 1) = 0

(4.162a)

u(0, y) = 0, u(1, y) = 0.

(4.162b)

subject to

4.2. Laplaces equation

33

Again, assuming separable solutions of the form


u(x, y) = X(x)Y(y)

(4.163)

X 00 Y + XY 00 = 0,

(4.164)

leads to

when substituted into (4.161). Dividing by XY and expanding gives


X 00 Y 00
+
= 0.
X
Y

(4.165)

Since each term is only a function of x or y then each must be constant


giving

X 00
Y 00
= ,
=
(4.166)
X
Y
From the first of (4.162a) and both of (4.162b) we deduce the boundary
conditions
X(0) = 0,

X(1) = 0, Y(1) = 0,

(4.167)

noting that the last boundary condition is different than the boundary condition considered at the beginning of this section (i.e. Y(0) = 0). The remaining boundary condition in (4.162a) will be used later. In order to solve
the X equation in (4.166) subject to the boundary conditions (4.167), it is
necessary to set = k2 . The X equation (4.166) as the general solution
Y = c1 sin kx + c2 cos kx

(4.168)

To satisfy the boundary conditions in (4.167) it is necessary to have c2 = 0


and k = n so
X(x) = c1 sin nx.

(4.169)

From (4.166), we obtain the solution to the Y equation


Y(y) = c3 sinh ny + c4 cosh ny

(4.170)

Since Y(1) = 0 this implies


c3 sinh n + c4 cosh n = 0

c4 = c2

sinh n
.
cosh n

(4.171)

34

Chapter 5. Separation of Variables

From (4.172) we have


Y(y) = c3 sinh ny c3 cosh ny

sinh n
cosh n

sinh n(1 y)
.
sinh n

(4.172)

X(x)Y(y) = an sin nx sinh n(1 y)

(4.173)

= c3
so

where we have chosen an = c1 c3 / sinh n. Therefore, we obtain

u=

an sin nx sinh n(1 y).

(4.174)

n=1

The remaining boundary condition is (4.162a) now needs to be satisfied,


thus
u(x, 0) = x x2 =

an sin nx sinh n.

(4.175)

n=1

At this point we recognize that this problem is now identically to the first
problem in this section where we obtained
an =

4(1 (1)n )
n3 3 sinh n

(4.176)

so the solution to Laplaces equation with the boundary conditions given


in (4.179) is
u(x, y) =

4
3

1 (1)n
sinh n(1 y)
n3 sin nx sinh n .
n=1

(4.177)

Figure 12 show both a top view and a 3 D view of the solution.


In general, using separation of variables, the solution of
u xx + uyy = 0, 0 < x < L x ,

0 < y < Ly

subject to
u(x, 0) = f (x), u(x, 1) = 0
u(0, y) = 0, u(1, y) = 0.

(4.178)

4.2. Laplaces equation


is

n(1y)

nx sinh Ly
u = bn sin
Lx
sinh n
Ly
n=1

where

2
bn =
Lx

35

Lx

f (x) sin

nx
dx
Lx

(4.180)

(4.181)

Example 10
As the final example, we consider
u xx + uyy = 0

(4.182)

subject to
u(x, 0) = 0, u(x, 1) = 0

(4.183a)

u(0, y) = y y2 , u(1, y) = 0.

(4.183b)

We could go through a separation of variables to obtain the solution but


we can avoid many of the steps by considering the previous three problems. One will notice to transform between the first and second problem,
the variables x and y only need to be interchanged. This can also be seen in
their respective solutions. One will also notice to transform between this
problem and problem 9, we only need to transform x and y again. Thus,
to obtain the solution for this final problem, we will transform the solution
given in (4.177) giving
u(x, y) =

4
3

1 (1)n sinh n(1 x)


sin ny.
sinh n
n3
n=1

(4.184)

In general, using separation of variables, the solution of


u xx + uyy = 0, 0 < x < L x ,

0 < y < Ly

subject to
u(x, 0) = 0, u(x, 1) = 0
u(0, y) = g(y), u(1, y) = 0.

(4.185)

36

Chapter 5. Separation of Variables

is

u=

bn

sinh n(1x)
Ly
sinh

n=1

where

2
bn =
Ly

Ly
0

n
Ly

g(y) sin

sin

ny
.
Ly

ny
dy
Ly

(4.187)

(4.188)

You might also like