Wave and Heat Equations
The heat equation and wave equation are the two standard time-dependent PDEs in introductory engineering mathematics. The heat equation models diffusion: temperature, concentration, or probability density smooths out over time. The wave equation models propagation: disturbances travel, reflect, and oscillate.
Both equations can be solved by separation of variables on simple bounded domains, but their time behavior is fundamentally different. Heat modes decay exponentially, while wave modes oscillate. This difference is visible in energy, smoothing, stability, and how initial data affect later behavior.
Definitions
The one-dimensional heat equation is
Here may represent temperature, and is thermal diffusivity.
The one-dimensional wave equation is
Here may represent displacement of a string, and is wave speed.
For a rod or string on , common boundary conditions include Dirichlet conditions
Neumann conditions
and mixed conditions.
The heat equation needs one initial condition:
The wave equation needs two:
Key results
For the fixed-end heat equation on ,
the solution has the sine expansion
where
Every nonzero mode decays. Higher modes decay faster, so heat flow smooths initial data rapidly.
For the fixed-end wave equation,
the solution has the form
The coefficients come from initial displacement and from initial velocity. Modes do not decay in the ideal undamped model; they exchange kinetic and potential energy.
D'Alembert's formula solves the wave equation on the whole line:
It shows finite propagation speed. The value at depends only on initial data in the interval .
The heat equation has infinite propagation speed in the classical model: a localized initial temperature affects the entire line immediately, though the effect may be extremely small far away. This reflects the idealization of diffusion and contrasts sharply with waves.
Energy behavior distinguishes the equations. For the fixed-end wave equation, an energy involving and is conserved. For the heat equation, an energy such as decreases over time under zero boundary conditions.
The heat equation is parabolic. Its solutions tend to become smoother as time increases, and boundary conditions strongly influence the long-term state. With fixed zero boundary temperature, the solution tends to zero. With insulated boundaries, the average temperature is conserved, and the solution tends to that average. With nonzero boundary temperatures, one usually subtracts the steady-state temperature profile before applying a sine or cosine expansion.
The wave equation is hyperbolic. It carries information along characteristic lines and supports reflection at boundaries. Fixed endpoints reflect waves with sign changes in displacement, while free endpoints reflect differently. The ideal equation has no damping, so oscillations persist forever unless damping, forcing, or energy loss is added to the model.
Fourier modes make both equations look like many independent scalar equations. For heat, mode satisfies
so it decays. For waves, mode satisfies
so it oscillates. The same spatial eigenvalue therefore produces different time dynamics depending on the PDE.
Boundary conditions should match the physical setup. A fixed string end has displacement zero. An insulated rod end has heat flux zero, which often becomes . A prescribed boundary temperature is Dirichlet, while a prescribed heat flux is Neumann. Mixed or Robin conditions model heat exchange with the environment and lead to different eigenvalue equations.
The constants and have different units and meanings. Thermal diffusivity controls the rate at which gradients smooth out. Wave speed controls the speed of propagation. If a formula puts in a heat exponent or in a wave frequency, the units will usually reveal the error.
On finite intervals, Fourier-series solutions must be interpreted at discontinuities using the usual convergence rules. A discontinuous initial temperature can be represented by a sine series, but at the jump the series initially converges to the midpoint value. For , the heat solution becomes smooth. A discontinuous initial displacement for the wave equation can propagate corners or discontinuities along characteristic directions in weaker solution settings.
Numerical methods also differ. Explicit finite-difference schemes for heat equations face stability restrictions involving . Wave schemes face restrictions involving the Courant number . These restrictions reflect the different mathematical types of the equations, and ignoring them can produce unstable computations.
The steady state of a heat problem is found by setting , which leaves an ODE such as in one dimension. The wave equation has no analogous diffusive steady-state selection in the undamped homogeneous case. If a wave model appears to settle, damping or forcing has been introduced, even if only implicitly through numerical dissipation.
In applications, both equations may appear in the same system. A thermoelastic structure can conduct heat while also vibrating. The separate model equations teach the limiting behaviors: diffusion smooths gradients, while waves transport disturbances. Coupled models combine these effects and require more advanced analysis.
Visual
| Feature | Heat equation | Wave equation |
|---|---|---|
| Time order | First order | Second order |
| Initial data | and | |
| Modal time factor | , | |
| Physical behavior | Diffusion and smoothing | Propagation and oscillation |
| Energy | Decays under fixed boundaries | Conserved in ideal fixed string |
Worked example 1: Heat equation with one sine mode
Problem. Solve
with
Method.
-
The initial condition is already a single sine mode with .
-
For heat flow, mode evolves by
- Substitute :
- Keep the same spatial mode:
Answer.
Check. The boundary values vanish because the sine vanishes at and . The amplitude decays to zero as .
The decay rate is four times the rate of the first mode because and the rate is proportional to . If the initial data contained both and modes, the second mode would disappear faster, leaving the first mode as the dominant long-time shape before it also decays.
Worked example 2: Wave equation with initial displacement
Problem. Solve
with
Method.
-
The displacement is the sine mode.
-
The angular frequency is
-
Since the initial velocity is zero, the sine-in-time coefficient is zero.
-
The cosine-in-time coefficient equals the initial displacement amplitude .
Answer.
Check. At , the cosine is , so the displacement is correct. Differentiating in time gives a factor , so .
The solution periodically changes sign. At a quarter period the displacement is zero while velocity is largest; at a half period the string has the opposite displacement. This is the exchange between kinetic and potential energy in modal form.
Code
import numpy as np
def heat_mode(x, t, L=1.0, k=0.1, n=2, amplitude=3.0):
return amplitude * np.exp(-k * (n * np.pi / L)**2 * t) * np.sin(n * np.pi * x / L)
def wave_mode(x, t, L=1.0, c=1.0, n=3, amplitude=2.0):
return amplitude * np.cos(c * n * np.pi * t / L) * np.sin(n * np.pi * x / L)
x = np.linspace(0.0, 1.0, 200)
print(heat_mode(x, 0.5).max())
print(wave_mode(x, 0.5).max())
The two functions use similar spatial modes but different time factors. The heat amplitude shrinks monotonically for each mode. The wave amplitude changes sign periodically but does not decay in this ideal model.
For multi-mode initial data, the heat code would sum decaying exponentials, while the wave code would sum independent oscillators. Visualizing both with the same initial spatial coefficients makes the contrast between diffusion and propagation clear.
Common pitfalls
- Using two initial conditions for the heat equation or only one for the wave equation.
- Giving heat modes oscillatory time factors or wave modes decaying time factors without damping.
- Forgetting the square in heat decay rates .
- Missing the wave frequency factor .
- Assuming heat and wave equations have the same propagation behavior.
- Applying fixed-end sine formulas to insulated Neumann boundary conditions.
- Dropping high wave modes as if they decay naturally.
- Forgetting that nonhomogeneous boundary conditions require preprocessing or steady-state subtraction.
- Using the same coefficient formula for initial displacement and initial velocity in the wave equation. The velocity coefficients include division by modal frequency when solving for sine-in-time amplitudes.
- Forgetting that heat equation solutions with insulated ends conserve average temperature.
- Treating finite propagation speed as a heat-equation property.
- Overrounding modal frequencies.