PDE notes: heat equation

1. Heat equation

1.1. Introduction

The heat equation corresponding to no sources and constant thermal properties is given as

\displaystyle u_t = ku_{xx} \ \ \ \ \ (1)

Equation (1) describes how heat energy spreads out. Other physical quantities besides temperature smooth out in much the same manner, satisfying the same partial differential equation (1). For this reason, (1) is also called the diffusion equation.

Since the heat equation in (1) has one time derivative, we must be given one initial condition (IC) (usually at t = 0), the initial temperature. It is possible that the initial temperature is not constant, but depends on x. Thus, we must be given the initial temperature distribution,

\displaystyle u(x,0)= f(x) \ \ \ \ \ (2)

We also need to know that happens at the two boundaries, {x = 0} and {x = L}. Without knowing this information, we cannot predict the future. Two conditions are needed corresponding to the second spatial derivatives present in (1), usually one condition at each end. We call them boundary conditions. We deal with mainly four types of boundary conditions: DirichletNeumannRobin, and Periodic.

1.2. Separation of Variables (SoV)

When the PDE and the BCs are linear and homogeneous, we use a technique called the method of separation of variables to find the analytic solutions.

We introduce the heat operator,

\displaystyle L(u)=u_t-ku_{xx} \ \ \ \ \ (3)

The heat operator is a linear operator that satisfies the linearity property {L(c_1u_1+c_2u_2)=c_1L(u_1)+c_2L(u_2)}.

A linear equation for the unknown {u} is of the form

\displaystyle L(u)=f \ \ \ \ \ (4)

where {L} is a linear operator and {f} is known. The heat equation is a linear PDE:

\displaystyle L(u)=u_t-ku_{xx}=f(x,t) \ \ \ \ \ (5)

{f(x,t)} is a forcing term. If {f=0}, then {L(u)=0} and the PDE becomes

\displaystyle u_t-ku_{xx}=0 \ \ \ \ \ (6)

Equation (6) is a linear homogeneous equation.

We now propose to study heat equation with zero temperatures at finite ends:

\displaystyle \mathrm{PDE: } \hspace{0.5cm} u_t=ku_{xx} \ \ \ \ \ (7)

\displaystyle \mathrm{BC1:} \hspace{0.5cm} u(0,t)=0 \ \ \ \ \ (8)

\displaystyle \mathrm{BC2:}\hspace{0.5cm} u(L,t)=0 \ \ \ \ \ (9)

\displaystyle \mathrm{IC:}\hspace{0.5cm} u(x,0) = f(x) \ \ \ \ \ (10)

defined for {0\leq x \leq L} and {t \geq 0 }. This problem consists of linear homogeneous partial differential equations with linear homogeneous boundary conditions.

Solution. We attempt to determine the product solution in the form of

\displaystyle u(x,t)=G(t)\phi(x) \ \ \ \ \ (11)

First, we substitute equation (11) into equation (7),

\displaystyle \phi(x)G'(t)=kG(t)\phi^{''}(x) \ \ \ \ \ (12)

We can “separate variables” by divide both sides of equation (12) by {kG(t)\phi(x)}:

\displaystyle \frac{1}{kG}G'=\frac{1}{\phi}\phi^{''} \ \ \ \ \ (13)

Now the variables are “separated” in a sense that the left hand side is only a function of {t} and the right hand side is only a function of {x}. Next, we can claim that both sides of (13) must equal the same constant:

\displaystyle \frac{1}{kG}G'=\frac{1}{\phi}\phi^{''}=-\lambda \ \ \ \ \ (14)

where {\lambda} is a constant known as the separation constant.

Equation (14) yields 2 ordinary differential equations,

\displaystyle G'=-\lambda kG \ \ \ \ \ (15)

and

\displaystyle \phi''=-\lambda\phi \ \ \ \ \ (16)

We now see that the advantage of the product method is that it transform a PDE, which we do not have to solve, into two ODEs. The boundary conditions impose two conditions on the {x}-dependent ODE. The time-dependent ODE, equation (15), has no additional conditions. We can find a general solution for equation (15) quite easily,

\displaystyle G(t)=ce^{-\lambda kt} \ \ \ \ \ (17)

where {c} is an arbitrary multiplicative constant. There can be three cases for {\lambda}: {\lambda>0}, {\lambda=0}, {\lambda<0}. We will determine all allowable values of {\lambda} next.

The ODE in (16) has two boundary conditions:

\displaystyle \phi(0)=0 \ \ \ \ \ (18)

\displaystyle \phi(L)=0 \ \ \ \ \ (19)

We call this a boundary value problem for ordinary differential equations. We note that {\phi(x)=0} satisfy the ODE (16) and both BCs (18) and (19) regardless of the value of the separation constant. Thus, {\phi(x)=0} is a trivial solution of our PDE. It corresponds to {u(x,t)\equiv0} since {u(x,t)=\phi(x)G(t)}. However, we want to see if there are other nontrivial solutions. We will show that there are certain values of {\lambda}, called eigenvalues of the boundary value problem, for which there are nontrivial solutions, {\phi(x)}. The non-trivial solutions are called eigenfunctions corresponding to the eigenvalues {\lambda}

Now we solve equation (16). For linear and homogeneous second-order ODE, two independent solutions are usually obtained in the form of {\phi=e^{rx}}. Substituting this result into equation (16) yields

\displaystyle \phi''=r^2e^{rx} \ \ \ \ \ (20)

and this implies that

\displaystyle r^2=-\lambda \ \ \ \ \ (21)

We consider the three cases of {\lambda} separately.

If {\lambda<0}, the roots of the characteristic polynomials are {r=\pm\sqrt{-\lambda}}, so the solutions are {e^{\sqrt{-\lambda}x}} and {e^{-\sqrt{-\lambda}x}}. The general solution is

\displaystyle \phi(x)=c_1e^{\sqrt{-\lambda}x}+c_2e^{-\sqrt{-\lambda}x} \ \ \ \ \ (22)

We use the hyperbolic functions,

\displaystyle \phi(x)=c_3\mathrm{cosh}(\sqrt{-\lambda}x)+c_4\mathrm{sinh}(\sqrt{-\lambda}x) \ \ \ \ \ (23)

We consider the BC from (18). Since {\mathrm{cosh}(0)=1}, {\phi(0)=0} implies that {c_3=0}. So we have {\phi(x)=c_4\mathrm{sinh}(\sqrt{-\lambda}x)}. Now we consider {\phi(L)=0}, which implies that {c_4\mathrm{sinh}(\sqrt{-\lambda}L)=0}. Since {\sqrt{-\lambda}L>0}, {\mathrm{sinh}(\sqrt{-\lambda}L)>0}. It follows that {c_4=0}. This implies that {\phi(x)=0}. The only solution of (16) for {\lambda<0} that solves the homogeneous boundary condition is the trivial solution. Thus there are no negative eigenvalues.

We now consider the case of {\lambda=0}. The general solution is

\displaystyle \phi(x)=c_1+c_2x \ \ \ \ \ (24)

Apply {\phi(0)=0} and we arrive at {c_1=0}. Apply {\phi(L)=0}, we have {c_2x=0} which implies that {c_2=0}. This implies that {\phi(x)=0}. The only solution of (16) for {\lambda=0} that solves the homogeneous boundary condition is the trivial solution. Thus {\lambda=0} is not an eigenvalue for this problem.

We now consider the case of {\lambda>0}. The roots of the characteristic polynomials are {r=\pm\sqrt{\lambda}i}, so the solutions are {e^{\sqrt{\lambda}ix}} and {e^{-\sqrt{\lambda}ix}}. The general solution is

\displaystyle \phi(x)=c_1e^{\sqrt{\lambda}ix}+c_2e^{-\sqrt{\lambda}ix} \ \ \ \ \ (25)

Since {\mathrm{cos}(\sqrt{\lambda}x)} and {\mathrm{sin}(\sqrt{\lambda}x)} are each linear combinations of {e^{\sqrt{\lambda}ix}} and {e^{-\sqrt{\lambda}ix}}, the general solution can also be expresed in the form of

\displaystyle \phi(x)=c_3\mathrm{cos}(\sqrt{\lambda}x)+c_4\mathrm{sin}(\sqrt{\lambda}x) \ \ \ \ \ (26)

For the BC {\phi(0)=0}, we have {\phi(0)=c_3\mathrm{cos}(\sqrt{\lambda}x)} which implies that {c_3=0}. Consider the BC {\phi(L)=0}, we have {c_4\mathrm{sin}(\sqrt{\lambda}x)=0}. If we let {c_4=0}, then we arrive at {u(x,t)=0}, a trivial solution. To find the nontrivial solutions, the eigenvalue {\lambda} much satisfy

\displaystyle \mathrm{sin}(\sqrt{\lambda}L)=0 \ \ \ \ \ (27)

{\sqrt{\lambda}x} must be the zero of the sine function. Thus,

\displaystyle \sqrt{\lambda}L=n\pi \ \ \ \ \ (28)

The eigenvalues are

\displaystyle \lambda=(\frac{n\pi}{L})^2, n=0,1,2,3... \ \ \ \ \ (29)

The eigenfunctions corresponding to the eigenvalues are

\displaystyle \phi(x)=c_4\mathrm{sin}(\frac{n\pi x}{L}), n=0,1,2,3... \ \ \ \ \ (30)

Now we know that the product solution consists of {\phi(x)=\\c_4\mathrm{sin}(\frac{n\pi x}{L})} and {G(t)=e^{-(\frac{n\pi}{L})^2 kt}} where we determined from the boundary conditions {\phi(0)=0} and {\phi(L)=0}. We call this type of boundary conditions the Dirichlet boundary conditions. Thus, the product solutions of the heat equation with homogeneous Dirichlet boundary conditions are

\displaystyle u(x,t)= B\mathrm{sin}(\frac{n\pi x}{L})e^{-(\frac{n\pi}{L})^2 kt}, n=0,1,2,3... \ \ \ \ \ (31)

where B is an arbitrary constant.

1.3. Initial value problems

The principle of superposition can be extended to show that if {u_1 , u_2 , u_3 , . . . , u_M} are solutions of a linear homogeneous problem, then any linear combination of these is also a solution, {\sum_{n=1}^{M} c_nu_n},where {c_n} are arbitrary constants. Since we know from the method of separation of variables that {\mathrm{sin}(\frac{n\pi x}{L})e^{-(\frac{n\pi}{L})^2 kt}} is a solution of the heat equation (solving zero boundary conditions) for all positive {n}, it follows that any linear combination of these solutions is also a solution of the linear homogeneous heat equation. Thus,

\displaystyle u(t,x)=\sum_{n=1}^{M} B_n\mathrm{sin}(\frac{n\pi x}{L})e^{-(\frac{n\pi}{L})^2 kt} \ \ \ \ \ (32)

For example, we wish to solve the following initial value problem:

\displaystyle \mathrm{PDE: } \hspace{0.5cm} u_t = ku_{xx} \ \ \ \ \ (33)

\displaystyle \mathrm{BC1:} \hspace{0.5cm}u(0,t)=0 \ \ \ \ \ (34)

\displaystyle \mathrm{BC2:}\hspace{0.5cm}u(L,t)=0 \ \ \ \ \ (35)

\displaystyle \mathrm{IC:}\hspace{0.5cm} u(x,0) = 3\mathrm{sin}(\frac{4\pi x}{L})+7\mathrm{sin}(\frac{9\pi x}{L}) \ \ \ \ \ (36)

Solution. We can let {u_1(x,0) = 3\mathrm{sin}(\frac{4\pi x}{L})} and {u_2(x,0) = 7\mathrm{sin}(\frac{9\pi x}{L})} such that {u(x,0)=u_1(x,0)+u_2(x,0)}. We can use the product solutions from (31) and we see that the product solution satisfy the initial conditions {B\mathrm{sin}(\frac{n\pi x}{L})}. By picking {B=3} and {n=4}, we have satisfied the initial condition {u_1(x,0)}. The solution we get is

\displaystyle u_1(t,x)=3\mathrm{sin}(\frac{4\pi x}{L})e^{-(\frac{4\pi}{L})^2 kt} \ \ \ \ \ (37)

By picking {B=7} and {n=9}, we have satisfied the initial condition {u_2(x,0)}. The solution we get is

\displaystyle u_1(t,x)=7\mathrm{sin}(\frac{9\pi x}{L})e^{-(\frac{9\pi}{L})^2 kt} \ \ \ \ \ (38)

By superposition principle we know that the product solution of our problem is a linear combinations of {u_1(x,t)} and {u_2(x,t)}. Thus,

\displaystyle u(t,x)=3\mathrm{sin}(\frac{4\pi x}{L})e^{-(\frac{4\pi}{L})^2 kt}+ 7\mathrm{sin}(\frac{9\pi x}{L})e^{-(\frac{9\pi}{L})^2 kt} \ \ \ \ \ (39)

{\square}

The IC in the previous problem is a finite sum of the sine functions. What should we do in the situation that the IC is not a finite linear combinations of the sine functions? Consider the following problem:

\displaystyle \mathrm{PDE: } \hspace{0.5cm} u_t = ku_{xx} \ \ \ \ \ (40)

\displaystyle \mathrm{BC1:} \hspace{0.5cm}u(0,t)=0 \ \ \ \ \ (41)

\displaystyle \mathrm{BC2:}\hspace{0.5cm}u(L,t)=0 \ \ \ \ \ (42)

\displaystyle \mathrm{IC:}\hspace{0.5cm} u(x,0) = 100 \ \ \ \ \ (43)

Solution. From equation (32) we know that the solution is

\displaystyle u(t,x)=\sum_{n=1}^{M} B_n\mathrm{sin}(\frac{n\pi x}{L})e^{-(\frac{n\pi}{L})^2 kt} \ \ \ \ \ (44)

We want to apply the IC to our problem. First, from the previous problem, note that we can solve the heat equation if initially

\displaystyle u(x,0)= f(x) = \sum_{n=1}^{M} B_n\mathrm{sin}(\frac{n\pi x}{L}) \ \ \ \ \ (45)

Thus, we use the theory of Fourier series and claim that “any” (with restrictions) initial condition {f(x)} can be written as an infinite linear combination of {\mathrm{sin}(\frac{n\pi x}{L})}, known as a type of Fourier series:

\displaystyle f(x) = \sum_{n=1}^{\infty} B_n\mathrm{sin}(\frac{n\pi x}{L}) \ \ \ \ \ (46)

We want to determine the coefficient {B_n} in equation (46). To do that, we use the fact the {\mathrm{sin}(\frac{n\pi x}{L})} satisfies the following orthogonality relation:

\displaystyle \int_{0}^{L} \mathrm{sin}(\frac{n \pi x}{L})\mathrm{sin}(\frac{m \pi x}{L}) \,dx = \left\{ \begin{array}{lr} 0 & n \neq m \\ \frac{L}{2} & n=m \\ \end{array} \right. \ \ \ \ \ (47)

Multiply (46) by {\mathrm{sin}(\frac{m \pi x}{L})} and integrating from {0} to {L} yields

\displaystyle \int_{0}^{L} f(x)\mathrm{sin}(\frac{m \pi x}{L})\, dx = B_{m}\int_{0}^{L}\mathrm{sin^2}(\frac{m\pi x}{L})\, dx \ \ \ \ \ (48)

Solving for {A_m} yields,

\displaystyle B_m=\frac{2}{L} \int_{0}^{L}f(x)\mathrm{sin}(\frac{m \pi x}{L})\, dx \ \ \ \ \ (49)

Now, we calculate the coefficient {B_n} from equation (49) for {f(x)=100},

\displaystyle B_n=\frac{2}{L} \int_{0}^{L}100\mathrm{sin}(\frac{n \pi x}{L})\, dx \ \ \ \ \ (50)

Solving for {B_n} yields,

\displaystyle \left\{ \begin{array}{lr} 0 & n \hspace{5pt} even\\ \frac{400}{n\pi} & n\hspace{5pt} odd \\ \end{array} \right. \ \ \ \ \ (51)

Each succeeding term in the series is much smaller than the first. We can then approximate the infinite series by only the first term:

\displaystyle u(t,x)\approx \frac{400}{\pi}\mathrm{sin}(\frac{\pi x}{L})e^{-(\frac{\pi}{L})^2 kt} \ \ \ \ \ (52)

{\square}

Let us summarize the method of separation of variables as it appears for the heat equation with homogeneous Dirichlet boundary conditions:

\displaystyle \mathrm{PDE: } \hspace{0.5cm} u_t = ku_{xx} \ \ \ \ \ (53)

\displaystyle \mathrm{BC1:} \hspace{0.5cm}u(0,t)=0 \ \ \ \ \ (54)

\displaystyle \mathrm{BC2:}\hspace{0.5cm}u(L,t)=0 \ \ \ \ \ (55)

\displaystyle \mathrm{IC:}\hspace{0.5cm} u(x,0) = f(x) \ \ \ \ \ (56)

  1. Make sure that you have a linear and homogeneous PDE with linear and homogeneous BC.
  2. Temporarily ignore the nonzero IC.
  3. Separate variables (determine differential equations implied by the assumption of product solutions) and introduce a separation constant.
  4. Determine separation constants as the eigenvalues of a boundary value problem.
  5. Solve other differential equations. Record all product solutions of the PDE obtainable by this method.
  6. Apply the principle of superposition (for a linear combination of all product solutions).
  7. Attempt to satisfy the initial condition.
  8. Determine coefficients using the orthogonality of the eigenfunctions.

1.4. Other Boundary Value Problems

The following problem is defined for {0\leq x \leq L} and {t \geq 0 }.

\displaystyle \mathrm{PDE: } \hspace{0.5cm} u_t = ku_{xx} \ \ \ \ \ (57)

\displaystyle \mathrm{BC1:} \hspace{0.5cm}u_x(0,t)=0 \ \ \ \ \ (58)

\displaystyle \mathrm{BC2:}\hspace{0.5cm}u_x(L,t)=0 \ \ \ \ \ (59)

\displaystyle \mathrm{IC:}\hspace{0.5cm} u(x,0) = f(x) \ \ \ \ \ (60)

This is a heat conduction problem in a one-dimensional rod with constant thermal properties and no sources. The ends of the rod are insulated. Both the PDE and BCs are linear and homogeneous. We call this type of BC the Neumann boundary condition. We apply SoV.

Solution. The assumed product solutions are:

\displaystyle u(x,t)=\phi(x)G(t) \ \ \ \ \ (61)

Substitute into the PDE,

\displaystyle \phi G'= kG\phi^{''}= -\lambda \ \ \ \ \ (62)

where {\lambda} is the separation constant. This implies that

\displaystyle G^{'}=-\lambda kG \ \ \ \ \ (63)

\displaystyle \phi^{''}=-\lambda\phi \ \ \ \ \ (64)

Solving (64),

\displaystyle G(t)=e^{-\lambda kt} \ \ \ \ \ (65)

The insulated BCs imply that the separated solutions must satisfy

\displaystyle \phi^{'}(0)=0 \ \ \ \ \ (66)

\displaystyle \phi^{'}(L)=0 \ \ \ \ \ (67)

We determine the separation constant {\lambda} by finding those {\lambda} for which nontrivial solutions exist.

For {\lambda <0}, the general solution is

\displaystyle \phi(x)=c_1e^{\sqrt{-\lambda}x}+c_2e^{-\sqrt{-\lambda}x} \ \ \ \ \ (68)

We also need

\displaystyle \phi^{'}(x)=\sqrt{-\lambda}(c_1e^{\sqrt{-\lambda}x}-c_2e^{-\sqrt{-\lambda}x}) \ \ \ \ \ (69)

The BC {\phi^{'}(0)=0} implies that {c_1=c_2}, and {\phi^{'}(L)=0} means that

\displaystyle \sqrt{-\lambda}(c_1e^{\sqrt{-\lambda}L}-c_2e^{-\sqrt{-\lambda}L})=2\sqrt{-\lambda}c_1\mathrm{sinh}(\sqrt{-\lambda} L)=0 \ \ \ \ \ (70)

Since {\sqrt{-\lambda} L >0}, {\mathrm{sinh}(\sqrt{-\lambda} L)>0}. This implies that {c_1=0}. Since {\phi(x)=0} is a trivial solution, there is no negative eigenvalues.

For {\lambda=0}, the solution is

\displaystyle \phi(x)=c_1+c_2x \ \ \ \ \ (71)

and

\displaystyle \phi^{'}(x)=c_2 \ \ \ \ \ (72)

Both BCs give {c_2=0}. Thus, there are non trivial solutions of the BVP for {\lambda=0}, namely,

\displaystyle \phi(x)=c_1 \ \ \ \ \ (73)

The time dependent part gives {G(t)=e^{-\lambda kt}=1}. Thus, the resulting product solution of the PDE is

\displaystyle u(x,t)=A \ \ \ \ \ (74)

where {A} is any constant.

For {\lambda>0}, the solutions is in the form

\displaystyle \phi(x)=e^{\pm\sqrt{\lambda}ix} \ \ \ \ \ (75)

which gives

\displaystyle \phi(x)=c_1\mathrm{cos}(\sqrt{\lambda} x)+c_2\mathrm{sin}(\sqrt{\lambda} x) \ \ \ \ \ (76)

and

\displaystyle \phi^{'}(x)=\sqrt{\lambda}(c_2\mathrm{cos}(\sqrt{\lambda} x)-c_1\mathrm{sin}(\sqrt{\lambda} x)) \ \ \ \ \ (77)

The BC {\phi^{'}(0)=0} implies that {c_2\sqrt{\lambda}=0}, so {c_2=0}. The BC {\phi^{'}(L)=0} gives

\displaystyle -\sqrt{\lambda}c_1\mathrm{sin}(\sqrt{\lambda}L)=0 \ \ \ \ \ (78)

For nontrivial solutions, {c_1\neq0}. This gives us {\mathrm{sin}(\sqrt{\lambda}L)=0}.

\displaystyle \lambda= (\frac{n\pi}{L})^2, n=0,1,2,3... \ \ \ \ \ (79)

However, the corresponding eigenfunctions are cosines,

\displaystyle \phi(x)=c_1\mathrm{cos}(\frac{n\pi x}{L}), n=0,1,2,3... \ \ \ \ \ (80)

The product solution of the PDE is

\displaystyle u(t,x)=Ae^{-(\frac{n\pi}{L})^2kt}\mathrm{cos}(\frac{n\pi x}{L}), n=0,1,2,3... \ \ \ \ \ (81)

where A is a arbitrary multiplicative constant.

In order to satisfy the IC, we use the principle of superposition so that,

\displaystyle u(t,x)=A_0+\sum_{n=1}^{\infty}A_{n}e^{-(\frac{n\pi}{L})^2kt}\mathrm{cos}(\frac{n\pi x}{L}) \ \ \ \ \ (82)

The IE {u(x,0)=f(x)} is satisfied if

\displaystyle f(x)=A_0+\sum_{n=1}^{\infty}A_{n}\mathrm{cos}(\frac{n\pi x}{L}) \ \ \ \ \ (83)

for {0\leq x \leq L}.

To complete the solution, we need to determine the arbitrary coefficient {A_0} and {A_n}. We use the fact that {\mathrm{cos}(\frac{n\pi x}{L})} satisfies the following orthogonality relation:

\displaystyle \int_{0}^{L} \mathrm{cos}(\frac{n \pi x}{L})\mathrm{cos}(\frac{m \pi x}{L}) \,dx = \left\{ \begin{array}{lr} 0 & n \neq m \\ \frac{L}{2} & n=m\neq 0 \\ L & n=m=0 \end{array} \right. \ \ \ \ \ (84)

for {n} and {m} nonnegative integers.

Multiply (83) by {\mathrm{cos}(\frac{m \pi x}{L})} and integrating from {0} to {L} yields

\displaystyle \int_{0}^{L} f(x)\mathrm{cos}(\frac{m \pi x}{L})\, dx = A_{m}\int_{0}^{L}\mathrm{cos^2}(\frac{m\pi x}{L})\, dx \ \ \ \ \ (85)

Solving for {A_m} yields,

\displaystyle A_0= \frac{1}{L} \int_{0}^{L}f(x)\, dx \ \ \ \ \ (86)

\displaystyle A_m=\frac{2}{L} \int_{0}^{L}f(x)\mathrm{cos}(\frac{m \pi x}{L})\, dx , m\geq 1 \ \ \ \ \ (87)

{\square}

Leave a Reply