Partial Differential Equations
7.3 Heat Equation
A. Introduction to Solving Partial Differential Equations
In this section, we explore the method of Separation of Variables for solving partial differential equations commonly encountered in mathematical physics, such as the heat and wave equations. This method simplifies complex partial differential equations into more manageable ordinary differential equations. While computer-based algorithms like finite differences and finite elements are frequently used for solving partial differential equations, their accuracy can be challenging to gauge. Therefore, the analytical Separation of Variables method is important for verifying these computational methods’ results.
B. Heat Equation
The heat equation describes how heat diffuses through a medium over time. It is formulated considering a small volume element within the material, where the rate of thermal energy change is equal to the net heat flow. Representing the temperature at point [asciimath]x[/asciimath] and time [asciimath]t[/asciimath] by [asciimath]u(x,t)[/asciimath], the heat equation in one dimension is expressed as
[asciimath](delu)/(delt)(x,t)=beta^2(del^2u)/(delx^2)(x,t)[/asciimath]
Solving this equation requires setting boundary and initial conditions. The initial condition specifies the temperature distribution throughout the domain at the initial time, usually at [asciimath]t=0[/asciimath]. For example, for a rod or a similar one-dimensional domain, the initial condition might be given as [asciimath]u(x,0)=f(x)[/asciimath], where [asciimath]f(x)[/asciimath] describes the temperature distribution along the rod at the initial time.
C. Solution to Heat Equation with Dirichlet Boundary Conditions
Consider a uniform rod of length [asciimath]L[/asciimath] with both ends kept at zero temperature. The heat equation in one dimension is
[asciimath]frac{partial u}{partial t} = beta^2 frac{partial^2 u}{partial x^2}[/asciimath] (7.3.1)
For zero temperature at both ends of the rod, the boundary conditions are:
[asciimath]u(0, t) = 0 quad text{and} quad u(L, t) = 0[/asciimath]
The initial temperature distribution along the rod is given by:
[asciimath]u(x, 0) = f(x)[/asciimath]
Using the method of Separation of Variables, we assume that the solution can be written as the product of two functions, one depending only on [asciimath]x[/asciimath] and the other only on [asciimath]t[/asciimath].
[asciimath]u(x, t) = X(x)T(t)[/asciimath]
Substituting the solution form into the Heat Equation gives
[asciimath]T'(t)X(x)=beta^2X''(x)T(t)[/asciimath]
Dividing the equation by [asciimath]beta^2 X(x)T(t)[/asciimath] yields
[asciimath]frac{1}{beta^2} frac{T'(t)}{T(t)} = frac{X''(x)}{X(x)}[/asciimath]
This equation is separated into two ordinary differential equations (ODEs) because the left side depends only on [asciimath]t[/asciimath] and the right side only on [asciimath]x[/asciimath]. For this equation to hold for all values of [asciimath]x[/asciimath] and [asciimath]t[/asciimath] , each side of the equation must be independently equal to a constant. This is because the only way a function of [asciimath]x[/asciimath] can equal a function of [asciimath]t[/asciimath] under all circumstances is if both are equal to the same constant value. Consequently, we set both sides of the equation to a negative constant, denoted a [asciimath]-lambda[/asciimath], [asciimath]lambda[/asciimath] is known as the separation constant. The negative sign is conventionally added for simplification in subsequent steps.
[asciimath]frac{1}{beta^2} frac{T'(t)}{T(t)} = frac{X''(x)}{X(x)} =-lambda[/asciimath]
As a result, we arrive at two distinct ODEs.
[asciimath]frac{X''(x)}{X(x)} =-lambda[/asciimath]
[asciimath]frac{1}{beta^2} frac{T'(t)}{T(t)} =-lambda[/asciimath]
Solving the Spatial ODE
To solve the spatial part of the ordinary differential equation (ODE), we start by rearranging the equation
[asciimath]X''(x) + lambda X(x) = 0[/asciimath]
[asciimath]u(0, t) = 0 quad text{and} quad u(L, t) = 0[/asciimath]
[asciimath]X(x)=0[/asciimath] is the trivial solution for this boundary value problem. However, here our focus is on nontrivial solutions as they provide meaningful insights into the system’s behavior under various conditions. A value of [asciimath]lambda[/asciimath] for which this problem has a nontrivial solution is called an eigenvalue of the problem and the nontrivial solutions are eigenfunctions associated with that [asciimath]lambda[/asciimath]. These eigenfunctions, unlike the trivial solution, provide a deeper understanding of the dynamics and characteristics of the system.
Finding the Eigenvalues and Eigenfunctions
Case 1: [asciimath]lambda>0[/asciimath]
In this case, the roots of [asciimath]c(lambda)[/asciimath] are complex and the solution is
[asciimath]X(x)=c_1cos(sqrt(lambda)x)+c_2sin(sqrt(lambda)x)[/asciimath]
Applying the first boundary conditions [asciimath]X(0) = 0[/asciimath], we find that [asciimath]c_1=0[/asciimath]. Applying the second boundary conditions [asciimath]X(L) = 0[/asciimath] yields the equation [asciimath]c_2sin(Lsqrt(lambda))=0[/asciimath]. To obtain a nontrivial solution, the sine function itself must be zero.
[asciimath]sin(Lsqrt(lambda))=0[/asciimath] [asciimath]->[/asciimath] [asciimath]Lsqrt(lambda)=npi[/asciimath] for [asciimath]n = 1, 2, 3, ldots[/asciimath]
Therefore, the positive eigenvalues and their associated eigenfunctions of this boundary value problem are determined to be
[asciimath]lambda_n = left( frac{npi}{L} right)^2 quad text{and} quad X_n(x) = sinleft( frac{npi x}{L} right)[/asciimath] for [asciimath]n = 1, 2, 3, ldots[/asciimath]
Case 2: [asciimath]lambda=0[/asciimath]
In this case, the solution to the differential equation is
[asciimath]X(x)=c_1+c_2x[/asciimath]
Applying the first boundary conditions [asciimath]X(0) = 0[/asciimath], we find that [asciimath]c_1=0[/asciimath]. Applying the second boundary conditions [asciimath]X(L) = 0[/asciimath], we obtain [asciimath]c_2=0[/asciimath]. In this case, the only solution is the trivial solution, which is discarded.
Case 3: [asciimath]lambda<0[/asciimath]
In this case, the roots of [asciimath]c(lambda)[/asciimath] are real number resulting in the solution
[asciimath]X(x)=c_1e^(-sqrt(lambda)x)+c_2e^(sqrt(lambda)x)[/asciimath]
Upon applying the first boundary conditions [asciimath]X(0) = 0[/asciimath], we find that [asciimath]c_1+c_2=0[/asciimath]. The second boundary conditions [asciimath]X(L) = 0[/asciimath] leads to [asciimath]c_1e^(-Lsqrt(lambda))+c_2e^(Lsqrt(lambda)) =0[/asciimath]. Solving the system for [asciimath]c_1[/asciimath] and [asciimath]c_2[/asciimath], we arrive at
[asciimath]c_2(e^(Lsqrt(lambda)) -e^(-Lsqrt(lambda)) )=0[/asciimath]
As we seek a nontrivial solution, the term in parentheses must be zero.
[asciimath]e^(Lsqrt(lambda)) -e^(-Lsqrt(lambda)) =0[/asciimath]
However, this equation holds only if [asciimath]lambda=0[/asciimath], which contradicts our assumption that [asciimath]lambda<0[/asciimath]. Thus, we conclude that [asciimath]c_2[/asciimath] must be zero, leading to a trivial solution.
Therefore, the only valid eigenvalues and eigenfunctions for the spatial part of the equation are realized when [asciimath]lambda>0[/asciimath]. These are given by
[asciimath]lambda_n = left( frac{npi}{L} right)^2 quad text{and} quad X_n(x) = sinleft( frac{npi x}{L} right)[/asciimath] for [asciimath]n = 1, 2, 3, ldots[/asciimath]
Solving the Temporal ODE
[asciimath]frac{1}{beta^2} frac{T'(t)}{T(t)} =-lambda[/asciimath]
and substituting the previously determined eigenvalues [asciimath]lambda_n = left( frac{npi}{L} right)^2[/asciimath], which transforms the temporal ODE into
[asciimath]T'(t) + beta^2 left( frac{npi}{L} right)^2 T(t) = 0[/asciimath]
For each eigenvalue [asciimath]lambda_n[/asciimath], the to solution to this differential equation is
[asciimath]T_n(t) = ce^{-beta^2 left( frac{npi}{L} right)^2 t}[/asciimath] for [asciimath]n = 1, 2, 3, ldots[/asciimath]
Here [asciimath]c[/asciimath] represents an arbitrary constant. This series of functions [asciimath]T_n(t)[/asciimath] describes how the temperature evolves over time for each spatial mode [asciimath]n[/asciimath].
Constructing the General Solution
To construct the general solution for the heat equation, we combine the spatial and temporal solutions into a composite series.
[asciimath]u(x, t) = X(x)T(t)[/asciimath]
Given the solutions [asciimath]X_n(x) = sinleft( frac{npi x}{L} right)[/asciimath] and [asciimath]T_n(t) = ce^{-beta^2 left( frac{npi}{L} right)^2 t}[/asciimath], the combined form for each mode [asciimath]n[/asciimath] is
[asciimath]u(x, t) =B_n sinleft( frac{npi x}{L} right) e^{-beta^2 left( frac{npi}{L} right)^2 t}[/asciimath] for [asciimath]n = 1, 2, 3, ldots[/asciimath]
In series notation, this becomes
[asciimath]u(x, t) = sum_{n=1}^{infty} B_n sinleft( frac{npi x}{L} right) e^{-beta^2 left( frac{npi}{L} right)^2 t}[/asciimath](7.3.2)
Here, the constant [asciimath]c[/asciimath] from the temporal solution is represented as [asciimath]B_n[/asciimath] for each [asciimath]n[/asciimath] as this constant may vary with each term in the series. To find the coefficient [asciimath]B_n[/asciimath], we apply the initial condition [asciimath]u(x, 0) = f(x)[/asciimath]. This leads to
[asciimath]u(x,0)=f(x)=sum_(n=1)^ooB_n sin((npix)/L)[/asciimath]
This is the Fourier sine series representation of [asciimath]f(x)[/asciimath] over the interval [asciimath][0,L][/asciimath]. The coefficients [asciimath]B_n[/asciimath] are determined by
[asciimath]B_n=2/Lint_0^Lf(x)sin((npix)/L) dx[/asciimath] (7.3.3)
Find the solution to the initial boundary value heat flow problem
[asciimath](delu)/(delt)(x,t)=5(del^2u)/(delx^2)(x,t) \ ,[/asciimath] [asciimath]0ltxltpi,[/asciimath] [asciimath]tgt0[/asciimath]
[asciimath]u(0,t)=u(pi,t)=0\ ,[/asciimath] [asciimath]t>0[/asciimath]
[asciimath]u(x,0)=6sin(x)+7sin(5x)[/asciimath] [asciimath]0<=x<=pi[/asciimath]
Show/Hide Solution
Comparing the given partial differential equation to Equation 7.3.1, we see [asciimath]beta^2=5[/asciimath] and [asciimath]L=pi[/asciimath]. Given the initial condition is a linear combination of a few sine functions (eigenfunctions), all we need to do is to find the combination of terms in the general solution 7.3.2 that satisfies the initial condition [asciimath]u(x,0)[/asciimath].
[asciimath]u(x,0)=6sin(x)+7sin(5x)[/asciimath]
[asciimath]sum_{n=1}^{infty} B_n sinleft( frac{npi x}{pi} right) e^0=[/asciimath] [asciimath]6sin(x)+7sin(5x)[/asciimath]
[asciimath]sum_{n=1}^{infty} B_n sin(n x )=[/asciimath] [asciimath]6sin(x)+7sin(5x)[/asciimath]
From the argument of sine functions, the two terms correspond to [asciimath]n=1[/asciimath] and [asciimath]n=5[/asciimath] respectively, and that [asciimath]B_1=6[/asciimath] and [asciimath]B_5=7[/asciimath]. All the other coefficients are zero.
Therefore, the solution to the heat flow problem is
[asciimath]u(x,t)=sum_(n=1)^oo B_n e^(-beta^2(npi//L)^2t)sin((npix)/L)[/asciimath]
[asciimath]u(x,t)=B_1e^(-5((1)pi//pi)^2t)sin(((1)pix)/pi) +B_5e^(-5((5)pi//pi)^2t)sin(((5)pix)/pi)[/asciimath]
[asciimath]u(x,t)=6e^(-5t)sin(x) +7e^(-125 t)sin(5x)[/asciimath]
Try an Example
Find the solution to the initial boundary value heat flow problem
[asciimath](delu)/(delt)(x,t)=9(del^2u)/(delx^2)(x,t) \ ,[/asciimath] [asciimath]0ltxlt4,[/asciimath] [asciimath]tgt0[/asciimath]
[asciimath]u(0,t)=u(4,t)=0\ ,[/asciimath] [asciimath]t>0[/asciimath]
[asciimath]u(x,0)=x[/asciimath] [asciimath]0<=x<=4[/asciimath]
Show/Hide Solution
Comparing the equation with Equation 7.3.1, we see that [asciimath]beta=3[/asciimath], [asciimath]L=4[/asciimath], and [asciimath]f(x)=x[/asciimath]. Unlike the previous example, the initial condition function is not similar to eigenfunctions (sine functions). Therefore, we first need to find [asciimath]B_n[/asciimath] using 7.3.3.
[asciimath]B_n=2/Lint_0^Lf(x)sin((npix)/L)dx[/asciimath]
[asciimath]B_n=2/4int_0^4xsin((npix)/4)dx[/asciimath]
By integration by parts, we have
[asciimath]B_n=[-2/(npi)xcos((npix)/4)]_0^4+2/(npi)int_0^4cos((npix)/4)dx[/asciimath]
[asciimath]=-8/(npi)cos(npi)+8/(n^2pi^2) sin(npi)[/asciimath]
[asciimath]=(-1)^(n+1)8/(npi)[/asciimath]
Thus the solution is
[asciimath]u(x,t)=sum_(n=1)^oo B_n e^(-beta^2(npi//L)^2t)sin((npix)/L)[/asciimath]
[asciimath]u(x,t)=8/(pi)sum_(n=1)^oo (-1)^(n+1)/n e^(-9(npi//4)^2t)sin((npix)/4)[/asciimath]
The figure below shows the partial sum of the solution [asciimath]u(x,t)[/asciimath].
Try an Example
D. Solution to Heat Equation with Neumann Boundary Conditions
Neumann Boundary Conditions specify the value of the derivative (gradient) of the temperature at the boundary, often representing insulated or adiabatic surfaces where no heat flow occurs. For instance, [asciimath](delu)/(delx)(0,t)=0[/asciimath] might represent one end of the rod being perfectly insulated.
To develop a solution for the heat equation with Neumann Boundary Conditions, we use the method of Separation of Variables.
Consider a uniform rod of length [asciimath]L[/asciimath] with both ends perfectly insulated (no heat flows in or out of the rod) and the temperature at both ends is kept constant. The heat equation in one dimension is
[asciimath]frac{partial u}{partial t} = beta^2 frac{partial^2 u}{partial x^2}[/asciimath]
For insulated ends, the derivative (gradient) of the temperature at the boundary is zero. Thus the boundary conditions are:
[asciimath]u_x(0, t) = 0 quad text{and} quad u_x(L, t) = 0[/asciimath]
The initial temperature distribution along the rod is given by
[asciimath]u(x, 0) = f(x)[/asciimath]
The solution to this boundary value problem is
[asciimath]u(x, t) = A_0+sum_{n=1}^{infty} A_n cos( frac{npi x}{L} ) e^{-beta^2 ( frac{npi}{L} )^2 t}[/asciimath] (7.3.4)
where
[asciimath]f(x) = A_0+sum_{n=1}^{infty} A_n cos( frac{npi x}{L} )[/asciimath]
is the Fourier cosine series of [asciimath]f(x)[/asciimath] on [asciimath][0,L][/asciimath] and coefficients [asciimath]A_0[/asciimath] and [asciimath]A_n[/asciimath] are given by
[asciimath]A_0 = frac{1}{L} int_{0}^{L} f(x) dx[/asciimath](7.3.5)
[asciimath]A_n = frac{2}{L} int_{0}^{L} f(x) cos(frac{npi x}{L}) dx[/asciimath] for [asciimath]n = 1, 2, 3, ldots[/asciimath](7.3.6)
Find the solution to the initial boundary value heat flow problem
[asciimath](delu)/(delt)(x,t)=4(del^2u)/(delx^2)(x,t) \ ,[/asciimath] [asciimath]0ltxlt2,[/asciimath] [asciimath]tgt0[/asciimath]
[asciimath]u_x(0,t)=u_x(2,t)=0\ ,[/asciimath] [asciimath]t>0[/asciimath]
[asciimath]u(x,0)=5x^2,[/asciimath] [asciimath]0<=x<=2[/asciimath]
Show/Hide Solution
Comparing the equation with Equation 7.3.1, we see that [asciimath]beta=2[/asciimath], [asciimath]L=2[/asciimath], and [asciimath]f(x)=5x^2[/asciimath]. We first need to find coefficients [asciimath]A_0[/asciimath] and [asciimath]A_n[/asciimath]. Using 7.3.5.
[asciimath]A_0 = frac{1}{L} int_{0}^{L} f(x) dx[/asciimath]
[asciimath]A_0 = frac{1}{2} int_{0}^{2} 5x^2 dx=5/2[x^3/3]_0^2=20/3[/asciimath]
Applying 7.3.6 to find [asciimath]A_n[/asciimath].
[asciimath]A_n = frac{2}{L} int_{0}^{L} f(x) cos(frac{npi x}{L}) dx[/asciimath]
[asciimath]A_n = int_{0}^{2} 5x^2 cos(frac{npi x}{2}) dx[/asciimath]
By integration by parts, we have
[asciimath]=[(10x^2)/(npi)sin((npix)/2)]_0^2-20/(npi) int_0^2 xsin((npix)/2 ) dx[/asciimath]
[asciimath]=[(10x^2)/(npi)sin((npix)/2)-80/(npi)^3((-npi)/2xcos((npix)/2)+sin((npix)/2))]_0^2[/asciimath]
[asciimath]=80/(n^2pi^2)cos(npi)[/asciimath]
Given [asciimath]cos(npi)=(-1)^n[/asciimath], [asciimath]A_n[/asciimath] is simplifies to
[asciimath]A_n=(80(-1)^(n))/(n^2pi^2)[/asciimath]
The general solution is then given by 7.3.4
[asciimath]u(x, t) = A_0+sum_{n=1}^{infty} A_n cos( frac{npi x}{L} ) e^{-beta^2 ( frac{npi}{L} )^2 t}[/asciimath]
[asciimath]=20/3+sum_{n=1}^{infty} (80(-1)^(n))/(n^2pi^2) cos( frac{npi x}{2} ) e^{-4 ( frac{npi}{2} )^2 t}[/asciimath]
The figure below shows the partial sum of the solution [asciimath]u(x,t)[/asciimath].
Try an Example
Section 7.3 Exercises
- Find the solution to the initial boundary value heat flow problem
[asciimath](delu)/(del t)=5 (del^2u)/(del x^2),[/asciimath] [asciimath]0ltxlt3, \ tgt0[/asciimath]
[asciimath]u(0,t)=u(3,t)=0,[/asciimath] [asciimath]t>0[/asciimath]
[asciimath]u(x,0)=6,[/asciimath] [asciimath]0 le x le 3[/asciimath]
Show/Hide Answer
[asciimath]u(x,t)=sum_(n=1)^oo(12(1-(-1)^n))/(npi)sin((npix)/3)e^(-5((npi)/3)^2t)[/asciimath]
- Find the solution to the initial boundary value heat flow problem
[asciimath](delu)/(delt)(x,t)=2(del^2u)/(delx^2)(x,t) \ ,[/asciimath] [asciimath]0ltxltpi, \ tgt0[/asciimath]
[asciimath]u(0,t)=u(pi,t)=0\ ,[/asciimath] [asciimath]t>0[/asciimath]
[asciimath]u(x,0)=-2sin(4x)-7sin(5x),[/asciimath] [asciimath]0<=x<=pi[/asciimath]
Show/Hide Answer
[asciimath]u(x,t)=-2 e^(-32t)sin(4x)-7 e^(-50t)sin(5x)[/asciimath]
- Find the solution to the initial boundary value heat flow problem
[asciimath](delu)/(delt)(x,t) =6 (del^2u)/(delx^2)(x,t) ,[/asciimath] [asciimath]0ltxlt3, \ tgt0[/asciimath]
[asciimath]u_x(0,t)= u_x(3,t)=0,[/asciimath] [asciimath]t>0[/asciimath]
[asciimath]u(x,0)=5 x^2,[/asciimath] [asciimath]0 le x le 3[/asciimath]
Show/Hide Answer
[asciimath]u(x,t)=15+sum_(n=1)^oo(180 (-1)^n)/(n^2 pi^2) cos((n pi x)/3) e^(-6((n pi)/ 3)^2 t)[/asciimath]