Math2111: Chapter 1: Fourier series. Section 6: Heat equation

In this blog entry you can find lecture notes for Math2111, several variable calculus. See also the table of contents for this course. This blog entry printed to pdf is available here.

In this part we discuss applications of Fourier series to solving a certain type of partial differential equation (pde). In more detail, we discuss the heat equation. The aim is to show how Fourier series naturally come up in the solution of this equation.

The heat equation describes the heat distribution in space and time. To illustrate the method it is sufficient to consider only the case of one spatial variable here. Let x \in [0,L] denote the spatial variable, let t \in [0, \infty) denote time and let u = u(x,t) be a function of x and t. Then the heat equation is given by

\displaystyle \frac{\partial u}{\partial t} = \alpha^2 \frac{\partial^2 u}{\partial x^2},

where \alpha > 0 is a constant. The task is to find a function u:[0,L] \times [0, \infty) \to \mathbb{R} which satisfies the heat equation, some initial condition

\displaystyle u(x,0) = f(x) \quad \mbox{for } x \in [0,L],

where f:[0,L] \to \mathbb{R} is, say, continuous, and (in our case) homogeneous boundary conditions

\displaystyle u(0,t) = 0 \quad \mbox{ and } u(L,t) = 0.

Separation of variables

We solve the heat equation using separation of variables, that is, we assume that the solution to the problem is of the form

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

for a function X:[0,L] \to \mathbb{R} and T:[0,\infty) \to \mathbb{R} (note that X does NOT depend on t and that T does NOT depend on x). In this case we have

\displaystyle \frac{\partial u}{\partial t} = X T^{\prime} \quad \mbox{and }  \frac{\partial^2 u}{\partial x^2} = X^{\prime \prime} T,

where T^\prime = \frac{\mathrm{d} T}{\mathrm{d} t} and X^{\prime \prime} = \frac{\mathrm{d}^2 X}{\mathrm{d} x^2}. Substituting this ansatz into the heat equation we obtain

\displaystyle XT^{\prime} = \alpha^2 X^{\prime \prime} T.

We can now separate the functions X and T to obtain

\displaystyle  \frac{T^\prime}{T} = \alpha^2 \frac{X^{\prime \prime}}{X}.

Now observe that

\displaystyle \frac{T^\prime}{T}

is only a function of t, whereas

\displaystyle \frac{X^{\prime \prime}}{X}

is only a function of x. Hence, the only way those two expressions can be equal is if both

\displaystyle \frac{T^\prime}{T} \quad \mbox{and } \frac{X^{\prime \prime}}{X}

are constant. Hence we have

\displaystyle \frac{T^\prime}{T} = \alpha^2 \frac{X^{\prime\prime}}{X} = - \lambda^2.

Thus we obtain now two ordinary differential equations (ode)

\displaystyle \begin{array}{rcl} X^{\prime \prime} + p^2 X & = & 0, \qquad\qquad (1) \\ && \\ T^\prime + \lambda^2 T & = & 0, \qquad\qquad (2) \end{array}

where we set p = \lambda/\alpha. The first ode has a solution of the form

\displaystyle X(x) = A \cos p x + B \sin p x

(check this by substituting this equation into the ode). Now our solution should satisfy the boundary conditions

\displaystyle u(0,t) = X(0) T(t) =0 \quad \mbox{and } u(L,t) = X(L) T(t) = 0.

If X(0) \neq 0 or if X(L) \neq 0, then T(t) = 0 for all t and hence we only obtain the trivial solution u(x,t) = 0 for all x and t. Hence we assume now that X(0) = X(L) = 0, which implies that

\displaystyle X(0) = A \cos p 0 = 0 \quad \mbox{and } X(L) = A\cos pL + B \sin p L = 0.

The first equation implies that A = 0, hence we get from the second equation that

\displaystyle B \sin pL = 0.

If B = 0, then X(x) = 0 for all x and we only get the trivial solution. If B \neq 0, then \sin pL = 0. This holds if p L = n \pi for some integer n \ge 1 (for n = 0 we only get the trivial solution again). Indeed, we get infinitely many solutions, where p \in \{\frac{\pi}{L}, \frac{2\pi}{L}, \frac{3 \pi}{L}, \ldots\}. Let now

\displaystyle p_n = \frac{n \pi}{L} \quad \mbox{for } n = 1, 2, 3, \ldots.

Then we obtain infinitely many solutions to the ode (1) of the form

\displaystyle X_n(x) = B_n \sin \left(\frac{n \pi x}{L} \right).

We now solve (2). We have p_n = \lambda_n/\alpha (\alpha is a constant given by the equation, but \lambda may take on different values depending on the solution). Hence \lambda_n = \alpha p_n = \frac{n \alpha \pi}{L} for n = 1, 2, 3, \ldots . Hence for each natural number n we obtain a solution T_n to the ode (2) (where \lambda = \lambda_n) of the form

\displaystyle T_n(t) = \mathrm{e}^{-\lambda_n^2 t}

(check that this solves the ode (2)).

Thus we obtain solutions to the heat equation which satisfy the homogeneous boundary conditions of the form

\displaystyle u_n(x,t) = X_n(x) T_n(t) \quad \mbox{where } n = 1,2, 3, \ldots .

We call these functions the eigenfunctions corresponding to the eigenvalues \lambda_n = \frac{n \alpha \pi}{L}.

We still need to find a solution which satisfies the initial condition. To do so, notice that any linear combination of the eigenfunctions u_n is again a solution to the heat equation which satisfies the homogeneous boundary conditions. Hence, in general, we have a solution of the form

\displaystyle u(x,t) = \sum_{n=1}^\infty B_n \sin \left(\frac{n \pi x}{L} \right) \mathrm{e}^{- \lambda_n^2 t},

where B_1, B_2, \ldots are real numbers which we can choose such that u satisfies the initial condition. More precisely, we need to choose B_1, B_2, \ldots such that

\displaystyle u(x,0) = \sum_{n=1}^\infty B_n \sin \left(\frac{n\pi x}{L} \right) = f(x) \quad \mbox{for all } x \in [0,L].

The last equation means that the B_n are the Fourier coefficients of the Fourier sine series of f. Hence

\displaystyle B_n = \frac{2}{L} \int_0^L f(x) \sin \left(\frac{n \pi x}{L} \right)\, \mathrm{d}x \quad \mbox{for } n = 1,2,3, \ldots

which completes our solution to the heat equation.

Example Solve the heat equation in one dimension with homogeneous boundary conditions, assuming that the initial temperature is given by

\displaystyle  f(x) = \left\{\begin{array}{rl} x & \mbox{if } 0 < x < L/2, \\ & \\ L-x & \mbox{if } L/2 \le x < L. \end{array} \right.


3 responses to “Math2111: Chapter 1: Fourier series. Section 6: Heat equation

  1. Is the process for solving heat equations something we should just remember and churn out and apply? From the lectures (and the one problem 13 on the heat equation in the Tute), it seems as if theres only ever one type of heat equation question where all that changes are the constants involved. That is, a solid bar with u=o at both ends and with a two piece linear function defined for f(x) = u(x,o)

    Do we have to know about more complicated heat equation questions with more complex boundary conditions and functions? For example a more complex f(x) or a boundary condition where u(L,t) could be a function of t?

    • Hi Thien, you do not need to know about more complex boundary conditions, we only consider homogeneous boundary conditions u(0,t)=u(L,t)=0. There might be other initial functions {}f though and you should know how to find solutions in this case.

      Here, the main purpose is to illustrate how Fourier (sine) series naturally come up in the solution of some pdes. More complex scenarios will be studied in Math2120 and Math2130.

  2. Dear Josef,

    Thank you for this useful notes. I have one question
    my supervisor told me that the solution of the heat equation
    (du/dt=d^2 u/dx^2) on the interval [0,2pi] with periodic
    boundary condition u(0,t)=u(2pi,t)
    and intial conditions
    u(x,0)=1 when x in [pi/2, 3pi/2] and
    u(x,0)=0 otherwise

    the solution is (u(x,t) goes to 1/2) when ( t goes to infinity).

    If you don’t mind, could you tell me is that right and why?

    Thank you,


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s