Partial differential equations

Heat spreading through metal, waves on a string, oil seeping through rock, air flowing over a wing: the laws of continuous media are PDEs.

⏱ 28 minNeeds: Chapters 2 and 53 live simulations
In plain words

An ODE (Ordinary Differential Equation) describes one quantity changing in time — the temperature of a cup. A PDE describes a quantity that varies in space and time — the temperature at every point of a metal rod. Because it depends on several variables, its derivatives are partial derivatives. Three equations — heat, wave and Laplace — teach almost everything you need to start.

You will learn
Level 1 · basicNotation; the heat equation Level 2 · standardWaves; Laplace and Poisson Level 3 · advancedClassification and well-posedness
Simplest example first · a rod between ice and boiling water

Hold one end of a metal rod at $0\,{}^\circ$C and the other at $100\,{}^\circ$C, and wait. The temperature becomes a straight line, $u(x) = 100x$ (for a rod of length 1). Why does it stop changing? The heat equation says $u_t = \alpha u_{xx}$, and a straight line has no curvature: $u_{xx} = 0$, so $u_t = 0$. Now take a curved profile, the "hill" $u = 400x(1 - x)$ with both ends at $0\,{}^\circ$C: $u_{xx} = -800 < 0$ everywhere, so $u_t = -800\alpha < 0$ — every point cools. The rule in words: points that are hotter than the average of their neighbours cool down; points that are colder warm up. That is all the heat equation says.

1. Notation and definition

For $u(x, t)$ we write $u_t = \frac{\partial u}{\partial t}$, $u_x = \frac{\partial u}{\partial x}$, $u_{xx} = \frac{\partial^2 u}{\partial x^2}$. In several space dimensions the Laplacian is $\Delta u = \nabla^2 u = u_{xx} + u_{yy} + u_{zz}$.

Definition · Partial differential equation

A PDE is an equation involving an unknown function of two or more independent variables and its partial derivatives, $F(x, t, u, u_x, u_t, u_{xx}, \dots) = 0$. Its order is that of the highest derivative; it is linear if $F$ is linear in $u$ and all its derivatives.

Evans, Partial Differential Equations, 2nd ed., AMS (2010), chapter 1; Strauss, Partial Differential Equations: An Introduction, 2nd ed., Wiley (2008), chapter 1.
EquationNameTypeModels
$u_t = \alpha\, u_{xx}$heat / diffusionparabolicheat conduction, pollutant spreading, reservoir pressure
$u_{tt} = c^2 u_{xx}$wavehyperbolicstrings, sound, seismic waves
$-\Delta u = f$Poisson (Laplace if $f = 0$)ellipticsteady temperature, electrostatics, groundwater
$u_t + u\,u_x = \nu\, u_{xx}$Burgersnonlinearshocks, toy model of fluid flow — a PINN favourite

2. The heat equation

Animation: temperature along a rod; hot spots spread out and fade.
Watch: Diffusion in action: sharp hot spots smooth out first, then everything cools towards the boundary temperature.

Heat flows from hot to cold, at a rate proportional to the temperature gradient (Fourier's law, 1822). Conservation of energy in a thin rod then gives $$u_t = \alpha\, u_{xx}, \qquad 0 < x < L,\ t > 0,$$ where $\alpha > 0$ is the thermal diffusivity. The intuition: $u_{xx} > 0$ where the profile is a "valley" (cooler than its neighbours) — so it warms up; at a "peak" $u_{xx} < 0$ and it cools. Diffusion smooths everything out.

To get a unique solution we need an initial condition $u(x, 0) = u_0(x)$ and a condition at each end — a boundary condition:

TypeFormulaPhysical meaning
Dirichlet$u(0, t) = g(t)$end held at a given temperature (in ice water)
Neumann$u_x(0, t) = 0$insulated end: no heat flows through
Robin$-u_x(0,t) + \beta u(0,t) = 0$cooling by surrounding air (Newton's law)
Heat in a rod — livedrag on the plot to add heat; press play
Notice: sharp corners vanish almost instantly (high-frequency modes decay fastest); with ice-cold ends all heat leaks away; with insulated ends the total heat is conserved and the rod settles to its average temperature.

Solving it: separation of variables and Fourier series

Try $u(x,t) = X(x)\,T(t)$ in $u_t = \alpha u_{xx}$ on $[0,1]$ with $u(0,t) = u(1,t) = 0$. Dividing by $\alpha XT$: $\frac{T'}{\alpha T} = \frac{X''}{X} = -\lambda$ (a constant, since the left depends only on $t$ and the right only on $x$). The boundary conditions allow only $X = \sin(k\pi x)$ with $\lambda = (k\pi)^2$, and then $T = e^{-\alpha k^2\pi^2 t}$. Adding all such solutions:

Result · Fourier series solution of the heat equation

$$u(x,t) = \sum_{k=1}^{\infty} b_k\, e^{-\alpha k^2\pi^2 t}\sin(k\pi x), \qquad b_k = 2\int_0^1 u_0(x)\sin(k\pi x)\,dx.$$ Each Fourier mode decays at its own rate $\alpha k^2\pi^2$: mode 10 dies 100 times faster than mode 1. This is why the simulation smooths so quickly.

Strauss (2008), chapters 4–5 (separation of variables, Fourier series); Fourier, Théorie analytique de la chaleur, Paris (1822).

3. The wave equation

Animation: a pluck on a string splits into two pulses that travel, reflect upside down at the ends and pass through each other.
Watch: A pluck splits into two waves travelling at speed $c$ (d'Alembert's solution); fixed ends reflect them upside down.

For a stretched string with small vertical displacement $u(x,t)$, Newton's law gives $$u_{tt} = c^2 u_{xx},$$ with wave speed $c = \sqrt{\text{tension}/\text{density}}$. It needs two initial conditions — initial shape $u(x,0)$ and initial velocity $u_t(x,0)$ — because it is second order in time. Unlike heat, waves do not smooth out: they travel and reflect, carrying their shape. d'Alembert (1747) showed that on an infinite line every solution is $u = F(x - ct) + G(x + ct)$: one wave moving right, one moving left.

Plucked string — liveclick or tap on the string to pluck it there
A pluck splits into two bumps moving in opposite directions (d'Alembert), which flip upside-down when they reflect from the fixed ends. Different from the rod above: no smoothing.

4. Steady state: Laplace and Poisson

Wait long enough and the temperature in a plate stops changing: $u_t = 0$. The heat equation in 2D, $u_t = \alpha(u_{xx} + u_{yy})$, becomes Laplace's equation $$\Delta u = u_{xx} + u_{yy} = 0,$$ or, with a heat source $f$, Poisson's equation $-\Delta u = f$. There is no time and no initial condition — only boundary conditions. A key property: a solution of Laplace's equation equals the average of its values around any circle (mean value property), so the maximum and minimum occur on the boundary (maximum principle).

Evans (2010), chapter 2.2 "Laplace's equation" (mean-value formulas, maximum principle).
Steady temperature in a plateedges held at fixed temperatures; watch the iteration relax
Each sweep replaces every interior value by the average of its four neighbours (Gauss–Seidel iteration on the discrete Laplace equation, Chapter 8). The picture converges to the steady state; the hottest and coldest points are always on the edges. Colours: red–yellow is hot, blue is cold.

5. Classification and well-posedness

Definition · Classification of second-order linear PDEs in two variables

For $A u_{xx} + 2B u_{xy} + C u_{yy} + (\text{lower-order terms}) = 0$, the equation is elliptic if $B^2 - AC < 0$ (Laplace), parabolic if $B^2 - AC = 0$ (heat), and hyperbolic if $B^2 - AC > 0$ (wave).

Strauss (2008), chapter 1.6 "Types of second-order equations".

The type predicts behaviour: elliptic → smooth steady states determined by the whole boundary; parabolic → smoothing in time, infinite propagation speed; hyperbolic → finite-speed waves that keep sharp features. Numerical methods must respect the type.

Definition · Well-posed problem (Hadamard)

A problem is well-posed if (1) a solution exists, (2) it is unique, and (3) it depends continuously on the data (small changes in initial/boundary data give small changes in the solution). The backward heat equation — recovering the past temperature from the present — violates (3): it is ill-posed.

Hadamard, "Sur les problèmes aux dérivées partielles et leur signification physique", Princeton University Bulletin 13 (1902) 49–52; Evans (2010), chapter 1.
Why ill-posedness matters for SciML

Many practical tasks are inverse problems — find the diffusivity, the source or the initial state from sparse measurements — and these are often ill-posed. Data alone fits noise; physics alone lacks the unknown parameters. PINNs combine both: the PDE residual acts as a regulariser on the data fit (Raissi, Perdikaris & Karniadakis, J. Comput. Phys. 378, 2019, 686–707).

Real world · petroleum reservoirs

Pressure $p(x,t)$ in a porous rock saturated with a slightly compressible fluid obeys a diffusion equation $$\phi\,\mu\, c_t\, \frac{\partial p}{\partial t} = \nabla\cdot\big(k\,\nabla p\big),$$ with porosity $\phi$, viscosity $\mu$, total compressibility $c_t$ and permeability $k(x)$ — Darcy's law plus conservation of mass. Well tests measure pressure at a well and solve the inverse problem for $k$. Full reservoir simulators solve coupled nonlinear PDEs for several phases (oil, water, gas) on millions of cells.

Aziz & Settari, Petroleum Reservoir Simulation, Applied Science Publishers (1979); Chen, Huan & Ma, Computational Methods for Multiphase Flows in Porous Media, SIAM (2006).

6. Try it in Python

The Fourier series solution of the heat equation, with a square-wave initial temperature.

import numpy as np
import matplotlib.pyplot as plt

alpha = 1.0
x = np.linspace(0, 1, 400)
u0 = np.where((x > 0.3) & (x < 0.7), 1.0, 0.0)          # hot middle section

K = 200                                                  # number of Fourier modes
k = np.arange(1, K + 1)[:, None]
dx = x[1] - x[0]
bk = 2 * (u0 * np.sin(k * np.pi * x)).sum(axis=1)[:, None] * dx   # b_k = 2 * integral of u0 sin(k pi x)

for t in [0, 0.001, 0.01, 0.05, 0.2]:
    u = (bk * np.exp(-alpha * (k * np.pi)**2 * t) * np.sin(k * np.pi * x)).sum(axis=0)
    plt.plot(x, u, label=f"t = {t}")
plt.xlabel("x"); plt.ylabel("u(x, t)"); plt.legend(); plt.grid(alpha=.3)
plt.title("Heat equation by Fourier series"); plt.show()

What type is $u_{xx} + u_{yy} = 0$?

Right: $A = C = 1$, $B = 0$, so $B^2 - AC = -1 < 0$.

A rod with both ends insulated starts with temperature 1 on the left half and 0 on the right half. Long after, the temperature is…

Right: insulated (Neumann) ends conserve total heat, which spreads evenly to the average, 0.5.

Limitations, and where this leads

Analytical solutions (Fourier series, Green's functions) exist only for simple equations, geometries and coefficients. Real problems — variable permeability, complex geometry, nonlinear terms, unknown coefficients — need numerical methods, and often data. Chapter 9 looks at these limits honestly, and at how SciML methods address them by building on what you learned here. Go to Chapter 9 →

Key takeaways

Further reading