---
title: "Separation of Variables: Heat, Wave, and Laplace Equations"
module: PDEs, Fourier Series, and Boundary Value Problems
moduleNumber: 9
lessonNumber: 2
order: 902
summary: >
  Separation of variables replaces a partial differential equation by a pair of
  ordinary ones joined through a shared separation constant. Applied to the heat
  equation it produces the eigenvalue problem X'' + lambda X = 0, and the solution
  assembles as a Fourier series in the eigenfunctions. The same steps solve the
  wave equation, whose modes are standing waves, and Laplace's equation, the
  steady-state limit posed on a region rather than an interval.
topics: [PDEs, Fourier Series, and Boundary Value Problems]
sources:
  - book: Boyce
    ref: "Ch. 10 §10.5 Separation of Variables; Heat Conduction in a Rod; §10.6 Other Heat Conduction Problems; §10.7 The Wave Equation; §10.8 Laplace's Equation"
  - book: Simmons
    ref: "Ch. 7 §40 The Vibrating String; §41 The Heat Equation; §42 The Dirichlet Problem for a Circle"
draft: false
---

Three second-order linear partial differential equations organize most of
mathematical physics, one for each way a field can evolve in space and time.

- **Heat equation**, $\alpha^2 u_{xx} = u_t$: diffusive processes that smooth
  and decay.
- **Wave equation**, $a^2 u_{xx} = u_{tt}$: oscillatory processes that
  propagate without loss.
- **Laplace's equation**, $u_{xx} + u_{yy} = 0$: steady states, the
  time-independent limit of the other two.

One method solves all three. Separation of variables, used by d'Alembert,
Daniel Bernoulli, and Euler around 1750, replaces the partial differential
equation with ordinary differential equations whose solutions a
[Fourier series](/differential-equations/pdes-fourier-bvp/fourier-series)
reassembles.

## Heat conduction in a rod

Take a uniform bar of length $L$ with insulated sides, so temperature $u(x,t)$
depends only on position and time. It satisfies

$$
\alpha^2 u_{xx} = u_t, \qquad 0 < x < L, \quad t > 0,
$$

where the **thermal diffusivity** $\alpha^2 = \kappa/(\rho s)$ collects the
conductivity, density, and specific heat.[^boyce-105] The ends are held at zero
temperature and the initial profile is prescribed:

$$
u(0,t) = 0, \quad u(L,t) = 0, \qquad u(x,0) = f(x).
$$

This is an initial value problem in $t$ and a boundary value problem in $x$: one
condition at each end of the bar, one condition at the start of time.

### The separation argument

Look for solutions that are a product of a function of $x$ alone and a function
of $t$ alone,

$$
u(x,t) = X(x)\,T(t).
$$

Substituting into $\alpha^2 u_{xx} = u_t$ gives $\alpha^2 X''T = XT'$. Divide by
$\alpha^2 XT$:

$$
\frac{X''}{X} = \frac{1}{\alpha^2}\frac{T'}{T}.
$$

The left side depends only on $x$, the right only on $t$. For two functions of
independent variables to be equal everywhere, both must equal the same
constant. Call it $-\lambda$. The single equation splits into two.

> **Definition (Separation constant).** When $u = XT$ separates a partial
> differential equation into $X''/X = (1/\alpha^2)(T'/T)$, the common value
> $-\lambda$ of the two sides is the **separation constant**. Its sign is fixed
> not by the algebra but by the boundary conditions, which select the values of
> $\lambda$ that admit nontrivial $X$.

$$
% caption: Separation of variables factors one partial differential equation
% into two ordinary ones linked only through the shared constant lambda; the
% boundary conditions act on $X$, the initial condition on the assembled sum.
\begin{tikzpicture}[>=stealth, font=\footnotesize,
  box/.style={draw, minimum width=30mm, minimum height=12mm, align=center}]
\definecolor{acc}{HTML}{4A6FA5}
\node[box] (pde) at (0,0) {heat PDE\\$u_t = a\,u_{xx}$};
\node[box] (assume) at (4.6,0) {$u = X(x)\,T(t)$};
\node[box] (xode) at (9.4,1.1) {space ODE\\in $X(x)$};
\node[box] (tode) at (9.4,-1.1) {time ODE\\in $T(t)$};
\draw[->, thick] (pde) -- (assume);
\draw[->, thick] (assume) -- (xode);
\draw[->, thick] (assume) -- (tode);
\node[acc] at (7.0,1.55) {shared constant};
\end{tikzpicture}
$$

### Solving the pieces

Substituting $u = XT$ into the boundary conditions forces $X(0) = 0$ and
$X(L) = 0$. The problem for $X$,

$$
X'' + \lambda X = 0, \qquad X(0) = 0, \quad X(L) = 0,
$$

is the eigenvalue problem with zero endpoints. Its eigenvalues and
eigenfunctions are

$$
\lambda_n = \frac{n^2\pi^2}{L^2}, \qquad X_n(x) = \sin\!\left(\frac{n\pi x}{L}\right), \qquad n = 1, 2, 3, \dots
$$

For each $\lambda_n$ the time equation $T' + \alpha^2\lambda_n T = 0$ gives
exponential decay, $T_n(t) \propto \exp(-n^2\pi^2\alpha^2 t/L^2)$. Multiplying
the two factors yields the **fundamental solutions**

$$
u_n(x,t) = e^{-n^2\pi^2\alpha^2 t/L^2}\sin\!\left(\frac{n\pi x}{L}\right),
$$

each satisfying the equation and both boundary conditions. Because the problem
is linear and homogeneous, any sum of them does too. Superpose them and choose
the weights to match the initial profile:

$$
u(x,t) = \sum_{n=1}^{\infty} c_n\, e^{-n^2\pi^2\alpha^2 t/L^2}\sin\!\left(\frac{n\pi x}{L}\right).
$$

At $t = 0$ the exponentials are $1$, so $u(x,0) = \sum c_n\sin(n\pi x/L) = f(x)$.
This is the Fourier sine series of $f$, and its coefficients are

$$
c_n = \frac{2}{L}\int_0^L f(x)\sin\!\left(\frac{n\pi x}{L}\right)\d x.
$$

Each harmonic decays at its own rate: the exponent grows like $n^2$, so high
modes vanish almost immediately and the profile smooths toward the fundamental,
then to zero. Diffusion erases the finest detail first.

> **Theorem (Series solution of the heat problem).** The heat conduction
> problem with zero-temperature ends and initial profile $f$ has the formal
> solution above, with $c_n$ the Fourier sine coefficients of $f$. The negative
> exponentials make the series and all its term-by-term derivatives converge
> for every $t > 0$, so the sum satisfies the equation; any discontinuity in
> $f$ is smoothed out instantly.[^boyce-106]

> **Worked example.** A rod of length $L = 50$ starts at a uniform $20$ degrees,
> its ends dropped to $0$ at $t = 0$. The initial profile is $f(x) = 20$, so the
> Fourier sine coefficients are
>
> $$
> c_n = \frac{2}{50}\int_0^{50} 20\sin\!\left(\frac{n\pi x}{50}\right)\d x
>     = \frac{40}{n\pi}\bigl(1 - \cos n\pi\bigr) =
> \begin{cases} 0, & n \text{ even},\\[2pt] \dfrac{80}{n\pi}, & n \text{ odd},\end{cases}
> $$
>
> and only the odd modes contribute:
>
> $$
> u(x,t) = \frac{80}{\pi}\sum_{n=1,3,5,\dots} \frac{1}{n}\, e^{-n^2\pi^2\alpha^2 t/2500}\sin\!\left(\frac{n\pi x}{50}\right).
> $$
>
> The $n^2$ in each exponent kills the high modes first. With $\alpha^2 = 1$ the
> center is warmest, and the one-term estimate $u(25,t) = 1$ gives
> $t = \tfrac{2500}{\pi^2}\ln(80/\pi) \approx 820$ seconds to cool the bar below
> one degree.

$$
% caption: Temperature profiles of a rod with zero-temperature ends at
% successive times. The initial box relaxes toward the fundamental sine and
% then decays uniformly to zero as heat leaves through the ends.
\begin{tikzpicture}[scale=1.0, >=stealth, font=\small]
\definecolor{acc}{HTML}{4A6FA5}
\draw[black, ->] (-0.2,0) -- (4.7,0) node[right, black!70] {$x$};
\draw[black, ->] (0,-0.2) -- (0,2.3) node[above, black!70] {$u$};
\draw[black, dashed] (4,0) -- (4,2.1);
\node[black!70, font=\footnotesize] at (4,-0.28) {$L$};
% t=0: near-flat box top, drops at ends
\draw[acc, thick] (0.03,0) -- (0.15,1.95) -- (3.85,1.95) -- (3.97,0);
\node[acc, font=\footnotesize] at (2,2.15) {$t=0$};
% t small: rounded
\draw[black, thick, domain=0:4, samples=80, smooth] plot (\x, {1.55*sin(45*\x)});
\node[black, font=\footnotesize] at (0.75,1.35) {$t_1$};
% t medium
\draw[black, thick, domain=0:4, samples=80, smooth] plot (\x, {0.95*sin(45*\x)});
\node[black, font=\footnotesize] at (3.3,0.75) {$t_2$};
% t large
\draw[black, thick, dashed, domain=0:4, samples=80, smooth] plot (\x, {0.45*sin(45*\x)});
\node[black, font=\footnotesize] at (2,0.28) {$t_3$};
\end{tikzpicture}
$$

## Nonhomogeneous ends and insulation

Two variations widen the method's reach, both reducing to the case just solved.

> **Worked example.** Hold the ends at fixed temperatures $T_1$ and $T_2$. The
> long-time **steady state** $v(x)$ satisfies $v'' = 0$ with $v(0) = T_1$,
> $v(L) = T_2$, the straight line
>
> $$
> v(x) = (T_2 - T_1)\frac{x}{L} + T_1.
> $$
>
> Write $u = v(x) + w(x,t)$. The transient $w$ obeys the homogeneous problem with
> zero ends and initial data $f(x) - v(x)$, so
>
> $$
> w(x,t) = \sum_{n=1}^{\infty} b_n\, e^{-n^2\pi^2\alpha^2 t/L^2}\sin\!\left(\frac{n\pi x}{L}\right), \qquad
> b_n = \frac{2}{L}\int_0^L \bigl(f(x) - v(x)\bigr)\sin\!\left(\frac{n\pi x}{L}\right)\d x.
> $$
>
> As $t \to \infty$ the transient decays and $u \to v(x)$, the linear profile.
> Subtracting the steady state to homogenize the boundary conditions is a general
> technique.

**Insulated ends.** No heat flows through an end when $u_x = 0$ there. The
boundary conditions $u_x(0,t) = u_x(L,t) = 0$ change the eigenvalue problem to
$X'(0) = X'(L) = 0$, whose eigenfunctions are cosines: $X_n(x) = \cos(n\pi x/L)$
for $n = 0, 1, 2, \dots$, including the constant $X_0 = 1$. The solution is a
Fourier cosine series,

$$
u(x,t) = \frac{c_0}{2} + \sum_{n=1}^{\infty} c_n\, e^{-n^2\pi^2\alpha^2 t/L^2}\cos\!\left(\frac{n\pi x}{L}\right),
$$

and the constant term $c_0/2 = \tfrac1L\int_0^L f\,\d x$ is the average initial
temperature, the value the insulated bar settles to since no heat escapes.

## The wave equation

The vibrating string carries the same eigenvalue problem but a different time
factor. Let $u(x,t)$ be the transverse displacement of a string of length $L$
stretched to tension $T$ with mass density $\rho$. Small motions obey

$$
a^2 u_{xx} = u_{tt}, \qquad a^2 = \frac{T}{\rho},
$$

with fixed ends $u(0,t) = u(L,t) = 0$. Being second order in time, the equation
needs two initial conditions, the shape and the velocity: $u(x,0) = f(x)$ and
$u_t(x,0) = g(x)$.[^boyce-107] Released from rest ($g = 0$), separation
$u = XT$ gives the same $X'' + \lambda X = 0$ with the same sine eigenfunctions,
but now $T'' + a^2\lambda T = 0$, whose solutions oscillate rather than decay.
With $T'(0) = 0$ the time factor is $\cos(n\pi at/L)$, and the fundamental
solutions are

$$
u_n(x,t) = \sin\!\left(\frac{n\pi x}{L}\right)\cos\!\left(\frac{n\pi at}{L}\right).
$$

> **Definition (Natural mode, natural frequency).** For a fixed-end string the
> spatial factor $\sin(n\pi x/L)$ is the $n$-th **natural mode**, a standing
> shape with $n$ half-waves and fixed nodes; it vibrates at the **natural
> frequency** $n\pi a/L$ with wavelength $2L/n$. The eigenvalues $n^2\pi^2/L^2$
> are the squares of these frequencies.

The general free motion superposes the modes,

$$
u(x,t) = \sum_{n=1}^{\infty} c_n \sin\!\left(\frac{n\pi x}{L}\right)\cos\!\left(\frac{n\pi at}{L}\right),
$$

with $c_n$ the Fourier sine coefficients of the initial shape $f$. These are the
harmonics of a plucked string; the fundamental sets the pitch and the higher
modes the timbre, the same structure met in
[mechanical vibrations](/differential-equations/second-order-linear/mechanical-electrical-vibrations).

$$
% caption: The first two natural modes of a fixed-end string. Each vibrates
% between an upper and lower envelope; mode $n$ has $n{-}1$ interior nodes that
% stay fixed for all time.
\begin{tikzpicture}[scale=1.0, >=stealth, font=\small]
\definecolor{acc}{HTML}{4A6FA5}
% mode 1 (left)
\begin{scope}
\draw[black] (0,0) -- (4,0);
\fill[black!70] (0,0) circle (1.6pt); \fill[black!70] (4,0) circle (1.6pt);
\draw[thick, domain=0:4, samples=80, smooth] plot (\x, {1.0*sin(45*\x)});
\draw[black!45, thick, dashed, domain=0:4, samples=80, smooth] plot (\x, {-1.0*sin(45*\x)});
\node[font=\footnotesize] at (2,1.35) {$n=1$};
\end{scope}
% mode 2 (right)
\begin{scope}[xshift=5.6cm]
\draw[black] (0,0) -- (4,0);
\fill[black!70] (0,0) circle (1.6pt); \fill[black!70] (4,0) circle (1.6pt);
\fill[black] (2,0) circle (1.4pt);
\node[black, font=\footnotesize] at (2,-0.35) {node};
\draw[thick, domain=0:4, samples=90, smooth] plot (\x, {1.0*sin(90*\x)});
\draw[black!45, thick, dashed, domain=0:4, samples=90, smooth] plot (\x, {-1.0*sin(90*\x)});
\node[font=\footnotesize] at (1,1.35) {$n=2$};
\end{scope}
\end{tikzpicture}
$$

> **Worked example.** A string of length $L = 30$ obeys $4u_{xx} = u_{tt}$
> (so $a = 2$), fixed at both ends and released from rest with the plucked shape
>
> $$
> f(x) = \begin{cases} x/10, & 0 \le x \le 10,\\[2pt] (30 - x)/20, & 10 < x \le 30,\end{cases}
> $$
>
> a corner of height $1$ at $x = 10$. The weights are the Fourier sine
> coefficients of $f$,
>
> $$
> c_n = \frac{2}{30}\int_0^{30} f(x)\sin\!\left(\frac{n\pi x}{30}\right)\d x = \frac{9}{n^2\pi^2}\sin\!\left(\frac{n\pi}{3}\right),
> $$
>
> which vanish whenever $n$ is a multiple of $3$, and the motion is
>
> $$
> u(x,t) = \frac{9}{\pi^2}\sum_{n=1}^{\infty}\frac{1}{n^2}\sin\!\left(\frac{n\pi}{3}\right)\sin\!\left(\frac{n\pi x}{30}\right)\cos\!\left(\frac{n\pi t}{15}\right).
> $$
>
> The $1/n^2$ decay makes the corner's harmonics fall off quickly, but every mode
> persists undamped, so the corner is carried along rather than smoothed.

$$
% caption: Initial shape of a string plucked to a corner of height one at
% $x=10$ and released from rest; its Fourier sine coefficients set the amplitude
% of each standing mode.
\begin{tikzpicture}[scale=1.0, >=stealth, font=\small]
\definecolor{acc}{HTML}{4A6FA5}
\draw[black, ->] (-0.2,0) -- (5.4,0) node[right, black!70] {$x$};
\draw[acc, thick] (0,0) -- (1.667,1.3) -- (5,0);
\fill[black!70] (0,0) circle (1.6pt); \fill[black!70] (5,0) circle (1.6pt);
\draw[black, dashed] (1.667,0) -- (1.667,1.3);
\node[black!70, font=\footnotesize] at (1.667,-0.3) {$x=10$};
\node[black!70, font=\footnotesize] at (5,-0.3) {$x=30$};
\node[acc, font=\footnotesize] at (3.5,1.4) {plucked corner};
\end{tikzpicture}
$$

Unlike the heat series, the wave series has no decaying factor, so it cannot be
differentiated term by term without care. An equivalent closed form resolves
this. Writing $h$ for the odd periodic extension of $f$,

$$
u(x,t) = \tfrac12\bigl[h(x - at) + h(x + at)\bigr],
$$

d'Alembert's form of 1746. It shows the solution as two copies of the initial
shape traveling in opposite directions at speed $a$. In contrast to diffusion,
any corner or jump in the initial data is preserved for all time rather than
smoothed. A nonzero initial velocity $g$ contributes a companion series with
$\sin(n\pi at/L)$ in place of the cosine, and the general problem is the sum of
the two, by superposition.

## Laplace's equation

Remove the time dependence and the heat equation's steady state satisfies
Laplace's equation, $u_{xx} + u_{yy} = 0$. The same equation governs
electrostatic potential in a charge-free region, gravitational potential in
free space, and the velocity potential of an ideal fluid, so it is also called
the potential equation. With no time variable there are no initial conditions;
instead one condition is imposed at every point of the boundary of the region.

> **Definition (Dirichlet and Neumann problems).** Solving Laplace's equation
> in a region with the value of $u$ prescribed on the boundary is the
> **Dirichlet problem**; prescribing the normal derivative of $u$ on the
> boundary is the **Neumann problem**. These are the first and second boundary
> value problems of potential theory.[^boyce-108]

### Dirichlet problem for a rectangle

Solve $u_{xx} + u_{yy} = 0$ on $0 < x < a$, $0 < y < b$ with $u = 0$ on three
sides and $u(a,y) = f(y)$ on the fourth. Separation $u = X(x)Y(y)$ gives, with
separation constant $\lambda$,

$$
X'' - \lambda X = 0, \qquad Y'' + \lambda Y = 0.
$$

The homogeneous conditions act on $Y$: $Y(0) = Y(b) = 0$ forces the familiar
eigenvalues $\lambda = (n\pi/b)^2$ and eigenfunctions $\sin(n\pi y/b)$. The
$X$-equation is then $X'' - (n\pi/b)^2 X = 0$ with $X(0) = 0$, solved by
$\sinh(n\pi x/b)$ rather than an exponential, so that the endpoint condition is
easy to impose. The fundamental solutions are $u_n = \sinh(n\pi x/b)\sin(n\pi
y/b)$, and

$$
u(x,y) = \sum_{n=1}^{\infty} c_n \sinh\!\left(\frac{n\pi x}{b}\right)\sin\!\left(\frac{n\pi y}{b}\right),
$$

with $c_n\sinh(n\pi a/b)$ the Fourier sine coefficients of $f$ on $[0,b]$.

$$
% caption: Dirichlet problem on a rectangle: zero potential on three edges and
% data $f(y)$ on the fourth. The interior level curves interpolate smoothly
% between the boundary values.
\begin{tikzpicture}[scale=1.0, >=stealth, font=\small]
\definecolor{acc}{HTML}{4A6FA5}
\draw[black, thick] (0,0) rectangle (4,3);
% three zero sides
\node[black!70, font=\footnotesize] at (2,-0.3) {$u=0$};
\node[black!70, font=\footnotesize, rotate=90] at (-0.3,1.5) {$u=0$};
\node[black!70, font=\footnotesize] at (2,3.3) {$u=0$};
% data side
\node[acc, font=\footnotesize, rotate=-90] at (4.35,1.5) {$u=f(y)$};
% interior level curves bending toward the data edge
\draw[black!60, thick] (4,0.4) .. controls (2.6,1.1) and (2.6,1.9) .. (4,2.6);
\draw[black!45, thick] (4,0.9) .. controls (3.2,1.3) and (3.2,1.7) .. (4,2.1);
\node[black!70, font=\footnotesize] at (2.9,1.5) {level curves};
\node[black!70] at (2,1.6) {$u_{xx}+u_{yy}=0$};
\end{tikzpicture}
$$

### Dirichlet problem for a disk

On a circular region $r < a$ with boundary data $u(a,\theta) = f(\theta)$,
Laplace's equation in polar coordinates is

$$
u_{rr} + \frac{1}{r}u_r + \frac{1}{r^2}u_{\theta\theta} = 0.
$$

Separation $u = R(r)\Theta(\theta)$ yields $r^2 R'' + rR' - \lambda R = 0$, an
Euler equation, and $\Theta'' + \lambda\Theta = 0$. There are no homogeneous
boundary conditions here; instead $\Theta$ must be periodic with period $2\pi$
and $u$ must stay bounded as $r \to 0$. Periodicity forces $\lambda = n^2$ with
$\Theta$ a combination of $\cos n\theta$ and $\sin n\theta$; boundedness discards
the $r^{-n}$ solution of the Euler equation, leaving $R = r^n$. The solution is a
full Fourier series in $\theta$ with radial weights,

$$
u(r,\theta) = \frac{c_0}{2} + \sum_{n=1}^{\infty} r^n\bigl(c_n\cos n\theta + k_n\sin n\theta\bigr),
$$

where $a^n c_n$ and $a^n k_n$ are the Fourier coefficients of $f$ on $[0,2\pi)$.
Both sine and cosine terms appear because the boundary data spans a full period.

$$
% caption: Dirichlet problem on a disk: data prescribed on the circle $r=a$ and
% the solution held bounded at the center, giving a full Fourier series in the
% angle with radial weights $r^n$.
\begin{tikzpicture}[scale=1.0, >=stealth, font=\small]
\definecolor{acc}{HTML}{4A6FA5}
\draw[acc, thick] (0,0) circle (1.8);
\fill[black!70] (0,0) circle (1.3pt);
\draw[black, ->] (0,0) -- (1.27,1.27);
\node[black!70, font=\footnotesize] at (0.95,0.75) {$r$};
\node[black!70, font=\footnotesize] at (0.05,-0.32) {bounded};
\node[acc, font=\footnotesize] at (1.55,-1.5) {$u=f$};
\node[black!70, font=\footnotesize] at (0,-2.2) {circle $r=a$};
\end{tikzpicture}
$$

## The three equations side by side

The method never changes; only the time factor and the region do.

| | Heat $\alpha^2 u_{xx}=u_t$ | Wave $a^2 u_{xx}=u_{tt}$ | Laplace $u_{xx}+u_{yy}=0$ |
| --- | --- | --- | --- |
| Character | diffusive | oscillatory | steady state |
| Time equation | $T' + \alpha^2\lambda T = 0$ | $T'' + a^2\lambda T = 0$ | none |
| Time factor | $e^{-\lambda\alpha^2 t}$ | $\cos, \sin(\sqrt\lambda\,at)$ | absent |
| Data | one initial profile | shape and velocity | boundary values only |
| Fate of a jump | smoothed instantly | preserved and propagated | not applicable |
| Assembled as | Fourier sine/cosine series | Fourier series in modes | Fourier series on boundary |

In every case the spatial eigenvalue problem $X'' + \lambda X = 0$ underlies the
solution, and its eigenfunctions form the basis for the series. Whether a given
boundary value problem has such a real, orthogonal, complete set of
eigenfunctions is a property of the self-adjoint
[Sturm-Liouville form](/differential-equations/pdes-fourier-bvp/sturm-liouville).

[^boyce-105]: **Boyce**, _Elementary Differential Equations and Boundary Value Problems_, §10.5 — separation of variables for heat conduction in a rod, the separation constant, the eigenvalue problem for $X$, and the Fourier sine series solution.
[^boyce-106]: **Boyce**, §10.6 — nonhomogeneous boundary conditions solved by subtracting the steady state, insulated ends and the cosine series, and the instantaneous smoothing of initial discontinuities.
[^boyce-107]: **Boyce**, §10.7 — the wave equation for a vibrating string, natural modes and frequencies, and d'Alembert's traveling-wave form $u = \tfrac12[h(x-at)+h(x+at)]$.
[^boyce-108]: **Boyce**, §10.8 — Laplace's equation, the Dirichlet and Neumann problems, and separation of variables on a rectangle and on a disk.
