###### Exercise4.6.1

Verify the principle of superposition for the heat equation.

\(\require{cancel}\newcommand{\nicefrac}[2]{{{}^{#1}}\!/\!{{}_{#2}}}
\newcommand{\unitfrac}[3][\!\!]{#1 \,\, {{}^{#2}}\!/\!{{}_{#3}}}
\newcommand{\unit}[2][\!\!]{#1 \,\, #2}
\newcommand{\noalign}[1]{}
\newcommand{\qed}{\qquad \Box}
\newcommand{\lt}{<}
\newcommand{\gt}{>}
\newcommand{\amp}{&}
\)

*2 lectures, §9.5 in [EP], §10.5 in [BD]*

Let us recall that a *partial differential equation* or *PDE* is an equation containing the partial derivatives with respect to *several* independent variables. Solving PDEs will be our main application of Fourier series.

A PDE is said to be *linear* if the dependent variable and its derivatives appear at most to the first power and in no functions. We will only talk about linear PDEs. Together with a PDE, we usually specify some *boundary conditions*, where the value of the solution or its derivatives is given along the boundary of a region, and/or some *initial conditions* where the value of the solution or its derivatives is given for some initial time. Sometimes such conditions are mixed together and we will refer to them simply as *side conditions*.

We will study three specific partial differential equations, each one representing a more general class of equations. First, we will study the *heat equation*, which is an example of a *parabolic PDE*. Next, we will study the *wave equation*, which is an example of a *hyperbolic PDE*. Finally, we will study the *Laplace equation*, which is an example of an *elliptic PDE*. Each of our examples will illustrate behavior that is typical for the whole class.

Let us first study the heat equation. Suppose that we have a wire (or a thin metal rod) of length \(L\) that is insulated except at the endpoints. Let \(x\) denote the position along the wire and let \(t\) denote time. See Figure 5.6.1.

Let \(u(x,t)\) denote the temperature at point \(x\) at time \(t\text{.}\) The equation governing this setup is the so-called *one-dimensional heat equation*:

\begin{equation*}
\boxed{~~
\frac{\partial u}{\partial t} =
k \frac{\partial^2 u}{\partial x^2} ,
~~}
\end{equation*}

where \(k > 0\) is a constant (the *thermal conductivity* of the material). That is, the change in heat at a specific point is proportional to the second derivative of the heat along the wire. This makes sense; if at a fixed \(t\) the graph of the heat distribution has a maximum (the graph is concave down), then heat flows away from the maximum. And vice-versa.

We will generally use a more convenient notation for partial derivatives. We will write \(u_t\) instead of \(\frac{\partial u}{\partial t}\text{,}\) and we will write \(u_{xx}\) instead of \(\frac{\partial^2 u}{\partial x^2}\text{.}\) With this notation the heat equation becomes

\begin{equation*}
u_t = k u_{xx} .
\end{equation*}

For the heat equation, we must also have some boundary conditions. We assume that the ends of the wire are either exposed and touching some body of constant heat, or the ends are insulated. For example, if the ends of the wire are kept at temperature 0, then the conditions are

\begin{equation*}
u(0,t) = 0 \qquad \text{and} \qquad u(L,t) = 0.
\end{equation*}

If, on the other hand, the ends are also insulated, the conditions are

\begin{equation*}
u_x(0,t) = 0 \qquad \text{and} \qquad
u_x(L,t) = 0 .
\end{equation*}

In other words, heat is not flowing in nor out of the wire at the ends. We always have two conditions along the \(x\) axis as there are two derivatives in the \(x\) direction. These side conditions are said to be *homogeneous* (that is, \(u\) or a derivative of \(u\) is set to zero).

We also need an initial condition—the temperature distribution at time \(t=0\text{.}\) That is,

\begin{equation*}
u(x,0) = f(x) ,
\end{equation*}

for some known function \(f(x)\text{.}\) This initial condition is not a homogeneous side condition.

The heat equation is linear as \(u\) and its derivatives do not appear to any powers or in any functions. Thus the principle of superposition still applies for the heat equation (without side conditions). If \(u_1\) and \(u_2\) are solutions and \(c_1\text{,}\) \(c_2\) are constants, then \(u = c_1 u_1 + c_2 u_2\) is also a solution.

Verify the principle of superposition for the heat equation.

Superposition also preserves some of the side conditions. In particular, if \(u_1\) and \(u_2\) are solutions that satisfy \(u(0,t) = 0\) and \(u(L,t) = 0\text{,}\) and \(c_1\text{,}\) \(c_2\) are constants, then \(u = c_1 u_1 + c_2 u_2\) is still a solution that satisfies \(u(0,t) = 0\) and \(u(L,t) = 0\text{.}\) Similarly for the side conditions \(u_x(0,t) = 0\) and \(u_x(L,t) = 0\text{.}\) In general, superposition preserves all homogeneous side conditions.

The method of *separation of variables* is to try to find solutions that are sums or products of functions of one variable. For example, for the heat equation, we try to find solutions of the form

\begin{equation*}
u(x,t) = X(x)T(t) .
\end{equation*}

That the desired solution we are looking for is of this form is too much to hope for. What is perfectly reasonable to ask, however, is to find enough “building-block” solutions of the form \(u(x,t) = X(x)T(t)\) using this procedure so that the desired solution to the PDE is somehow constructed from these building blocks by the use of superposition.

Let us try to solve the heat equation

\begin{equation*}
u_t = k u_{xx}
\qquad \text{with} \quad
u(0,t) = 0 ,\quad \quad u(L,t) = 0,
\quad \text{and} \quad u(x,0) = f(x) .
\end{equation*}

Let us guess \(u(x,t) = X(x)T(t)\text{.}\) We plug into the heat equation to obtain

\begin{equation*}
X(x)T'(t) = k X''(x)T(t) .
\end{equation*}

We rewrite as

\begin{equation*}
\frac{T'(t)}{k T(t)} =
\frac{X''(x)}{X(x)} .
\end{equation*}

This equation must hold for all \(x\) and all \(t\text{.}\) But the left hand side does not depend on \(x\) and the right hand side does not depend on \(t\text{.}\) Hence, each side must be a constant. Let us call this constant \(-\lambda\) (the minus sign is for convenience later). We obtain the two equations

\begin{equation*}
\frac{T'(t)}{k T(t)} = -\lambda =
\frac{X''(x)}{X(x)} .
\end{equation*}

In other words

\begin{equation*}
\begin{aligned}
X''(x) + \lambda X(x) &= 0 , \\
T'(t) + \lambda k T(t) &= 0 .
\end{aligned}
\end{equation*}

The boundary condition \(u(0,t) = 0\) implies \(X(0)T(t) = 0\text{.}\) We are looking for a nontrivial solution and so we can assume that \(T(t)\) is not identically zero. Hence \(X(0) = 0\text{.}\) Similarly, \(u(L,t) = 0\) implies \(X(L) = 0\text{.}\) We are looking for nontrivial solutions \(X\) of the eigenvalue problem \(X'' + \lambda X = 0\text{,}\) \(X(0) = 0\text{,}\) \(X(L) = 0\text{.}\) We have previously found that the only eigenvalues are \(\lambda_n = \frac{n^2 \pi^2}{L^2}\text{,}\) for integers \(n \geq 1\text{,}\) where eigenfunctions are \(\sin \left(\frac{n \pi}{L} \, x\right)\text{.}\) Hence, let us pick the solutions

\begin{equation*}
X_n (x) = \sin \left(\frac{n \pi}{L} \, x \right) .
\end{equation*}

The corresponding \(T_n\) must satisfy the equation

\begin{equation*}
T_n'(t) + \frac{n^2 \pi^2}{L^2} k T_n(t) = 0 .
\end{equation*}

By the method of integrating factor, the solution of this problem is

\begin{equation*}
T_n(t) = e^{\frac{-n^2 \pi^2}{L^2} k t} .
\end{equation*}

It will be useful to note that \(T_n(0) = 1\text{.}\) Our building-block solutions are

\begin{equation*}
u_n(x,t) = X_n(x)T_n(t) =
\sin \left( \frac{n \pi}{L} \, x \right)
\, e^{\frac{-n^2 \pi^2}{L^2} k t} .
\end{equation*}

We note that \(u_n(x,0) = \sin \left( \frac{n \pi}{L} \, x \right)\text{.}\) Let us write \(f(x)\) as the sine series

\begin{equation*}
f(x) = \sum_{n=1}^\infty b_n \sin \left(\frac{n \pi}{L} \, x \right) .
\end{equation*}

That is, we find the Fourier series of the odd periodic extension of \(f(x)\text{.}\) We used the sine series as it corresponds to the eigenvalue problem for \(X(x)\) above. Finally, we use superposition to write the solution as

\begin{equation*}
\boxed{~~
u(x,t) =
\sum_{n=1}^\infty
b_n
u_n(x,t)
=
\sum_{n=1}^\infty
b_n
\sin \left( \frac{n \pi}{L} \, x \right)
\, e^{\frac{-n^2 \pi^2}{L^2} k t} .
~~}
\end{equation*}

Why does this solution work? First note that it is a solution to the heat equation by superposition. It satisfies \(u(0,t) = 0\) and \(u(L,t) = 0\text{,}\) because \(x=0\) or \(x=L\) makes all the sines vanish. Finally, plugging in \(t=0\text{,}\) we notice that \(T_n(0) = 1\) and so

\begin{equation*}
u(x,0) =
\sum_{n=1}^\infty
b_n
u_n(x,0)
=
\sum_{n=1}^\infty
b_n
\sin \left( \frac{n \pi}{L} \, x \right)
=
f(x) .
\end{equation*}

Suppose that we have an insulated wire of length 1, such that the ends of the wire are embedded in ice (temperature 0). Let \(k=0.003\text{.}\) Then suppose that initial heat distribution is \(u(x,0) = 50\,x\,(1-x)\text{.}\) See Figure 5.6.4.

We want to find the temperature function \(u(x,t)\text{.}\) Let us suppose we also want to find when (at what \(t\)) does the maximum temperature in the wire drop to one half of the initial maximum of 12.5.

We are solving the following PDE problem:

\begin{equation*}
\begin{aligned}
& u_t = 0.003 \, u_{xx} , \\
& u(0,t) = u(1,t) = 0 , \\
& u(x,0) = 50\,x\,(1-x) \qquad \text{for } \; 0 < x < 1 .
\end{aligned}
\end{equation*}

We write \(f(x) = 50\,x\,(1-x)\) for \(0 < x < 1\) as a sine series. That is, \(f(x) = \sum_{n=1}^\infty b_n \sin (n \pi x) ,\) where

\begin{equation*}
b_n = 2 \int_0^1 50\,x\,(1-x) \sin (n \pi x) ~dx
=
\frac{200}{{\pi }^{3}{n}^{3}}-\frac{200\,{\left( -1\right) }^{n}}{{\pi }^{3}{n}^{3}}
=
\begin{cases}
0 & \text{if } n \text{ even} , \\
\frac{400}{\pi^3 n^3} & \text{if } n \text{ odd} .
\end{cases}
\end{equation*}

The solution \(u(x,t)\text{,}\) plotted in Figure 5.6.5 for \(0 \leq t \leq 100\text{,}\) is given by the series:

\begin{equation*}
u(x,t) =
\sum_{\substack{n=1 \\ n \text{ odd}}}^\infty
\frac{400}{\pi^3 n^3}
\sin (n \pi x )
\, e^{-n^2 \pi^2 \, 0.003 \, t} .
\end{equation*}

Finally, let us answer the question about the maximum temperature. It is relatively easy to see that the maximum temperature will always be at \(x=0.5\text{,}\) in the middle of the wire. The plot of \(u(x,t)\) confirms this intuition.

If we plug in \(x=0.5\) we get

\begin{equation*}
u(0.5,t) =
\sum_{\substack{n=1 \\ n \text{ odd}}}^\infty
\frac{400}{\pi^3 n^3}
\sin (n \pi\, 0.5 )
\, e^{-n^2 \pi^2 \, 0.003 \, t} .
\end{equation*}

For \(n=3\) and higher (remember \(n\) is only odd), the terms of the series are insignificant compared to the first term. The first term in the series is already a very good approximation of the function. Hence

\begin{equation*}
u(0.5,t) \approx
\frac{400}{\pi^3}
\, e^{-\pi^2 \, 0.003 \, t} .
\end{equation*}

The approximation gets better and better as \(t\) gets larger as the other terms decay much faster. Let us plot the function \(u(0.5,t)\text{,}\) the temperature at the midpoint of the wire at time \(t\text{,}\) in Figure 5.6.6. The figure also plots the approximation by the first term.

After \(t=5\) or so it would be hard to tell the difference between the first term of the series for \(u(x,t)\) and the real solution \(u(x,t)\text{.}\) This behavior is a general feature of solving the heat equation. If you are interested in behavior for large enough \(t\text{,}\) only the first one or two terms may be necessary.

Let us get back to the question of when is the maximum temperature one half of the initial maximum temperature. That is, when is the temperature at the midpoint \(\nicefrac{12.5}{2} = 6.25\text{.}\) We notice on the graph that if we use the approximation by the first term we will be close enough. We solve

\begin{equation*}
6.25 =
\frac{400}{\pi^3}
\, e^{-\pi^2 \, 0.003 \, t} .
\end{equation*}

That is,

\begin{equation*}
t =
\frac{\ln \frac{6.25\,\pi^3}{400}}{-\pi^2 0.003}
\approx 24.5 .
\end{equation*}

So the maximum temperature drops to half at about \(t=24.5\text{.}\)

We mention an interesting behavior of the solution to the heat equation. The heat equation “smoothes” out the function \(f(x)\) as \(t\) grows. For a fixed \(t\text{,}\) the solution is a Fourier series with coefficients \(b_n e^{\frac{-n^2 \pi^2}{L^2} k t}\text{.}\) If \(t > 0\text{,}\) then these coefficients go to zero faster than any \(\frac{1}{n^p}\) for any power \(p\text{.}\) In other words, the Fourier series has infinitely many derivatives everywhere. Thus even if the function \(f(x)\) has jumps and corners, then for a fixed \(t > 0\text{,}\) the solution \(u(x,t)\) as a function of \(x\) is as smooth as we want it to be.

Now suppose the ends of the wire are insulated. In this case, we are solving the equation

\begin{equation*}
u_t = k u_{xx}
\qquad \text{with} \quad
u_x(0,t) = 0, \quad u_x(L,t) = 0,
\quad \text{and} \quad u(x,0) = f(x) .
\end{equation*}

Yet again we try a solution of the form \(u(x,t) = X(x)T(t)\text{.}\) By the same procedure as before we plug into the heat equation and arrive at the following two equations

\begin{equation*}
\begin{aligned}
X''(x) + \lambda X(x) &= 0 , \\
T'(t) + \lambda k T(t) &= 0 .
\end{aligned}
\end{equation*}

At this point the story changes slightly. The boundary condition \(u_x(0,t) = 0\) implies \(X'(0)T(t) = 0\text{.}\) Hence \(X'(0) = 0\text{.}\) Similarly, \(u_x(L,t) = 0\) implies \(X'(L) = 0\text{.}\) We are looking for nontrivial solutions \(X\) of the eigenvalue problem \(X'' + \lambda X = 0\text{,}\) \(X'(0) = 0\text{,}\) \(X'(L) = 0\text{.}\) We have previously found that the only eigenvalues are \(\lambda_n = \frac{n^2 \pi^2}{L^2}\text{,}\) for integers \(n \geq 0\text{,}\) where eigenfunctions are \(\cos \left( \frac{n \pi}{L} \, x\right)\) (we include the constant eigenfunction). Hence, let us pick solutions

\begin{equation*}
X_n (x) = \cos \left( \frac{n \pi}{L} \, x \right)
\qquad \text{and} \qquad
X_0 (x) = 1.
\end{equation*}

The corresponding \(T_n\) must satisfy the equation

\begin{equation*}
T_n'(t) + \frac{n^2 \pi^2}{L^2} k T_n(t) = 0 .
\end{equation*}

For \(n \geq 1\text{,}\) as before,

\begin{equation*}
T_n(t) = e^{\frac{-n^2 \pi^2}{L^2} k t} .
\end{equation*}

For \(n = 0\text{,}\) we have \(T_0'(t) = 0\) and hence \(T_0(t) = 1\text{.}\) Our building-block solutions will be

\begin{equation*}
u_n(x,t) = X_n(x)T_n(t) =
\cos \left( \frac{n \pi}{L} \, x \right)
\, e^{\frac{-n^2 \pi^2}{L^2} k t} ,
\end{equation*}

and

\begin{equation*}
u_0(x,t) = 1 .
\end{equation*}

We note that \(u_n(x,0) = \cos \left( \frac{n \pi}{L} \, x \right)\text{.}\) Let us write \(f\) using the cosine series

\begin{equation*}
f(x) = \frac{a_0}{2} + \sum_{n=1}^\infty a_n \cos \left( \frac{n \pi}{L} \, x
\right) .
\end{equation*}

That is, we find the Fourier series of the even periodic extension of \(f(x)\text{.}\)

We use superposition to write the solution as

\begin{equation*}
\boxed{~~
u(x,t) =
\frac{a_0}{2} +
\sum_{n=1}^\infty
a_n
u_n(x,t)
=
\frac{a_0}{2} +
\sum_{n=1}^\infty
a_n
\cos \left( \frac{n \pi}{L} \, x \right)
\, e^{\frac{-n^2 \pi^2}{L^2} k t} .
~~}
\end{equation*}

Let us try the same equation as before, but for insulated ends. We are solving the following PDE problem

\begin{equation*}
\begin{aligned}
& u_t = 0.003 \, u_{xx} , \\
& u_x(0,t) = u_x(1,t) = 0 , \\
& u(x,0) = 50\,x\,(1-x) \qquad \text{for } \; 0 < x < 1 .
\end{aligned}
\end{equation*}

For this problem, we must find the cosine series of \(u(x,0)\text{.}\) For \(0 < x < 1\) we have

\begin{equation*}
50\, x\,(1-x)
=
\frac{25}{3} +
\sum_{\substack{n=2 \\ n \text{ even}}}^\infty
\left( \frac{-200}{\pi^2 n^2} \right) \,
\cos (n \pi x) .
\end{equation*}

The calculation is left to the reader. Hence, the solution to the PDE problem, plotted in Figure 5.6.8, is given by the series

\begin{equation*}
u(x,t)
=
\frac{25}{3} +
\sum_{\substack{n=2 \\ n \text{ even}}}^\infty
\left( \frac{-200}{\pi^2 n^2} \right) \,
\cos ( n \pi x)
\, e^{-n^2 \pi^2 \, 0.003 \, t} .
\end{equation*}

Note in the graph that the temperature evens out across the wire. Eventually, all the terms except the constant die out, and you will be left with a uniform temperature of \(\frac{25}{3} \approx 8.33\) along the entire length of the wire.

Imagine you have a wire of length 2, with \(k=0.001\) and an initial temperature distribution of \(u(x,0) = 50 x\text{.}\) Suppose that both the ends are embedded in ice (temperature 0). Find the solution as a series.

Find a series solution of

\begin{equation*}
\begin{aligned}
& u_t = u_{xx} , \\
& u(0,t) = u(1,t) = 0 , \\
& u(x,0) = 100 \qquad \text{for } \; 0 < x < 1 .
\end{aligned}
\end{equation*}

Find a series solution of

\begin{equation*}
\begin{aligned}
& u_t = u_{xx} , \\
& u_x(0,t) = u_x(\pi,t) = 0 , \\
& u(x,0) = 3\cos (x) + \cos (3x) \qquad \text{for } \; 0 < x < \pi .
\end{aligned}
\end{equation*}

Find a series solution of

\begin{equation*}
\begin{aligned}
& u_t = \frac{1}{3} \, u_{xx} , \\
& u_x(0,t) = u_x(\pi,t) = 0 , \\
& u(x,0) = \frac{10x}{\pi} \qquad \text{for } \; 0 < x < \pi .
\end{aligned}
\end{equation*}

Find a series solution of

\begin{equation*}
\begin{aligned}
& u_t = u_{xx} , \\
& u(0,t) = 0 , \quad u(1,t) = 100 , \\
& u(x,0) = \sin (\pi x) \qquad \text{for } \; 0 < x < 1 .
\end{aligned}
\end{equation*}

Hint: Use the fact that \(u(x,t) = 100 x\) is a solution satisfying \(u_t = u_{xx}\text{,}\) \(u(0,t) = 0\text{,}\) \(u(1,t) = 100\text{.}\) Then use superposition.

Find the *steady state temperature* solution as a function of \(x\) alone, by letting \(t \to
\infty\) in the solution from exercises Exercise 4.6.5 and Exercise 4.6.6. Verify that it satisfies the equation \(u_{xx} = 0\text{.}\)

Use separation variables to find a nontrivial solution to \(u_{xx} + u_{yy} = 0\text{,}\) where \(u(x,0) = 0\) and \(u(0,y) = 0\text{.}\) Hint: Try \(u(x,y) = X(x)Y(y)\text{.}\)

*(challenging)* Suppose that one end of the wire is insulated (say at \(x=0\)) and the other end is kept at zero temperature. That is, find a series solution of

\begin{equation*}
\begin{aligned}
& u_t = k u_{xx} , \\
& u_x(0,t) = u(L,t) = 0 , \\
& u(x,0) = f(x) \qquad \text{for } \; 0 < x < L .
\end{aligned}
\end{equation*}

Express any coefficients in the series by integrals of \(f(x)\text{.}\)

*(challenging)* Suppose that the wire is circular and insulated, so there are no ends. You can think of this as simply connecting the two ends and making sure the solution matches up at the ends. That is, find a series solution of

\begin{equation*}
\begin{aligned}
& u_t = k u_{xx} , \\
& u(0,t) = u(L,t) , \qquad
u_x(0,t) = u_x(L,t) , \\
& u(x,0) = f(x) \qquad \text{for } \; 0 < x < L .
\end{aligned}
\end{equation*}

Express any coefficients in the series by integrals of \(f(x)\text{.}\)

Find a series solution of

\begin{equation*}
\begin{aligned}
& u_t = 3 u_{xx} , \\
& u(0,t) = u(\pi,t) = 0 , \\
& u(x,0) = 5\sin (x) + 2\sin (5x) \qquad \text{for } \; 0 < x < \pi .
\end{aligned}
\end{equation*}

Answer

\(u(x,t) = 5 \sin (x) \, e^{- 3 t} + 2 \sin (5x) \, e^{-75 t}\)

Find a series solution of

\begin{equation*}
\begin{aligned}
& u_t = 0.1 u_{xx} , \\
& u_x(0,t) = u_x(\pi,t) = 0 , \\
& u(x,0) = 1 + 2\cos (x) \qquad \text{for } \; 0 < x < \pi .
\end{aligned}
\end{equation*}

Answer

\(u(x,t) = 1 + 2 \cos (x) \, e^{-0.1 t}\)

Use separation of variables to find a nontrivial solution to \(u_{xt} = u_{xx}\text{.}\)

Answer

\(u(x,t) = e^{\lambda t} e^{\lambda x}\) for some \(\lambda\)

Use separation of variables (Hint: try \(u(x,t) = X(x)+T(t)\)) to find a nontrivial solution to \(u_{x} + u_{t} = u\text{.}\)

Answer

\(u(x,t) = Ae^x + Be^t\)