Chapter 1 The heat equation on an interval

Consider the initial-boundary value problem for the partial differential equation (this PDE is called the heat equation)

\begin{equation} \label {eq:heat1} \partial _t u=\partial _{xx}u,\qquad u(t,0)=u(t,L)=0,\qquad u(0,x)=u^0(x), \end{equation}

where the length of the spatial interval \(L>0\) is given, the initial condition \(u^0:[0,L]\to \mR \) is given and \(u:[0,\infty )\!\!\phantom {]}\times [0,L]\to \mR \) is to be found. Here \(\partial _tu\) is notation for the partial derivative of \(u\) with respect \(t\) (which we interpret as time) and \(\partial _{xx}u\) is notation for the second partial derivative of \(u\) with respect to \(x\) (which we interpret as the one-dimensional spatial variable).

We first consider only the differential equation and ignore the boundary and initial conditions. We look for a solution \(u\) where the variables are separated, i.e.

\[ u(t,x)=T(t)X(x). \]

Substituting this Ansatz into the differential equation gives

\[ T'X=TX''. \]

Dividing by \(TX\) gives

\[ \frac {T'}{T}=\frac {X''}{X}. \]

Since the left-hand side depends only on \(t\) and the right-hand side depends only on \(x\), both sides must in fact be independent of both \(t\) and \(x\), i.e. there exists a constant \(\lambda \) such that

\[ \frac {T'}{T}=\lambda =\frac {X''}{X}, \]

or written differently

\[ T'=\lambda T,\qquad X''=\lambda X. \]

Substituting the Ansatz into the boundary conditions gives

\[ T(t)X(0)=0,\qquad T(t)X(L)=0. \]

Therefore the boundary conditions are satisfied if (and unless \(T=0\) only if)

\[ X(0)=0,\qquad X(L)=0. \]

We therefore consider the ODE boundary value problem

\begin{equation} \label {eq:Dirichlet} X''=\lambda X,\qquad X(0)=0,\qquad X(L)=0. \end{equation}

If \(\lambda =0\), then the general solution of the ODE is \(X(x)=A+Bx\) for some \(A,B\in \mR \). Imposing the boundary conditions leads first to \(A=0\) and then to \(BL=0\), which gives \(B=0\). Hence if \(\lambda =0\), we obtain only the (trivial) zero solution. It can similarly be shown that for \(\lambda >0\) we obtain only the zero solution. Hence we assume that \(\lambda <0\) and write \(\lambda =-\omega ^2\) with \(\omega >0\). Our ODE boundary value problem then is

\[ X''=-\omega ^2 X,\qquad X(0)=0,\qquad X(L)=0. \]

The general solution of the ODE is

\[ X(x)=A\cos (\omega x)+B\sin (\omega x). \]

Imposing the boundary condition \(X(0)=0\) gives \(A=0\) and subsequently imposing the boundary condition \(X(L)=0\) gives \(B\sin (\omega L)=0\). Since we want \(B\neq 0\) to obtain a non-trivial (i.e. non-zero) solution, we must have

\[ \sin (\omega L)=0, \]

i.e. \(\omega L\) must be a zero of the sine. Since we explicitly know the zeros of the sine, we obtain

\[ \omega _k=\frac {k\pi }{L},\qquad k\in \mN . \]

This leads to the countably many solutions

\[ X_k(x)=\sqrt {\frac {2}{L}}\sin \left (\frac {k\pi x}{L}\right ). \]

Here we have chosen \(B=\sqrt {\frac {2}{L}}\) so as to ensure

\[ \int _0^L X_k(x)^2\,dx=1, \]

which is a convenient normalization. Note that we have

\[ \lambda _k=-\left (\frac {k\pi }{L}\right )^2. \]

Now knowing what \(\lambda \) is, we return to the differential equation for \(T\):

\[ T_k'=\lambda _k T_k, \]

which has general solution

\[ T_k(t)=C_k\e ^{\lambda _kt}. \]

We therefore obtain the solutions

\[ u_k(t,x)=C_k\e ^{\lambda _kt}\sqrt {\frac {2}{L}}\sin \left (\frac {k\pi x}{L}\right ). \]

It remains to satisfy the initial condition \(u(0,x)=u^0(x)\). Unless \(u^0\) happens to be a multiple of \(X_k\) for some \(k\in \mN \), the above separated solutions will not satisy this. The solution to this conundrum is to consider the sum of these separated solutions (which by linearity will also satisfy the differential equation and the boundary conditions, at least if we ignore any issues arising from the sum being infinite):

\[ u(t,x)=\sum _{k=1}^\infty C_k\e ^{\lambda _kt}\sqrt {\frac {2}{L}}\sin \left (\frac {k\pi x}{L}\right ). \]

The initial condition \(u(0,x)=u^0(x)\) then becomes (this should be seen as an equation in the unknowns \(C_k\))

\begin{equation} \label {eq:MA23:u0} u^0(x)=\sum _{k=1}^\infty C_k\sqrt {\frac {2}{L}}\sin \left (\frac {k\pi x}{L}\right ). \end{equation}

We obtain the coefficients \(C_k\) as follows. We multiply (1.3) by \(X_m\) and integrate over \([0,L]\) to obtain (interchanging integration and summation)

\[ \int _0^L u^0(x)\sqrt {\frac {2}{L}}\sin \left (\frac {m\pi x}{L}\right )\,dx = \sum _{k=1}^\infty C_k \int _0^L \sqrt {\frac {2}{L}}\sin \left (\frac {k\pi x}{L}\right )\sqrt {\frac {2}{L}}\sin \left (\frac {m\pi x}{L}\right )\,dx, \]

and then use that (this is orthonormality)

\[ \int _0^L \sqrt {\frac {2}{L}}\sin \left (\frac {k\pi x}{L}\right )\sqrt {\frac {2}{L}}\sin \left (\frac {m\pi x}{L}\right )\,dx = \begin {cases} 1&k=m\\ 0&k\neq m, \end {cases} \]

to obtain

\[ \int _0^L u^0(x)\sqrt {\frac {2}{L}}\sin \left (\frac {m\pi x}{L}\right )\,dx=C_m, \]

which gives us the desired formula for the coefficients \(C_m\).

1.1 The role of the boundary conditions

We comment on the role of the boundary conditions for the ODE boundary value problem (1.2) (since this issue will be important later for other ODE boundary value problems which are more difficult). The ODE \(X''=\lambda X\) for each \(\lambda \in \mC \) has a two-dimensional space of solutions (this follows for example from MA20220 ODEs and Control). The boundary condition \(X(0)=0\) picks out a one-dimensional subspace of solutions (the cosine is excluded by the boundary condition). The boundary condition \(X(L)=0\) subsequently restricts the possible \(\lambda \) to the countable set \(-(k\pi /L)^2\) with \(k\in \mN \).