12 Fourier Method For The Heat Equation: 12.1 A Zoo of Examples
12 Fourier Method For The Heat Equation: 12.1 A Zoo of Examples
12 Fourier Method For The Heat Equation: 12.1 A Zoo of Examples
Now I am well prepared to work through some simple problems for a one dimensional heat equation
on a bounded interval.
u(t, x) = T (t)X(x).
1
and the boundary conditions yield
√ √
−λ
A + B = 0, Ae + Be− −λ
= 0,
or √
−λ
B(e2 − 1) = 0,
√
which implies that A = B = 0 since e2 −λ ̸= 1 for any real negative λ. Therefore again no nontrivial
solutions.
√
√ 1. Reconsider the case λ < 0 starting with the general solution X(x) = A sinh −λx +
Exercise
B cosh −λx.
Finally, assuming that λ > 0, I get
√ √
X(x) = A cos λx + B sin λx,
uk (t, x) = bk e−α
2 π 2 k2 t
sin πkx, k = 1, 2, . . .
solve equation (12.1) and satisfy the boundary conditions (12.2). The remaining part is to satisfy the
initial condition (12.3). For this I will use the superposition principle that says that if uk solve (12.1)
then any linear combination is also a solution, i.e.,
∞
∑ ∞
∑
bk e−α
2 π 2 k2 t
u(t, x) = uk (t, x) = sin πkx
k=1 k=1
2
Figure 1: Solution to the heat equation with the homogeneous Dirichlet boundary conditions and the
initial condition (bold curve) g(x) = x − x2 Left: Three dimensional plot, right: contour plot.
which is exactly the sine series for my function g, the coefficients of which can be found as
ˆ 1
bk = 2 g(x) sin πkx dx, k = 1, 2, . . . .
0
the first exponent with index k if bk ̸= 0. Therefore, in many practical situations it is possible to
concentrate only on the first nonzero term of the Fourier series
The approximation
∑10 becomes better and better as t grows. In Fig. 2 one can see the difference
u1 (t, x) − k=1 uk (t, x) for my example with g(x) = x − x2 .
Second, and more important, I note that the same negative exponents in the representation of
the solution by the sine Fourier series will guarantee that any derivative of the Fourier series will
converge (it does require some proof). This is an important characterization of the solutions to the
heat equation: Its solution, irrespective of the initial condition, is an infinitely differentiable function
for any t > 0.
3
∑10
Figure 2: The difference u1 (t, x) − k=1 uk (t, x) in the example with g(x) = x − x2 .
You can see the smoothing effect of the heat equation on the discontinuous initial condition (see
Fig. 3).
Figure 3: Solution to the heat equation with a discontinuous initial condition. For any t > 0 the
solution is an infinitely differential function.
I can also note that if we would like to revert the time and look into the past and not to the
future, then all the exponent would have the sign plus, which means that in general Fourier series will
diverge for any t < 0. This is actually a manifestation of the fact that the inverse problem for the
4
heat equation is not well posed, the heat equation represents a meaningful mathematical model only
for t > 0 and the solutions are not reversible. (As a side remark I note that ill-posed problems are
very important and there are special methods to attack them, including solving the heat equation for
t < 0, note that this is equivalent to solve for t > 0 the equation of the form ut = −α2 uxx .)
Example 12.2. Consider now the Neumann boundary value problem for the heat equation (recall
that homogeneous boundary conditions mean insulated ends, no energy flux):
Now, after introducing u(t, x) = T (t)X(x) I end up with the boundary value problem for X in the
form
X ′′ + λX = 0, X ′ (0) = X ′ (1) = 0.
I will leave it as an exercise to show that if λ < 0 then I do not have non-trivial solutions. If, however,
λ = 0, I have that
X(x) = A + Bx,
and the boundary conditions imply that B = 0 leaving me free variable A. Hence I conclude that for
λ = 0 my solution is X(x) = A. If λ > 0 then
√ √
X(x) = A cos λx + B sin λx,
λk = π 2 k 2 , k = 0, 1, 2, . . .
Tk (t) = Ck e−α
2 k2 π 2 t
, k = 0, 1, . . .
and therefore, due to the same superposition principle, I can represent my solution as
∞
∑ ∞
a0 ∑
ak e−α k π t cos πkx.
2 2 2
u(t, x) = Tk (t)Xk (x) = +
2
k=0 k=1
5
which is the cosine Fourier series for g, where
ˆ 1
ak = 2 g(x) cos πkx dx.
0
which is a mathematical description of the fact that the energy inside my rod must be conserved. The
solution that I found is also, as in the Dirichlet case, infinitely differentiable at any t > 0, and the
problem is ill-posed for t < 0.
Example 12.3. Recall the problem for the heat equation with periodic boundary conditions:
where ak , bk are the coefficients of the trigonometric Fourier series for g on −π ≤ x ≤ π (the exact
expressions are given in the previous section). Again, since the rod is insulated, I find that as t → ∞
ˆ π
1
u(t, x) → g(x) dx.
2π −π
Example 12.4. Now let me consider a problem for the heat equation with Robin or Type III boundary
condition on one end. I need to solve
6
Here I will assume that my constant h is positive.
Again, using the usual method of the separation of variables, I end up with
T ′ = α2 λT,
and
X ′′ + λX = 0, X(0) = 0, X(1) + hX(1) = 0.
First I consider the latter problem. I will look into only real values of constant λ.
λ = 0 implies that X(x) = 0 and hence of no interest to me. If λ < 0 then I get the system
0 = A + B,
√ √ √ √ √ √
0 = A(he− −λ
− −λe− −λ ) + B( −λe −λ + he −λ ).
This is a system of linear homogeneous equations with respect to A and B, and it has a nontrivial
solution if and only if the corresponding determinant of the system vanishes, which is equivalent, after
some simplification, to √
√ h − −λ
2 −λ
e = √ .
h + −λ
√
Note that the left hand side as the function of −λ has positive derivative, and the left hand side has
negative derivative, moreover they cross at the point λ = 0. Therefore, for −λ > 0 it is impossible to
have solutions to this equations, which rules out the case λ < 0.
Finally, if λ > 0, then I get
√ √
X(x) = A cos λx + B sin λx,
From the geometric considerations (see Fig. 4) it is clear that there is an infinite sequence of
(λk )∞
k=1 , 0 < λ1 < λ2 < . . ., such that λk → ∞ as k → ∞, and it is quite easy to find these lambdas
numerically, but I do not have a convenient formula for them. My solutions are
√
Xk (x) = Bk sin λk x,
7
Figure 4: Solutions to the equation tan µ = −µ/h.
√
where µk = λk . This looks like a Fourier sine series, but this is not, because in the classical Fourier
sine series I need µk = πk, which is not true for my example, and hence I cannot use the formulas for
the coefficients. Luckily, however, it turns out the the system of functions {sin µk x} is orthogonal on
[0, 1], and following the same steps that were done when I derived the coefficients for the trigonometric
Fourier series, I can find that
ˆ 1
2µk
bk = g(x) sin µk x dx.
µk − sin µk cos µk 0
Now my problem is fully solved because for any piecewise continuous g my time dependent Fourier
series is an infinitely differentiable function.
Exercise 2. Confirm that the system {sin µk x} is orthogonal on [0, 1] and also confirm the formula
for bk .
In all the examples above the boundary conditions were homogeneous. I emphasize that it must
be always true to be able to proceed with the method of the separation of variables (more technically,
I always need an ODE plus some boundary conditions, but if the original problem has inhomogeneous
boundary conditions then I have no way to deduce from them the boundary conditions for my ODE
problem). What to do if I am given non-homogeneous boundary conditions? Sometimes we can reduce
the problem with inhomogeneous boundary conditions to the problem with homogeneous ones.
8
]
Figure 5: Solutions to the heat equation with Robin boundary condition and the initial condition
g(x) = x.
Figure 6: The periodic extension (black) of g(x) = x on (−1, 1) along with its generalized Fourier
series (blue) based on the system {sin µk x} on the interval (−5, 5).
Consider as an example the Dirichlet problem for the heat equation with
u(t, 0) = k1 , u(t, l) = k2 .
Here k1 , k2 are two given constants. It should be clear (if not, carefully do all the math) that the
equilibrium (stationary) temperature in this case is given by
x
ueq (x) = k1 + (k2 − k1 ).
l
Now consider
u(t, x) = ueq (x) + v(t, x).
9
For the function v I will get (check!) the problem
vt = α2 vxx ,
v(t, 0) = v(t, l) = 0,
v(0, x) = g(x) − ueq (x),
where g is the initial condition from the original problem for u. Now I have homogeneous boundary
conditions and can use the Fourier method. Such approach will usually work when the boundary
conditions do not depend on t, otherwise I will end up with a nonhomogeneous heat equation, which
still can be solved using the separation of variables technique, but the solution process is slightly more
involved.
12.2 Conclusion
In this lecture I considered four examples that have a lot of common features. In particular, all of
them involve solving
X ′′ + λX = 0,
or, better,
−X ′′ = λX,
with some boundary conditions. By solving I mean “identifying those values of the parameter λ such
that my boundary value problem for ODE has a nontrivial (nonzero) solution.” In all four cases I
find an infinite sequence of such lambdas, all of which are real. Even more importantly, in all four
cases the corresponding solutions form an orthogonal system of functions, and hence the Fourier series
technique can be applied to represent the solution to my original PDE problem in the form of a
generalized Fourier series.
Is it a coincidence? Will it be the same for some other boundary conditions? I will answer these
questions in the next section.
3. Solve
ut = α2 uxx , x ∈ (0, 1), t>0
with u′ (t, 0) = u′ (t, 1) = 0 and u(0, x) = cos 2πx − π cos 3πx.
10
12.4 Solutions to the exercises
Exercise 1. The goal of this exercise is to show that in some situations a specific choice of the general
solution leads to much simpler calculations. I need to solve X ′′ + λX = 0 with X(0) = X(1) = 0 and
λ < 0. My general solution is given by X(x) = AX1 (x) + BX2 (x), where √
X1 and X2 are any√ linearly
independent solutions to my ODE. Very often one takes X1 (x) = e −λx and X2 (x) = e√ − −λx but
√ not the only possible choice. Another possibility is to take X1 (x) = sinh −λx and
this is certainly
X2 (x) = cosh −λx. Hence
√ √
X(x) = A sinh −λx + B cosh −λx.
Using the boundary conditions and the basic properties of the hyperbolic sine and cosine I immediately
get that the first boundary condition implies that B = 0. The second one yields hence that
√
A sinh −λ = 0,
which can be true if either A = 0 or λ = 0, and therefore there exists no nontrivial solutions to my
boundary value problem with λ < 0, much simpler than the calculations (mainly skipped!) in the
main text.
I repeat that in many situations using this particular choice for the general solution of X ′′ +λX = 0
leads to significant simplifications in calculations.
Exercise 2. The goal is to show that is µk are the positive solutions to tan µk = −µk /h then the
system of functions {sin µk x} is orthogonal on [0, 1]. Assume that µk ̸= µm are two such roots, and
consider
ˆ 1 ˆ
1 1( )
sin µk x sin µm x dx = cos(µk − µm )x − cos(µk + µm ) dx
0 2 0
1 (µk + µm ) sin(µk − µm ) − (µk − µm ) sin(µk − µm )
=
2 µ2k − µ2m
µm sin µk cos µm − µk sin µm cos µk
= .
µ2k − µ2m
Now, using the fact that tan µk = sin µk / cos µk = −µk /h implies that sin µk = −µk cos µk /h, I get,
as expected
µm sin µk cos µm − µk sin µm cos µk −µk µm cos µk cos µm + µk µm cos µm cos µk
= = 0.
µk − µm
2 2 h(µ2k − µ2m )
11