Chapter 25
18 min read
Section 214 of 353

What are Partial Differential Equations?

Introduction to PDEs

Learning Objectives

By the end of this section, you will be able to:

  1. Define what a partial differential equation is and explain how it differs from an ordinary differential equation
  2. Identify the key components: dependent variable, independent variables, partial derivatives, and order
  3. Classify second-order linear PDEs as elliptic, parabolic, or hyperbolic based on their discriminant
  4. Interpret the physical meaning of the heat equation and wave equation
  5. Understand why PDEs require both initial conditions and boundary conditions
  6. Recognize PDEs in applications from physics, engineering, finance, and machine learning
  7. Implement basic finite difference solvers for PDEs in Python

The Big Picture: Why PDEs Matter

"The deep study of nature is the most fruitful source of mathematical discoveries." — Joseph Fourier

While ordinary differential equations describe how quantities change with respect to one variable (usually time), the physical world is far richer. Temperature varies across both space and time. Waves propagate through two or three dimensions. Electromagnetic fields permeate all of space. To describe these phenomena, we need equations that involve derivatives with respect to multiple independent variables.

The Central Concept

A partial differential equation (PDE) is an equation involving an unknown function of several variables and its partial derivatives with respect to those variables.

ODE: dydt=ky\frac{dy}{dt} = ky (one variable t)
PDE: ut=α2ux2\frac{\partial u}{\partial t} = \alpha \frac{\partial^2 u}{\partial x^2} (two variables x, t)

PDEs: The Language of Continuous Phenomena

PDEs are the mathematical language for describing:

📍 Phenomena in Space

  • Gravitational and electric fields
  • Fluid flow patterns
  • Stress and strain in materials
  • Electromagnetic wave propagation

⏱️ Evolution in Time + Space

  • Heat diffusion through materials
  • Sound and light propagation
  • Quantum mechanical systems
  • Financial option pricing

Historical Origins

The study of PDEs emerged from the great scientific questions of the 18th and 19th centuries: How does heat flow? How do waves propagate? What determines the shape of a vibrating membrane?

Key Historical Developments

1747: Jean le Rond d'Alembert

First solved the wave equation for a vibrating string. Introduced the method of characteristics and the concept of traveling wave solutions.

1822: Joseph Fourier

Published "Théorie Analytique de la Chaleur," introducing the heat equation and Fourier series. This work revolutionized mathematics and physics.

1830s: George Green, Carl Friedrich Gauss

Developed potential theory and Laplace's equation. Green's theorem and Gauss's law connect PDEs to physics.

1926: Erwin Schrödinger

Formulated quantum mechanics using the Schrödinger equation, a PDE governing the wave function of particles.

2015-Present: Neural PDEs

Physics-Informed Neural Networks (PINNs) and diffusion models bring PDEs into the heart of modern machine learning.


What is a Partial Differential Equation?

A partial differential equation is an equation that contains partial derivatives of an unknown function of two or more independent variables.

Formal Definition

A PDE in the unknown function u=u(x1,x2,,xn)u = u(x_1, x_2, \ldots, x_n) is an equation of the form:

F(x1,,xn,u,ux1,,kuxixj)=0F\left(x_1, \ldots, x_n, u, \frac{\partial u}{\partial x_1}, \ldots, \frac{\partial^k u}{\partial x_i \partial x_j \cdots}\right) = 0

where FF is a given function, and the equation involves at least one partial derivative.

Anatomy of a PDE

Consider the heat equation:

ut=α2ux2\frac{\partial u}{\partial t} = \alpha \frac{\partial^2 u}{\partial x^2}
ComponentSymbolMeaning
Dependent variableu = u(x,t)The unknown function (e.g., temperature)
Independent variablesx, tPosition and time
Partial derivative (1st order)∂u/∂tRate of change with respect to time
Partial derivative (2nd order)∂²u/∂x²Curvature with respect to position
ParameterαThermal diffusivity (material property)

Order of a PDE

The order of a PDE is the order of the highest partial derivative appearing in the equation.

EquationHighest DerivativeOrder
∂u/∂t = c∂u/∂x∂u/∂t or ∂u/∂xFirst order
∂u/∂t = α∂²u/∂x²∂²u/∂x²Second order
∂²u/∂t² = c²∂²u/∂x²∂²u/∂t² or ∂²u/∂x²Second order
∂⁴u/∂x⁴ = 0∂⁴u/∂x⁴Fourth order

ODE vs PDE: The Key Distinction

Understanding the difference between ODEs and PDEs is fundamental. The distinction goes beyond notation to the very nature of the problems.

Ordinary Differential Equations

dydt=f(t,y)\frac{dy}{dt} = f(t, y)
  • One independent variable (e.g., time t)
  • Solution: a function y(t) of one variable
  • Requires: initial conditions only
  • Example: Population growth, radioactive decay
  • Solution space: finite-dimensional

Partial Differential Equations

ut=f(x,t,u,ux)\frac{\partial u}{\partial t} = f\left(x, t, u, \frac{\partial u}{\partial x}\right)
  • Multiple independent variables (e.g., x, y, t)
  • Solution: a function u(x,t) of several variables
  • Requires: initial AND boundary conditions
  • Example: Heat diffusion, wave propagation
  • Solution space: infinite-dimensional

Why Boundary Conditions?

PDEs describe phenomena that occur over spatial domains. We must specify what happens at the boundaries of that domain:

  • Dirichlet: Specify the value of u at the boundary (e.g., fixed temperature)
  • Neumann: Specify the derivative ∂u/∂n at the boundary (e.g., heat flux)
  • Robin: Specify a combination of u and ∂u/∂n (e.g., convective cooling)

Notation and Terminology

PDEs use several notational conventions. Familiarity with these is essential for reading the literature.

Partial Derivative Notation

NotationMeaningUsed When
∂u/∂xPartial derivative of u with respect to xGeneral, formal writing
uₓSubscript notation for ∂u/∂xCompact, handwritten
u_x or u_tSubscript with underscoreComputer code, LaTeX
uₓₓSecond derivative ∂²u/∂x²Higher derivatives
uₓₜ or u_{xt}Mixed derivative ∂²u/∂x∂tCross-derivatives

Differential Operators

The Laplacian Operator

The Laplacian 2\nabla^2 (or Δ\Delta) appears throughout PDEs:

1D:2u=2ux2\nabla^2 u = \frac{\partial^2 u}{\partial x^2}
2D:2u=2ux2+2uy2\nabla^2 u = \frac{\partial^2 u}{\partial x^2} + \frac{\partial^2 u}{\partial y^2}
3D:2u=2ux2+2uy2+2uz2\nabla^2 u = \frac{\partial^2 u}{\partial x^2} + \frac{\partial^2 u}{\partial y^2} + \frac{\partial^2 u}{\partial z^2}

The Laplacian Measures Curvature

The Laplacian 2u\nabla^2 u measures how much the value of u at a point differs from the average of u in the surrounding region. It captures the "curvature" of the function in all directions.


Classification of Second-Order PDEs

Second-order linear PDEs are classified into three types based on a discriminant condition. This classification determines the fundamental behavior of solutions.

Consider the general second-order linear PDE in two variables:

A2ux2+B2uxy+C2uy2+(lower order terms)=0A\frac{\partial^2 u}{\partial x^2} + B\frac{\partial^2 u}{\partial x \partial y} + C\frac{\partial^2 u}{\partial y^2} + \text{(lower order terms)} = 0

The discriminant D=B24ACD = B^2 - 4AC determines the type:

Classification of Second-Order PDEs

For the general equation Auxx + Buxy + Cuyy + ... = 0, classification depends on the discriminant B² - 4AC

Elliptic PDEs

Canonical Form

∂²u/∂x² + ∂²u/∂y² = 0

Classification Criterion

B² - 4AC < 0

Physical Interpretation

Describes steady-state or equilibrium phenomena. Solutions are smooth and satisfy maximum principles.

Examples

  • Laplace's equation (electrostatics, steady heat)
  • Poisson's equation (gravitational potential)
  • Minimal surface equation (soap films)

Characteristic Curves

No real characteristics(Complex characteristic curves)

Characteristic curves show how information propagates through the solution domain.

TypeDiscriminantCharacteristicsPrototype
EllipticB² - 4AC < 0None (complex)uxx + uyy = 0
ParabolicB² - 4AC = 0One familyut = uxx
HyperbolicB² - 4AC > 0Two familiesutt = c²uxx

Physical Intuition for Classification

The classification reflects fundamentally different physical behaviors:

  • Elliptic: Equilibrium problems — the solution smoothly adjusts everywhere simultaneously
  • Parabolic: Diffusion problems — information spreads out over time, smoothing sharp features
  • Hyperbolic: Wave problems — information travels at finite speed along characteristics

The Heat Equation: Diffusion in Action

The heat equation is the prototypical parabolic PDE. It describes how temperature (or any diffusing quantity) evolves over time.

The Heat Equation

ut=α2u\frac{\partial u}{\partial t} = \alpha \nabla^2 u
Rate of temperature change = Diffusivity × Curvature of temperature

Physical Interpretation

The heat equation says: Temperature tends to equalize.

  • If a point is hotter than its neighbors (negative curvature), 2u<0\nabla^2 u < 0, so u/t<0\partial u/\partial t < 0: it cools down.
  • If a point is colder than its neighbors (positive curvature), 2u>0\nabla^2 u > 0, so u/t>0\partial u/\partial t > 0: it warms up.
  • Sharp peaks and valleys smooth out over time — this is diffusion.
🔥Heat Equation Simulation

Interactive visualization of the 1D heat equation: ∂u/∂t = α·∂²u/∂x²

Time: t = 0.0000s

Higher α = faster heat diffusion

Observe:

  • • Heat spreads from hot to cold regions
  • • Sharp features smooth out over time
  • • Total heat is conserved (fixed boundaries)
  • • Eventually reaches equilibrium (u = 0)
∂u/∂t
Rate of temperature change
=
α·∂²u/∂x²
Curvature × diffusivity

The Wave Equation: Propagation Without Diffusion

The wave equation is the prototypical hyperbolic PDE. It describes how disturbances propagate through a medium at a finite speed.

The Wave Equation

2ut2=c22u\frac{\partial^2 u}{\partial t^2} = c^2 \nabla^2 u
Acceleration of medium = (Wave speed)² × Curvature of displacement

Physical Interpretation

The wave equation says: Curvature creates restoring forces.

  • If a point is displaced above its neighbors (negative curvature), the restoring force pulls it down — acceleration is negative.
  • If a point is displaced below its neighbors (positive curvature), the restoring force pushes it up — acceleration is positive.
  • This leads to oscillatory motion that propagates at speed c.
🌊Wave Equation Simulation

Interactive visualization of the 1D wave equation: ∂²u/∂t² = c²·∂²u/∂x²

Time: t = 0.000s

Higher c = faster wave propagation

Observe:

  • • Waves propagate in both directions
  • • Waves reflect at fixed boundaries
  • • Shape is preserved during propagation
  • • Energy oscillates between kinetic and potential
∂²u/∂t²
Acceleration of string
=
c²·∂²u/∂x²
Curvature × (wave speed)²

Key Difference from Heat Equation

Heat Equation (Parabolic)

  • First order in time
  • Information spreads infinitely fast
  • Sharp features smooth out (irreversible)
  • Needs 1 initial condition

Wave Equation (Hyperbolic)

  • Second order in time
  • Information travels at speed c
  • Shape is preserved (reversible)
  • Needs 2 initial conditions (u and ∂u/∂t)

Real-World Applications

PDEs are everywhere in science and engineering. The same mathematical structures describe phenomena from quantum mechanics to option pricing.

PDEs in the Real World

Explore how partial differential equations describe fundamental physical phenomena

🔥

Heat Equation

∂u/∂t = α∇²u
Parabolic PDE

Variables

uTemperature field
tTime
αThermal diffusivity
∇²Laplacian operator

Physical Meaning

Describes how heat (or any diffusing quantity) spreads through a medium over time. The rate of temperature change is proportional to the curvature of the temperature profile.

Real-World Applications

CPU thermal management
Building insulation design
Metallurgical heat treatment
Climate modeling
Financial option pricing (Black-Scholes)

🤖 Machine Learning Connection

Diffusion models (Stable Diffusion, DALL-E) are based on the heat equation with learned reverse diffusion.


Machine Learning Connections

PDEs have become central to modern machine learning, appearing in both theoretical foundations and practical algorithms.

1. Diffusion Models (Stable Diffusion, DALL-E)

State-of-the-art image generation uses score-based diffusion, which is fundamentally connected to the heat equation:

dx=f(x,t)dt+g(t)dwdx = f(x,t)dt + g(t)dw

The model learns to reverse a diffusion process, gradually converting noise into coherent images by following the score (gradient of log probability).

2. Physics-Informed Neural Networks (PINNs)

PINNs embed PDEs directly into the loss function:

L=Ldata+λLphysics\mathcal{L} = \mathcal{L}_{data} + \lambda \mathcal{L}_{physics}

where Lphysics\mathcal{L}_{physics} penalizes violations of the governing PDE. This allows neural networks to:

  • Learn from sparse data by encoding physical constraints
  • Solve forward and inverse PDE problems
  • Discover unknown parameters in physical laws

3. Neural Operators (Fourier Neural Operator)

Instead of learning point-wise mappings, neural operators learn solution operators for entire families of PDEs:

G:(initial conditions)(solutions)\mathcal{G}: \text{(initial conditions)} \to \text{(solutions)}

This enables real-time prediction of PDE solutions for new initial/boundary conditions without re-solving.

4. Graph Neural Networks and the Laplacian

Many GNN architectures are based on the discrete Laplacian:

hi(t+1)=hi(t)+jN(i)(hj(t)hi(t))h_i^{(t+1)} = h_i^{(t)} + \sum_{j \in \mathcal{N}(i)} \left(h_j^{(t)} - h_i^{(t)}\right)

This is a discrete heat equation! Information diffuses across the graph, analogous to heat spreading through a material.


Python Implementation

Solving the Heat Equation Numerically

Finite Difference Solution of the 1D Heat Equation
🐍heat_equation.py
3Heat Equation Setup

We solve the 1D heat equation with Dirichlet boundary conditions (fixed temperature at boundaries). The initial condition is a sine wave.

16Stability Condition

The explicit finite difference method is conditionally stable. The CFL condition requires r = α·dt/dx² ≤ 0.5. Violating this causes the solution to blow up!

27Initial Condition

We use sin(πx/L) as the initial temperature profile. This is an eigenfunction of the Laplacian, making the analytical solution simple.

32Finite Difference Stencil

The second derivative ∂²u/∂x² is approximated by (u[i+1] - 2u[i] + u[i-1])/dx². This is the central difference formula.

43Analytical Solution

For this initial condition, the exact solution is u(x,t) = sin(πx)·exp(-απ²t). Each Fourier mode decays exponentially.

58 lines without explanation
1import numpy as np
2import matplotlib.pyplot as plt
3from matplotlib import animation
4
5def solve_heat_equation_1d(L=1.0, T=0.5, Nx=50, Nt=1000, alpha=0.01):
6    """
7    Solve the 1D heat equation using finite differences.
8
9    ∂u/∂t = α ∂²u/∂x²
10
11    with boundary conditions u(0,t) = u(L,t) = 0
12    and initial condition u(x,0) = sin(πx/L)
13    """
14    # Discretization
15    dx = L / (Nx - 1)
16    dt = T / Nt
17    x = np.linspace(0, L, Nx)
18
19    # Stability condition (CFL): dt ≤ dx²/(2α)
20    stability_ratio = alpha * dt / dx**2
21    print(f"Stability ratio r = {stability_ratio:.4f}")
22    if stability_ratio > 0.5:
23        print("WARNING: Solution may be unstable! Reduce dt or increase dx.")
24
25    # Initialize solution array
26    u = np.zeros((Nt + 1, Nx))
27
28    # Initial condition: u(x,0) = sin(πx/L)
29    u[0, :] = np.sin(np.pi * x / L)
30
31    # Time-stepping (explicit finite difference)
32    r = alpha * dt / dx**2
33    for n in range(Nt):
34        # Interior points
35        u[n + 1, 1:-1] = u[n, 1:-1] + r * (
36            u[n, 2:] - 2 * u[n, 1:-1] + u[n, :-2]
37        )
38        # Boundary conditions (already zero)
39        u[n + 1, 0] = 0
40        u[n + 1, -1] = 0
41
42    return x, u, dt
43
44# Solve the heat equation
45x, u_history, dt = solve_heat_equation_1d()
46
47# Compare with analytical solution: u(x,t) = sin(πx)·e^(-α·π²·t)
48alpha = 0.01
49t_final = 0.5
50analytical = np.sin(np.pi * x) * np.exp(-alpha * np.pi**2 * t_final)
51
52# Plot comparison at final time
53plt.figure(figsize=(10, 5))
54plt.plot(x, u_history[-1], 'b-', linewidth=2, label='Numerical')
55plt.plot(x, analytical, 'r--', linewidth=2, label='Analytical')
56plt.xlabel('x')
57plt.ylabel('u(x, t_final)')
58plt.title('Heat Equation: Numerical vs Analytical Solution')
59plt.legend()
60plt.grid(True, alpha=0.3)
61plt.show()
62
63print(f"Max error: {np.max(np.abs(u_history[-1] - analytical)):.6f}")

Solving the Wave Equation Numerically

Finite Difference Solution of the 1D Wave Equation
🐍wave_equation.py
3Wave Equation Setup

The wave equation is second-order in both time and space. We need two initial conditions: displacement and velocity.

18CFL Condition

For the wave equation, stability requires c·dt/dx ≤ 1. This ensures numerical waves don&apos;t travel faster than the grid allows.

28Plucked String Initial Condition

A plucked string has a triangular initial shape. This creates both left-going and right-going waves.

36First Time Step

Since we have ∂u/∂t = 0 at t=0, we use a special formula for the first step. This ensures the wave starts from rest.

46Leapfrog Scheme

The leapfrog method: u^{n+1} = 2u^n - u^{n-1} + r²(u_{i+1} - 2u_i + u_{i-1}). It&apos;s second-order accurate in both space and time.

76 lines without explanation
1import numpy as np
2import matplotlib.pyplot as plt
3
4def solve_wave_equation_1d(L=1.0, T=2.0, Nx=100, Nt=500, c=1.0):
5    """
6    Solve the 1D wave equation using finite differences.
7
8    ∂²u/∂t² = c² ∂²u/∂x²
9
10    with fixed boundary conditions u(0,t) = u(L,t) = 0
11    and initial conditions:
12        u(x,0) = initial displacement (plucked string)
13        ∂u/∂t(x,0) = 0 (starts from rest)
14    """
15    dx = L / (Nx - 1)
16    dt = T / Nt
17    x = np.linspace(0, L, Nx)
18
19    # CFL stability condition for wave equation: c·dt/dx ≤ 1
20    cfl = c * dt / dx
21    print(f"CFL number = {cfl:.4f}")
22    if cfl > 1:
23        print("WARNING: CFL > 1, solution will be unstable!")
24
25    # Initialize arrays: u_prev, u_curr, u_next
26    u_prev = np.zeros(Nx)
27    u_curr = np.zeros(Nx)
28    u_next = np.zeros(Nx)
29
30    # Initial condition: plucked string (triangle)
31    for i in range(Nx):
32        if x[i] < 0.3:
33            u_curr[i] = x[i] / 0.3
34        else:
35            u_curr[i] = (L - x[i]) / 0.7
36    u_curr *= 0.5  # Amplitude
37
38    # First time step (using ∂u/∂t = 0 at t=0)
39    r = (c * dt / dx)**2
40    for i in range(1, Nx - 1):
41        u_prev[i] = u_curr[i] + 0.5 * r * (
42            u_curr[i + 1] - 2 * u_curr[i] + u_curr[i - 1]
43        )
44
45    # Store solution history
46    history = [u_curr.copy()]
47
48    # Time-stepping (leapfrog scheme)
49    for n in range(Nt):
50        for i in range(1, Nx - 1):
51            u_next[i] = (
52                2 * u_curr[i] - u_prev[i]
53                + r * (u_curr[i + 1] - 2 * u_curr[i] + u_curr[i - 1])
54            )
55        # Boundary conditions
56        u_next[0] = 0
57        u_next[-1] = 0
58
59        # Rotate arrays
60        u_prev[:] = u_curr
61        u_curr[:] = u_next
62
63        if n % 50 == 0:
64            history.append(u_curr.copy())
65
66    return x, history
67
68# Solve and visualize
69x, history = solve_wave_equation_1d()
70
71# Plot several time snapshots
72plt.figure(figsize=(12, 6))
73for i, u in enumerate(history[::2]):
74    alpha = 0.3 + 0.7 * i / len(history[::2])
75    plt.plot(x, u, alpha=alpha, label=f't = {i*0.4:.1f}')
76plt.xlabel('x')
77plt.ylabel('u(x,t)')
78plt.title('Wave Equation: Propagation of a Plucked String')
79plt.legend(loc='upper right')
80plt.grid(True, alpha=0.3)
81plt.show()

Common Pitfalls

Forgetting Boundary Conditions

Unlike ODEs, PDEs require boundary conditions in addition to initial conditions. Without proper boundary conditions, the problem is ill-posed and solutions may not exist or be unique.

Violating Stability Conditions

Explicit finite difference methods require the CFL condition:

  • Heat equation: αΔt/Δx20.5\alpha \Delta t / \Delta x^2 \leq 0.5
  • Wave equation: cΔt/Δx1c \Delta t / \Delta x \leq 1

Violating these causes the numerical solution to explode!

Confusing PDE Types

The three types (elliptic, parabolic, hyperbolic) have fundamentally different solution behaviors:

  • Elliptic: No time variable — boundary value problems
  • Parabolic: First-order in time — initial + boundary value
  • Hyperbolic: Second-order in time — needs two initial conditions

Checking Your Solution

For PDEs with known analytical solutions (like the heat equation with sine initial conditions), always verify your numerical solution against the exact answer. Check that the error decreases as you refine the grid.


Test Your Understanding

Test Your UnderstandingQuestion 1 of 8

What distinguishes a PDE from an ODE?

Current Score: 0 / 0 answered

Summary

Partial differential equations extend the power of calculus to describe phenomena that vary in multiple dimensions. They are the mathematical foundation for physics, engineering, and increasingly, machine learning.

Key Concepts

ConceptDescription
PDEEquation involving partial derivatives of a function of several variables
OrderHighest order partial derivative in the equation
EllipticB² - 4AC < 0; steady-state problems (Laplace)
ParabolicB² - 4AC = 0; diffusion problems (Heat)
HyperbolicB² - 4AC > 0; wave propagation (Wave)
Laplacian∇²u = uₓₓ + uᵧᵧ + ...; measures curvature
Boundary conditionsValues or derivatives specified at domain boundaries
Initial conditionsValues specified at t = 0 for time-dependent problems

Key Takeaways

  1. PDEs involve partial derivatives with respect to multiple independent variables, unlike ODEs which have only one
  2. Second-order linear PDEs are classified as elliptic, parabolic, or hyperbolic based on the discriminant B² - 4AC
  3. The heat equation (parabolic) describes diffusion — sharp features smooth out over time
  4. The wave equation (hyperbolic) describes propagation — information travels at finite speed
  5. PDEs require boundary conditions in addition to initial conditions to be well-posed
  6. Modern ML applications include diffusion models, PINNs, and neural operators
  7. Numerical solutions must respect stability conditions (CFL) to avoid blow-up
The Essence of PDEs:
"PDEs describe how quantities change across both space and time — they are the language of continuous phenomena, from heat flow to quantum mechanics to AI-generated images."
Coming Next: In the next section, we'll explore the Classification of PDEs in more depth. You'll learn how to determine the type of a PDE from its coefficients and understand the physical implications of each classification.
Loading comments...