Skip to main content

Applied Mathematics

Section 7.5 Solution to the 1D Heat Equation

In this section we will investigate solving the 1D heat equation
\begin{equation*} \frac{1}{\kappa} \frac{\partial u}{\partial t} = \frac{\partial^2 u}{\partial {x}^2} \end{equation*}
with boundary conditions:
\begin{align*} \frac{\partial u}{\partial x} \biggr\vert_{x=0} \amp = 0 \amp \frac{\partial u}{\partial x} \biggr\vert_{x=L} \amp = 0 \end{align*}
indicating that the end are insulated and the initial condition is:
\begin{equation*} u(x,0) = f(x),\quad \text{if $0 < x < L$ } \end{equation*}
As with the wave equation, we use the technique of separation of variables. That is let \(u=X(x)T(t)\) to get:
\begin{align*} \frac{1}{\kappa} T' X \amp = T X'' \amp\amp \text{divide through by $XT$} \\ \frac{1}{\kappa} \frac{T'}{T} \amp = \frac{X''}{X} \end{align*}
since the left side only depends on \(t\) and the right side only depends on \(X\text{,}\) it must be that these must both equal only a constant, (call it \(-\lambda\)) therefore we get the two equations:
\begin{align*} \frac{1}{\kappa} \frac{T'}{T} \amp = -\lambda \amp \frac{X''}{X} = -\lambda \end{align*}
\begin{align*} T' + \kappa \lambda T \amp = 0 \amp X'' + \lambda X \amp = 0 \end{align*}
The boundary conditions for the second equation becomes:
\begin{equation*} X'(0)=X'(L)=0 \end{equation*}
This is a Sturm-Liouville problem that we saw in ExampleΒ 7.4.5 which has the solution:
\begin{align*} \lambda_n \amp = \frac{n^2 \pi^2}{L^2} \quad \text{$n=0,1,2,\ldots$} \\ X_n (x) \amp = \cos \frac{n \pi x}{L} \end{align*}
if \(n > 1\) and \(\lambda_n=0\) and \(X_n = 1\) is also a solution. The solution to \(T'+\kappa \lambda T = 0\) can be found by letting \(T= e^{at}\) and substituting in
\begin{equation*} a e^{at} + \kappa \lambda e^{at} = e^{at}(a + \kappa \lambda) = 0 \end{equation*}
\begin{equation*} a = - \kappa \lambda \end{equation*}
therefore the solution is
\begin{equation*} T_n = e^{-\kappa \lambda t} = e^{-(\kappa/L^2) n^2 \pi^2 t} \end{equation*}
A solution \(u_n(x,t)\) to the equation is
\begin{align*} u_n(x,t) \amp = X_n(x,t) T_n(x,t) \\ \amp = e^{-(\kappa/L^2) n^2 \pi^2 t} \cos \frac{n \pi x}{L} \end{align*}
and using the principle of superposition the general solution to the PDE with given boundary conditions is:
\begin{equation*} u = \sum_{n=0}^{\infty} C_n e^{-(\kappa/L^2) n^2 \pi^2 t} \cos \frac{n \pi x}{L} \end{equation*}
Next, the initial condition is:
\begin{equation*} u(x,0) = f(x) = \sum_{n=0}^{\infty} C_n \cos \frac{n \pi x}{L} \end{equation*}
and the coefficients can be found by the Sturm-Liouville theorem to get:
\begin{align*} C_0 \amp = \frac{1}{L} \int_0^L f(x) \, dx \\ C_n \amp = \frac{2}{L} \int_0^L f(x) \cos \frac{ n \pi x}{L} \, dx \end{align*}

Example 7.5.1.

Find the solution to the heat equation given above if the initial condition is:
\begin{equation*} f(x) = 1+\cos \frac{2\pi x}{L} \end{equation*}
Solution.
In this case, we need to find \(C_0\) and \(C_n\text{:}\)
\begin{align*} C_0 \amp = \frac{1}{L} \int_0^L (1+ \cos \frac{2\pi x}{L}) \, dx = 1 \\ C_n\amp = \frac{2}{L} \int_0^L \cos \frac{2\pi x}{L} \cos \frac{n \pi x}{L} \, dx \\ \amp = \begin{cases} 1 \amp \text{if $n=2$} \\ 0 \amp \text{otherwise} \end{cases} \end{align*}
So the solution to the PDE is:
\begin{equation*} u(x,t) = 1 + e^{-(\kappa/L^2) 4 \pi^2 t } \cos \frac{2\pi x}{L} \end{equation*}
To get a feeling for the solution, the following is a plot when \(\kappa=0.001\text{,}\) \(L=1\) for \(t=0,5,10,15\text{.}\)
Figure 7.5.2. A bar
The plot shows the temperature distribution for the initial case \(t=0\) and subsequent times. The temperature evens out as time increases and in the limit the temperature would be 1 throughout, which is the average initial temperature.