DIFFYQS PDEs, Separation of Variables, and The Heat Equation

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

10/11/2019 DIFFYQS PDEs, separation of variables, and the heat equation

Notes on Diffy Qs: Differential Equations for


Engineers
Jiří Lebl

4.6 PDEs, separation of variables, and the heat


equation

Note: 2 lectures, §9.5 in [EP] , §10.5 in [BD]

Let us recall that a partial di erential equation or PDE is an equation containing the partial
derivatives with respect to several independent variables. Solving PDEs will be our main
application of Fourier series.

A PDE is said to be linear if the dependent variable and its derivatives appear at most to
the rst power and in no functions. We will only talk about linear PDEs. Together with a
PDE, we usually specify some boundary conditions, where the value of the solution or its
derivatives is given along the boundary of a region, and/or some initial conditions where
the value of the solution or its derivatives is given for some initial time. Sometimes such
conditions are mixed together and we will refer to them simply as side conditions.

We will study three speci c partial di erential equations, each one representing a more
general class of equations. First, we will study the heat equation, which is an example of a
parabolic PDE. Next, we will study the wave equation, which is an example of a hyperbolic
PDE. Finally, we will study the Laplace equation, which is an example of an elliptic PDE. Each
of our examples will illustrate behavior that is typical for the whole class.

4.6.1 Heat on an insulated wire


Let us rst study the heat equation. Suppose that we have a wire (or a thin metal rod) of
length L that is insulated except at the endpoints. Let x denote the position along the wire
and let t denote time. See Figure 5.6.1.

Figure 5.6.1. Insulated wire.

Let u(x, t) denote the temperature at point x at time t. The equation governing this setup
is the so-called one-dimensional heat equation:
https://www.jirka.org/diffyqs/html/heateq_section.html 1/12
10/11/2019 DIFFYQS PDEs, separation of variables, and the heat equation

2
∂u ∂ u
   = k ,   
2
∂t ∂x

where k > 0 is a constant (the thermal conductivity of the material). That is, the change in
heat at a speci c point is proportional to the second derivative of the heat along the wire.
This makes sense; if at a xed t the graph of the heat distribution has a maximum (the
graph is concave down), then heat ows away from the maximum. And vice-versa.

We will generally use a more convenient notation for partial derivatives. We will write u t

instead of , and we will write u instead of . With this notation the heat equation
2
∂u ∂ u
xx 2
∂t ∂x

becomes

ut = kuxx .

For the heat equation, we must also have some boundary conditions. We assume that the
ends of the wire are either exposed and touching some body of constant heat, or the ends
are insulated. For example, if the ends of the wire are kept at temperature 0, then the
conditions are

u(0, t) = 0 and u(L, t) = 0.

If, on the other hand, the ends are also insulated, the conditions are

ux (0, t) = 0 and ux (L, t) = 0.

In other words, heat is not owing in nor out of the wire at the ends. We always have two
conditions along the x axis as there are two derivatives in the x direction. These side
conditions are said to be homogeneous (that is, u or a derivative of u is set to zero).

We also need an initial condition—the temperature distribution at time t = 0. That is,

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

for some known function f (x). This initial condition is not a homogeneous side condition.

4.6.2 Separation of variables


The heat equation is linear as u and its derivatives do not appear to any powers or in any
functions. Thus the principle of superposition still applies for the heat equation (without
side conditions). If u and u are solutions and c , c are constants, then u = c u + c u is
1 2 1 2 1 1 2 2

also a solution.

Exercise 4.6.1. Verify the principle of superposition for the heat equation.

Superposition also preserves some of the side conditions. In particular, if u and u are 1 2

solutions that satisfy u(0, t) = 0 and u(L, t) = 0, and c , c are constants, then 1 2

u = c u + c u is still a solution that satis es u(0, t) = 0 and u(L, t) = 0. Similarly for the
1 1 2 2

https://www.jirka.org/diffyqs/html/heateq_section.html 2/12
10/11/2019 DIFFYQS PDEs, separation of variables, and the heat equation

side conditions u (0, t) = 0 and


x
ux (L, t) = 0 . In general, superposition preserves all
homogeneous side conditions.

The method of separation of variables is to try to nd solutions that are sums or products
of functions of one variable. For example, for the heat equation, we try to nd solutions of
the form

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

That the desired solution we are looking for is of this form is too much to hope for. What is
perfectly reasonable to ask, however, is to nd enough “building-block” solutions of the
form u(x, t) = X(x)T (t) using this procedure so that the desired solution to the PDE is
somehow constructed from these building blocks by the use of superposition.

Let us try to solve the heat equation

ut = kuxx with u(0, t) = 0, u(L, t) = 0, and u(x, 0) = f (x).

Let us guess u(x, t) = X(x)T (t). We plug into the heat equation to obtain
′ ′′
X(x)T (t) = kX (x)T (t).

We rewrite as
′ ′′
T (t) X (x)
= .
kT (t) X(x)

This equation must hold for all x and all t. But the left hand side does not depend on x and
the right hand side does not depend on t. Hence, each side must be a constant. Let us call
this constant −λ (the minus sign is for convenience later). We obtain the two equations
′ ′′
T (t) X (x)
= −λ = .
kT (t) X(x)

In other words
′′
X (x) + λX(x) = 0,

T (t) + λkT (t) = 0.

The boundary condition u(0, t) = 0 implies X(0)T (t) = 0. We are looking for a nontrivial
solution and so we can assume that T (t) is not identically zero. Hence X(0) = 0. Similarly,
u(L, t) = 0 implies X(L) = 0. We are looking for nontrivial solutions X of the eigenvalue

problem X + λX = 0, X(0) = 0, X(L) = 0. We have previously found that the only


′′

eigenvalues are , for integers , where eigenfunctions are . Hence,


2 2
n π nπ
λn = 2
n ≥ 1 sin( x)
L L

let us pick the solutions

https://www.jirka.org/diffyqs/html/heateq_section.html 3/12
10/11/2019 DIFFYQS PDEs, separation of variables, and the heat equation

Xn (x) = sin( x).
L

The corresponding T must satisfy the equation


n

2 2
n π

Tn (t) + kTn (t) = 0.
2
L

By the method of integrating factor, the solution of this problem is


2 2
−n π
kt
L2
Tn (t) = e .

It will be useful to note that T n (0) = 1 . Our building-block solutions are

2 2
nπ −n π
kt
L2
un (x, t) = Xn (x)Tn (t) = sin( x) e .
L

We note that u n
(x, 0) = sin(

L
x) . Let us write f (x) as the sine series



f (x) = ∑ bn sin( x).
L
n=1

That is, we nd the Fourier series of the odd periodic extension of f (x). We used the sine
series as it corresponds to the eigenvalue problem for X(x) above. Finally, we use
superposition to write the solution as

∞ ∞ 2 2
nπ −n π
kt
  u(x, t) = ∑ bn un (x, t) = ∑ bn sin( x) e L2
.   
L
n=1 n=1

Why does this solution work? First note that it is a solution to the heat equation by
superposition. It satis es u(0, t) = 0 and u(L, t) = 0, because x = 0 or x = L makes all the
sines vanish. Finally, plugging in t = 0, we notice that T (0) = 1 and so n

∞ ∞

u(x, 0) = ∑ bn un (x, 0) = ∑ bn sin( x) = f (x).
L
n=1 n=1

Example 4.6.1. Suppose that we have an insulated wire of length 1, such that the ends
of the wire are embedded in ice (temperature 0). Let k = 0.003. Then suppose that initial
heat distribution is u(x, 0) = 50 x (1 − x). See Figure 5.6.4.

https://www.jirka.org/diffyqs/html/heateq_section.html 4/12
10/11/2019 DIFFYQS PDEs, separation of variables, and the heat equation

Figure 5.6.4. Initial distribution of temperature in the wire.

We want to nd the temperature function u(x, t). Let us suppose we also want to nd
when (at what t) does the maximum temperature in the wire drop to one half of the initial
maximum of 12.5.

We are solving the following PDE problem:

ut = 0.003 uxx ,

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

u(x, 0) = 50 x (1 − x) for  0 < x < 1.

We write f (x) = 50 x (1 − x) for 0 < x < 1 as a sine series. That is,


where

f (x) = ∑ bn sin(nπx),
n=1

if n even,
n
1
200 200 (−1) 0
bn = 2 ∫ 50 x (1 − x) sin(nπx) dx =   − = {
if n odd.
400
3 3 3 3
0
π n π n 3 3
π n

https://www.jirka.org/diffyqs/html/heateq_section.html 5/12
10/11/2019 DIFFYQS PDEs, separation of variables, and the heat equation

Figure 5.6.5. Plot of the temperature of the wire at position x at time t.

The solution u(x, t), plotted in Figure 5.6.5 for 0 ≤ t ≤ 100, is given by the series:

400 2 2
−n π 0.003 t
u(x, t) = ∑ sin(nπx) e .
3 3
π n
n=1
n  odd

Finally, let us answer the question about the maximum temperature. It is relatively easy
to see that the maximum temperature will always be at x = 0.5, in the middle of the wire.
The plot of u(x, t) con rms this intuition.

If we plug in x = 0.5 we get



400 −n π
2 2
0.003 t
u(0.5, t) = ∑ sin(nπ 0.5) e .
3 3
π n
n=1
n  odd

https://www.jirka.org/diffyqs/html/heateq_section.html 6/12
10/11/2019 DIFFYQS PDEs, separation of variables, and the heat equation

For n = 3 and higher (remember n is only odd), the terms of the series are insigni cant
compared to the rst term. The rst term in the series is already a very good
approximation of the function. Hence

400 −π
2
0.003 t
u(0.5, t) ≈ e .
3
π

The approximation gets better and better as t gets larger as the other terms decay much
faster. Let us plot the function u(0.5, t), the temperature at the midpoint of the wire at
time t, in Figure 5.6.6. The gure also plots the approximation by the rst term.

Figure 5.6.6. Temperature at the midpoint of the wire (the bottom curve), and the
approximation of this temperature by using only the rst term in the series (top curve).

After t = 5 or so it would be hard to tell the di erence between the rst term of the series
for u(x, t) and the real solution u(x, t). This behavior is a general feature of solving the
heat equation. If you are interested in behavior for large enough t, only the rst one or
two terms may be necessary.

Let us get back to the question of when is the maximum temperature one half of the
initial maximum temperature. That is, when is the temperature at the midpoint
/ = 6.25. We notice on the graph that if we use the approximation by the rst term we
12.5
2

will be close enough. We solve

400 −π
2
0.003 t
6.25 = e .
3
π

That is,
3
6.25 π
ln
400
t = ≈ 24.5.
2
−π 0.003

https://www.jirka.org/diffyqs/html/heateq_section.html 7/12
10/11/2019 DIFFYQS PDEs, separation of variables, and the heat equation

So the maximum temperature drops to half at about t = 24.5.

We mention an interesting behavior of the solution to the heat equation. The heat
equation “smoothes” out the function f (x) as t grows. For a xed t, the solution is a
2 2
−n π

Fourier series with coe cients b e . If t > 0, then these coe cients go to zero faster
kt
L2
n

than any for any power p. In other words, the Fourier series has in nitely many
n
1
p

derivatives everywhere. Thus even if the function f (x) has jumps and corners, then for a
xed t > 0, the solution u(x, t) as a function of x is as smooth as we want it to be.

4.6.3 Insulated ends


Now suppose the ends of the wire are insulated. In this case, we are solving the equation

ut = kuxx with ux (0, t) = 0, ux (L, t) = 0, and u(x, 0) = f (x).

Yet again we try a solution of the form u(x, t) = X(x)T (t). By the same procedure as
before we plug into the heat equation and arrive at the following two equations
′′
X (x) + λX(x) = 0,

T (t) + λkT (t) = 0.

At this point the story changes slightly. The boundary condition u (0, t) = 0 implies x

X (0)T (t) = 0. Hence X (0) = 0. Similarly, u (L, t) = 0 implies X (L) = 0. We are looking
′ ′ ′
x

for nontrivial solutions X of the eigenvalue problem X + λX = 0, X (0) = 0, X (L) = 0. ′′ ′ ′

We have previously found that the only eigenvalues are , for integers
2 2

,
n π
λn = 2
n ≥ 0
L

where eigenfunctions are cos( nπ

L
x) (we include the constant eigenfunction). Hence, let us
pick solutions

Xn (x) = cos( x) and X0 (x) = 1.
L

The corresponding T must satisfy the equation


n

2 2
n π

Tn (t) + kTn (t) = 0.
2
L

For n ≥ 1, as before,
2 2
−n π
kt
Tn (t) = e L2 .

For n = 0, we have T 0

(t) = 0 and hence T 0
(t) = 1 . Our building-block solutions will be

2 2
−n π
nπ kt
2
un (x, t) = Xn (x)Tn (t) = cos( x) e L ,
L

and

https://www.jirka.org/diffyqs/html/heateq_section.html 8/12
10/11/2019 DIFFYQS PDEs, separation of variables, and the heat equation

u0 (x, t) = 1.

We note that u n
(x, 0) = cos(

L
x) . Let us write f using the cosine series


a0 nπ
f (x) = + ∑ an cos( x).
2 L
n=1

That is, we nd the Fourier series of the even periodic extension of f (x).

We use superposition to write the solution as

∞ ∞ 2 2
a0 a0 nπ −n π
kt
  u(x, t) = + ∑ an un (x, t) = + ∑ an cos( x) e L2
.   
2 2 L
n=1 n=1

Example 4.6.2. Let us try the same equation as before, but for insulated ends. We are
solving the following PDE problem

ut = 0.003 uxx ,

ux (0, t) = ux (1, t) = 0,

u(x, 0) = 50 x (1 − x) for  0 < x < 1.

For this problem, we must nd the cosine series of u(x, 0). For 0 < x < 1 we have

25 −200
50 x (1 − x) = + ∑ ( ) cos(nπx).
2 2
3 π n
n=2
n  even

The calculation is left to the reader. Hence, the solution to the PDE problem, plotted in
Figure 5.6.8, is given by the series

25 −200 2 2
−n π 0.003 t
u(x, t) = + ∑ ( ) cos(nπx) e .
2 2
3 π n
n=2
n  even

https://www.jirka.org/diffyqs/html/heateq_section.html 9/12
10/11/2019 DIFFYQS PDEs, separation of variables, and the heat equation

Figure 5.6.8. Plot of the temperature of the insulated wire at position x at time t.

Note in the graph that the temperature evens out across the wire. Eventually, all the
terms except the constant die out, and you will be left with a uniform temperature of
≈ 8.33 along the entire length of the wire.
25

4.6.4 Exercises
Exercise 4.6.2. Imagine you have a wire of length 2, with and an initial k = 0.001

temperature distribution of u(x, 0) = 50x. Suppose that both the ends are embedded in
ice (temperature 0). Find the solution as a series.

Exercise 4.6.3. Find a series solution of

ut = uxx ,

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

u(x, 0) = 100 for  0 < x < 1.

https://www.jirka.org/diffyqs/html/heateq_section.html 10/12
10/11/2019 DIFFYQS PDEs, separation of variables, and the heat equation

Exercise 4.6.4. Find a series solution of

ut = uxx ,

ux (0, t) = ux (π, t) = 0,

u(x, 0) = 3 cos(x) + cos(3x) for  0 < x < π.

Exercise 4.6.5. Find a series solution of


1
ut = uxx ,
3

ux (0, t) = ux (π, t) = 0,

10x
u(x, 0) = for  0 < x < π.
π

Exercise 4.6.6. Find a series solution of

ut = uxx ,

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

u(x, 0) = sin(πx) for  0 < x < 1.

Hint: Use the fact that u(x, t) = 100x is a solution satisfying ut = uxx , u(0, t) = 0 ,
u(1, t) = 100. Then use superposition.

Exercise 4.6.7. Find the steady state temperature solution as a function of alone, by x

letting t → ∞ in the solution from exercises Exercise 4.6.5 and Exercise 4.6.6 . Verify that it
satis es the equation u = 0. xx

Exercise 4.6.8. Use separation variables to nd a nontrivial solution to uxx + uyy = 0 ,


where u(x, 0) = 0 and u(0, y) = 0. Hint: Try u(x, y) = X(x)Y (y).

Exercise 4.6.9. (challenging)   Suppose that one end of the wire is insulated (say at x = 0)
and the other end is kept at zero temperature. That is, nd a series solution of

ut = kuxx ,

ux (0, t) = u(L, t) = 0,

u(x, 0) = f (x) for  0 < x < L.

Express any coe cients in the series by integrals of f (x).

Exercise 4.6.10. (challenging)   Suppose that the wire is circular and insulated, so there
are no ends. You can think of this as simply connecting the two ends and making sure the
solution matches up at the ends. That is, nd a series solution of

https://www.jirka.org/diffyqs/html/heateq_section.html 11/12
10/11/2019 DIFFYQS PDEs, separation of variables, and the heat equation

ut = kuxx ,

u(0, t) = u(L, t), ux (0, t) = ux (L, t),

u(x, 0) = f (x) for  0 < x < L.

Express any coe cients in the series by integrals of f (x).

Exercise 4.6.101. Find a series solution of

ut = 3uxx ,

u(0, t) = u(π, t) = 0,

u(x, 0) = 5 sin(x) + 2 sin(5x) for  0 < x < π.

► Answer

Exercise 4.6.102. Find a series solution of


ut = 0.1uxx ,

ux (0, t) = ux (π, t) = 0,

u(x, 0) = 1 + 2 cos(x) for  0 < x < π.

► Answer

Exercise 4.6.103. Use separation of variables to nd a nontrivial solution to u xt


= uxx .
► Answer

Exercise 4.6.104. Use separation of variables (Hint: try u(x, t) = X(x) + T (t) ) to nd a
nontrivial solution to u x + ut = u .
► Answer

For a higher quality printout use the PDF version: https://www.jirka.org/diffyqs/diffyqs.pdf

https://www.jirka.org/diffyqs/html/heateq_section.html 12/12

You might also like