Learning Objectives
By the end of this section, you will be able to:
- Derive the 2D heat equation from energy conservation and understand its physical meaning
- Apply separation of variables to transform the 2D PDE into three ODEs
- Identify the 2D eigenvalue problem and compute eigenvalues
- Construct the double Fourier series solution and compute Fourier coefficients
- Visualize the 2D heat kernel and explain its Gaussian spreading behavior
- Connect 2D diffusion to image processing and machine learning applications
- Implement the 2D heat equation solution in Python
The Big Picture: From 1D to 2D
"The extension of Fourier's methods to two dimensions opened the door to understanding heat flow in plates, membranes, and ultimately images."
In the previous sections, we mastered the 1D heat equation — heat flowing along a rod. Now we extend these ideas to two dimensions: heat spreading across a plate, a membrane, or even a digital image.
The mathematical framework generalizes beautifully: the second derivative becomes the Laplacian, separation of variables yields a double Fourier series, and the heat kernel becomes a 2D Gaussian. These concepts are fundamental to understanding:
Thermal Engineering
Heat distribution in circuit boards, solar panels, and building materials
Image Processing
Gaussian blur, denoising, edge detection, and scale-space theory
Diffusion in Biology
Chemical signaling, morphogen gradients, and pattern formation
Diffusion Models (AI)
DALL-E, Stable Diffusion, and image generation via 2D diffusion
Financial Mathematics
2D option pricing models with multiple underlying assets
Geology & Climate
Heat flow in Earth's crust, ocean temperature modeling
Historical Context
Joseph Fourier's 1822 masterwork Théorie Analytique de la Chaleur (The Analytical Theory of Heat) actually focused heavily on 2D and 3D problems. His original motivation was understanding heat flow in the Earth's crust and in heated plates.
Fourier's Plate Problem (1807)
Fourier first analyzed heat flow in a semi-infinite plate with one edge held at a fixed temperature. This led him to discover that the temperature distribution involves infinite series of sine and cosine functions.
The Laplacian Operator
Pierre-Simon Laplace had earlier studied the operator in the context of gravitational potentials. Fourier showed it naturally describes heat diffusion in multiple dimensions.
Modern Applications (2020s)
The 2D heat equation is now central to diffusion models in AI. Image generation systems like DALL-E and Stable Diffusion exploit the mathematics of 2D diffusion to create stunning images from noise.
The 2D Heat Equation
The 2D heat equation describes how temperature evolves over a 2D domain:
The 2D Heat Equation
Understanding the Laplacian
The Laplacian measures how the temperature at a point differs from the average of its neighbors. Physically:
| Laplacian | Physical Meaning | Result |
|---|---|---|
| ∇²u < 0 | Point is hotter than neighbors (concave down) | Temperature decreases |
| ∇²u > 0 | Point is colder than neighbors (concave up) | Temperature increases |
| ∇²u = 0 | Point equals neighbor average (harmonic) | No change (equilibrium) |
The Laplacian as Mean-Value Operator
For small radius , the average of on a circle of radius centered at is approximately:
So tells us how much differs from its local average.
Separation of Variables in 2D
We solve the 2D heat equation on a rectangular plate with Dirichlet boundary conditions (zero temperature on all edges):
Follow the step-by-step derivation below to see how separation of variables transforms the PDE into three independent ODEs:
Separation of Variables in 2D
Start with the 2D Heat Equation
We want to solve the heat equation on a rectangular plate [0, a] × [0, b] with zero temperature on all boundaries (Dirichlet conditions).
The 2D Eigenvalue Problem
Separation of variables leads to two spatial eigenvalue problems:
X-Direction
Y-Direction
The combined eigenvalue for mode is the sum:
2D Eigenvalues
Each mode (m, n) decays at rate
The Eigenfunction Family
The 2D eigenfunctions (normal modes) are products of 1D eigenfunctions:
These form an orthonormal basis for functions on the rectangular domain that vanish on the boundary.
| Mode (m,n) | λₘₙ (unit square) | Decay Rate αλ | Pattern |
|---|---|---|---|
| (1, 1) | 2π² ≈ 19.7 | Slowest | Single bump |
| (1, 2) or (2, 1) | 5π² ≈ 49.3 | 2.5× faster | Two bumps |
| (2, 2) | 8π² ≈ 78.9 | 4× faster | Checkerboard (2×2) |
| (3, 3) | 18π² ≈ 177.7 | 9× faster | Checkerboard (3×3) |
The n² + m² Rule
Higher modes decay much faster than low modes. Mode decays at a rate proportional to . This explains why:
- Sharp features (high frequency) smooth out quickly
- Broad features (low frequency) persist longer
- Eventually, only mode (1, 1) remains
Double Fourier Series Solution
The general solution is a double Fourier series over all modes:
The Double Fourier Series Solution
Computing Fourier Coefficients
The coefficients are found by projecting the initial condition onto each eigenmode:
Fourier Coefficient Formula
This double integral "projects" the initial condition onto mode (m, n)
Orthogonality
The formula works because the 2D eigenfunctions are orthogonal:
The 2D Heat Kernel
On an infinite plane, the fundamental solution (heat kernel) is the 2D Gaussian:
2D Heat Kernel (Fundamental Solution)
A 2D Gaussian with standard deviation in each direction
The 2D Heat Kernel
2D Heat Kernel (Fundamental Solution)
A 2D Gaussian centered at the origin with standard deviation σ = √(2αt)
Key Properties
- • Total integral = 1 (energy conservation)
- • Width grows as √t (sub-linear spreading)
- • Height decreases as 1/t to maintain unit integral
- • Solution to point-source initial condition
Properties of the 2D Heat Kernel
- Normalization: The total integral is 1 for all t > 0 (energy conservation)
- Spreading: Width grows as , height decreases as
- Radial symmetry: Depends only on
- Initial condition: As , approaches a delta function at the origin
- Convolution solution: For initial condition , the solution is
Interactive 2D Heat Diffusion
Explore how heat diffuses on a 2D plate. Try different initial conditions and observe how sharp features smooth out while the total energy is conserved.
Interactive 2D Heat Diffusion
Higher α means faster heat spreading
The 2D Heat Equation
Temperature at each point evolves based on the 2D Laplacian (sum of second derivatives). The boundary is held at zero temperature.
What to Observe
- Checkerboard pattern: Watch how the high-frequency pattern disappears almost instantly
- Center spot: The Gaussian spreads while maintaining its shape
- Corners: Heat flows away from corners toward the zero-temperature boundaries
Visualizing 2D Eigenmodes
Each eigenmode has a characteristic spatial pattern that persists while its amplitude decays. Higher modes have more oscillations and decay faster.
2D Fourier Eigenmodes
Mode Analysis
The mode structure reveals why diffusion is a low-pass filter:
- Mode (1, 1) has λ = 2π² and decays slowest — it's the "fundamental frequency"
- Mode (2, 2) has λ = 8π² and decays 4× faster — checkerboard patterns vanish quickly
- The eigenvalue grows as m² + n², so decay rate grows quadratically with "frequency"
- After sufficient time, only mode (1, 1) remains visible
Machine Learning Connections
The 2D heat equation is fundamental to modern machine learning, particularly in computer vision and generative AI.
1. Gaussian Blur in Image Processing
Applying the heat equation to an image for time is equivalent to Gaussian blur with standard deviation :
This is why the heat equation is central to scale-space theory in computer vision.
2. Diffusion Models (DALL-E, Stable Diffusion)
Diffusion models work by simulating the heat equation on images:
- Forward process: Gradually add Gaussian noise to images — this is 2D heat diffusion!
- Reverse process: Train a neural network to reverse the diffusion
- Generation: Start from pure noise and denoise step by step
The Mathematical Connection
The noise added at each step follows a schedule that corresponds to the time parameter in the heat equation. The variance controls how much the image "diffuses."
3. Denoising and Regularization
The heat equation naturally removes high-frequency noise while preserving low-frequency structure. This connects to:
- Tikhonov regularization: Adding a smoothness penalty ∥∇u∥² corresponds to heat diffusion
- Anisotropic diffusion: Perona-Malik equation preserves edges while smoothing flat regions
- Graph neural networks: Message passing is discrete heat diffusion on graphs
4. Fourier Features in Neural Networks
The 2D Fourier modes we studied appear in modern architectures:
- Positional encodings: Transformers use sinusoidal functions similar to Fourier modes
- Fourier neural operators: Learn PDE solutions in Fourier space
- Spectral normalization: Controls eigenvalues of weight matrices
Python Implementation
Implement the 2D heat equation solution using the double Fourier series method:
Common Pitfalls
Truncating the Double Series
With two indices (m, n), the number of modes grows as N² if you keep modes up to m, n ≤ N. For discontinuous initial conditions, you may need many modes for accuracy near t = 0.
Boundary Conditions Matter
The sine-sine eigenfunctions are specific to Dirichlet (zero-value) conditions on all edges. Different boundary conditions require different eigenfunctions:
- Neumann on x, Dirichlet on y: cos(mπx/a)sin(nπy/b)
- Periodic: sines and cosines in both directions
- Mixed: case-by-case analysis
The Laplacian Has Units
In the heat equation, has units of . Always verify that has the same units as .
Numerical Stability
For finite difference methods, the stability condition in 2D is more restrictive than 1D:
This means the time step must be smaller in 2D for the same spatial resolution.
Test Your Understanding
Test Your Understanding: 2D Heat Equation
1. The 2D heat equation ∂u/∂t = α(∂²u/∂x² + ∂²u/∂y²) involves which differential operator on the right-hand side?
2. When solving the 2D heat equation on a rectangular domain using separation of variables, how many separate ODEs do we obtain?
3. For the 2D heat equation on a unit square with zero boundary conditions, the eigenvalue for mode (m, n) is λₘₙ = ...
4. The 2D heat kernel (fundamental solution) has what shape?
5. Which mode (m, n) decays the SLOWEST on a unit square?
6. The standard deviation of the 2D heat kernel grows proportionally to...
7. What determines the Fourier coefficient Bₘₙ for the 2D heat equation?
8. In image processing, applying the 2D heat equation has what effect?
Summary
The 2D heat equation extends the 1D theory to plates and surfaces, revealing the power of the Laplacian operator and double Fourier series.
Key Equations
| Name | Formula |
|---|---|
| 2D Heat Equation | ∂u/∂t = α(∂²u/∂x² + ∂²u/∂y²) = α∇²u |
| 2D Eigenvalues | λₘₙ = π²(m²/a² + n²/b²) |
| 2D Eigenfunctions | φₘₙ(x,y) = sin(mπx/a)sin(nπy/b) |
| General Solution | u = Σₘ Σₙ Bₘₙ φₘₙ(x,y) exp(-αλₘₙt) |
| Fourier Coefficient | Bₘₙ = (4/ab)∫∫f(x,y)φₘₙ(x,y)dxdy |
| 2D Heat Kernel | G = (1/4παt)exp(-(x²+y²)/4αt) |
Key Takeaways
- The 2D heat equation involves the Laplacian , which measures how differs from its local average
- Separation of variables in 2D leads to three ODEs: one for each spatial direction and one for time
- The 2D eigenvalue is the sum of the 1D eigenvalues in each direction
- Higher modes decay much faster — rate grows as
- The 2D heat kernel is a Gaussian spreading in all directions with width
- Gaussian blur in images is exactly 2D heat diffusion
- Diffusion models in AI (DALL-E, Stable Diffusion) exploit 2D heat equation mathematics
Coming Next: In the next section, we'll explore Numerical Methods: Finite Differences — practical algorithms for solving the heat equation when analytical solutions are not available.