Sign in or create a free account to continue.

MATH-201 · Lesson 11 of 12 · 32 min

Partial differential equations and Fourier series

Everything so far has involved ordinary differential equations, where the unknown depends on a single variable, usually time. Many engineering quantities depend on position as well: the temperature through a wall as it heats up, the displacement of a vibrating string or beam, the stress in a dam, the pressure in an aquifer, the voltage along a transmission line. Their governing laws are partial differential equations (PDEs), which relate rates of change in time and space. This lesson introduces the three classic PDEs of engineering, the heat, wave and Laplace equations, and solves them on simple shapes by separation of variables. The method reduces each PDE to the ordinary differential equations and eigenvalue problems of earlier lessons, and assembles the solution from the eigenfunctions of Lesson 6 using Fourier series. It ends with a finite-difference solution, the starting point of the numerical methods used for real geometries.

Three classic equations

The heat (diffusion) equation describes conduction of heat, diffusion of a chemical and consolidation of soil. For temperature \(u(x, t)\) in a rod or slab, an energy balance on a thin slice combined with Fourier's law of conduction gives:

\[\frac{\partial u}{\partial t} = \alpha\frac{\partial^2 u}{\partial x^2}, \qquad \alpha = \frac{k}{\rho c_p}\]

The thermal diffusivity \(\alpha\) (m²/s) measures how fast temperature changes spread. The equation says that a point warms when it is colder than the average of its neighbours, which is what a positive curvature \(u_{xx}\) means.

The wave equation describes a taut string, sound in a pipe, axial vibration of a bar and voltage on a lossless transmission line. For a string with tension T and mass per length \(\mu\), Newton's second law on a short element gives:

\[\frac{\partial^2 u}{\partial t^2} = c^2\frac{\partial^2 u}{\partial x^2}, \qquad c = \sqrt{T/\mu}\]

Laplace's equation describes steady states: the final temperature in a plate, groundwater seepage, electrostatic potential and ideal fluid flow:

\[\frac{\partial^2 u}{\partial x^2} + \frac{\partial^2 u}{\partial y^2} = 0\]

These are the prototypes of the three types of second-order PDE: parabolic (heat: disturbances diffuse and smooth out), hyperbolic (wave: disturbances travel at finite speed) and elliptic (Laplace: every point depends on the whole boundary). Each needs its own kind of conditions: the heat equation needs an initial temperature and boundary conditions; the wave equation needs an initial shape and velocity; Laplace's equation needs conditions all around the boundary.

Fourier sine series

Lesson 6 showed that the eigenfunctions \(\sin(n\pi x/L)\) of \(X'' + \lambda X = 0\) with fixed ends are orthogonal on \(0 \le x \le L\). Almost any function on that interval can be written as a sum of them, a Fourier sine series:

\[f(x) = \sum_{n=1}^{\infty} b_n\sin\frac{n\pi x}{L}, \qquad b_n = \frac{2}{L}\int_0^L f(x)\sin\frac{n\pi x}{L}\,dx\]

The coefficient formula comes from orthogonality: multiply both sides by \(\sin(m\pi x/L)\) and integrate; every term except \(n = m\) vanishes, and the surviving integral is \(L/2\). It is the same idea as finding the components of a vector by taking dot products with perpendicular unit vectors (MATH-125).

Worked problem

A uniform initial temperature

Find the Fourier sine series of \(f(x) = U\) (a constant) on \(0 < x < L\).

Show solution
  1. \(b_n = \dfrac{2U}{L}\int_0^L \sin\dfrac{n\pi x}{L}\,dx = \dfrac{2U}{n\pi}\left(1 - \cos n\pi\right)\).
  2. Since \(\cos n\pi = (-1)^n\), \(b_n = 4U/(n\pi)\) for odd n and 0 for even n.

Answer: U = (4U/π)[sin(πx/L) + ⅓ sin(3πx/L) + ⅕ sin(5πx/L) + …]. The series converges to U inside the interval and to 0 at the ends, where every sine vanishes.

Graph of partial sums of the Fourier sine series of a constant on 0 to L. The one-term sum is a single sine arch. The three-term and nine-term sums are flatter with ripples. The twenty-five-term sum is nearly flat at 1 with small ripples and overshoots of about 9 percent near the ends.
Partial sums of the sine series for a constant: more terms give a closer fit, with the Gibbs overshoot near the jumps.

Near a jump, the partial sums overshoot by about 9% of the jump however many terms are taken; this is the Gibbs phenomenon. For periodic signals on \(-L < x < L\), the full Fourier series uses both sines and cosines, \(f = a_0 + \sum (a_n\cos\tfrac{n\pi x}{L} + b_n\sin\tfrac{n\pi x}{L})\), and is the basis of harmonic analysis in power systems and of signal processing, where a square wave from a switching converter is a sum of odd harmonics in exactly this way.

The heat equation by separation of variables

Consider a slab of thickness L, initially at temperature \(f(x)\), whose faces are suddenly held at 0 (measuring temperature relative to the surroundings). Try a solution that is a product of a function of x and a function of t: \(u = X(x)\,G(t)\). Substituting into \(u_t = \alpha u_{xx}\) and dividing by \(\alpha XG\):

\[\frac{G'}{\alpha G} = \frac{X''}{X} = -\lambda\]

The left side depends only on t and the middle only on x, so both must equal the same constant, written \(-\lambda\). This separates the PDE into two ODEs. The space equation \(X'' + \lambda X = 0\) with \(X(0) = X(L) = 0\) is the eigenvalue problem of Lesson 6, with \(\lambda_n = (n\pi/L)^2\) and \(X_n = \sin(n\pi x/L)\). The time equation \(G' = -\alpha\lambda_nG\) gives exponential decay. Adding all the product solutions (superposition) and matching the initial condition with a Fourier series:

\[u(x, t) = \sum_{n=1}^{\infty} b_n\,e^{-\alpha(n\pi/L)^2t}\sin\frac{n\pi x}{L}\]

Each mode decays at its own rate, and the rate grows as \(n^2\). The fine-scale wiggles disappear almost at once, and after a short time only the first mode matters: a single sine arch decaying with time constant \(L^2/(\alpha\pi^2)\).

Worked problem

Quenching a steel plate

A steel plate 50 mm thick (α = 1.2 × 10⁻⁵ m²/s) is uniformly 100 °C above the bath temperature when both faces are suddenly brought to the bath temperature. Estimate the excess temperature at mid-thickness after 60 s.

Show solution
  1. From the previous example, \(b_n = 400/(n\pi)\) for odd n.
  2. First-mode time constant: \(L^2/(\alpha\pi^2) = 0.0025/(1.2 \times 10^{-5} \times 9.87) = 21.1\) s.
  3. At \(x = L/2\), \(t = 60\) s: \(u \approx \dfrac{400}{\pi}e^{-60/21.1}\sin\dfrac{\pi}{2} = 127.3 \times 0.0582 = 7.4\) °C.
  4. The n = 3 term contains \(e^{-9 \times 60/21.1} \approx 10^{-11}\): negligible.

Answer: About 7.4 °C above the bath. One term of the series is enough after a time of roughly 0.2L²/α, which is the basis of the one-term approximations and charts used in heat transfer design. Halving the thickness cuts the time constant by four.

Graph of temperature excess across the plate thickness at times 0.5, 5, 20, 40 and 60 seconds. At 0.5 seconds the profile is flat at 100 with steep drops at both faces. Later profiles become sine-shaped arches that shrink, to about 7 degrees at the centre at 60 seconds.
Temperature through a quenched plate: the profile quickly becomes a decaying sine arch.

The wave equation: a plucked string

For a string fixed at \(x = 0\) and \(x = L\), separation of variables gives the same space eigenfunctions, but the time equation is now \(G'' = -c^2\lambda_nG\), which oscillates. The solution is a sum of the normal modes found in Lesson 6:

\[u(x, t) = \sum_{n=1}^{\infty}\left(A_n\cos\omega_nt + B_n\sin\omega_nt\right)\sin\frac{n\pi x}{L}, \qquad \omega_n = \frac{n\pi c}{L}\]

The coefficients \(A_n\) are the sine series coefficients of the initial shape and the \(B_n\) come from the initial velocity. Unlike the heat equation, no mode decays (without damping), so the mix of modes set up at the start persists and determines the sound or vibration.

Worked problem

Where to pluck

A string is pulled aside to height h at its midpoint, forming a triangle, and released from rest. Find the amplitudes of its modes.

Show solution
  1. Initial velocity is zero, so \(B_n = 0\).
  2. The sine coefficients of the triangle are \(A_n = \dfrac{8h}{n^2\pi^2}\sin\dfrac{n\pi}{2}\).
  3. So \(A_1 = 0.81h\), \(A_2 = 0\), \(A_3 = -0.090h\), \(A_4 = 0\), \(A_5 = 0.032h\).

Answer: Only odd harmonics are present, and they fall off as 1/n², so the tone is dominated by the fundamental. Plucking at the centre cannot excite even modes, because they have a node there. Guitarists pluck near the bridge for a brighter sound, which excites more high harmonics; engineers apply the same idea in reverse, placing dampers and sensors away from the nodes of the modes they want to control.

D'Alembert found another form of the solution, \(u = F(x - ct) + G(x + ct)\): two shapes travelling in opposite directions at speed c, reflecting at the ends. The modal sum and the travelling waves are two descriptions of the same motion.

Laplace's equation in a rectangle

For the steady temperature in a rectangular plate \(0 < x < L\), \(0 < y < H\), with the bottom edge held at \(T_0\) and the other three edges at 0, separation \(u = X(x)Y(y)\) gives the sine eigenfunctions in x again, while the y equation \(Y'' = (n\pi/L)^2Y\) has hyperbolic solutions. Choosing the combination that vanishes at the top edge:

\[u(x, y) = \sum_{n \text{ odd}} \frac{4T_0}{n\pi}\,\sin\frac{n\pi x}{L}\;\frac{\sinh\left(n\pi(H - y)/L\right)}{\sinh\left(n\pi H/L\right)}\]
Filled contour plot of steady temperature in a square plate whose bottom edge is held at T zero and other edges at zero. Temperature is highest along the bottom edge and falls toward the top and sides. Contour lines at 0.1, 0.25, 0.5 and 0.75 of T zero are labelled. The centre of the plate lies on the 0.25 contour.
Steady temperature in a square plate with one heated edge; the centre is at exactly a quarter of T₀.

Worked problem

A check by symmetry

For a square plate (H = L), evaluate the series at the centre and compare with a symmetry argument.

Show solution
  1. At the centre, \(\sin(n\pi/2) = \pm 1\) and the sinh ratio is \(\sinh(n\pi/2)/\sinh(n\pi)\). The first term is \(\tfrac{4}{\pi} \times 0.1993 = 0.254\); the n = 3 term is \(-\tfrac{4}{3\pi} \times 0.00898 = -0.0038\); the series quickly settles at \(0.250\,T_0\).
  2. Symmetry: if each of the four edges in turn were heated to \(T_0\), the four solutions would add (superposition) to a plate entirely at \(T_0\). By symmetry each contributes equally at the centre.

Answer: The centre is at T₀/4, which the series reproduces. Checks like this, superposition and symmetry, catch errors in analytical and numerical solutions alike.

Numerical solution by finite differences

Separation of variables needs simple shapes and linear equations. For everything else, engineers discretize. The finite-difference method replaces derivatives with differences on a grid: for the heat equation, with spacing \(\Delta x\) and time step \(\Delta t\),

\[u_i^{k+1} = u_i^k + r\left(u_{i+1}^k - 2u_i^k + u_{i-1}^k\right), \qquad r = \frac{\alpha\,\Delta t}{\Delta x^2}\]

This explicit scheme is simple but is stable only if \(r \le \tfrac{1}{2}\); larger time steps make errors grow explosively. The code compares it with the series for the quenched plate.

Mid-plane temperature of the quenched plate from the Fourier series and from an explicit finite-difference scheme.
import numpy as np

# Steel plate 50 mm thick, initially 100 C above the bath, faces at bath temperature
alpha, L, U = 1.2e-5, 0.05, 100.0

def series(x, t, terms):
    u = 0.0
    for n in range(1, 2 * terms, 2):
        u += 4 * U / (n * np.pi) * np.exp(-alpha * (n * np.pi / L)**2 * t) * np.sin(n * np.pi * x / L)
    return u

def finite_difference(t_end, nx=51, r=0.4):
    dx = L / (nx - 1)
    dt = r * dx**2 / alpha
    steps = int(round(t_end / dt))
    dt = t_end / steps
    r = alpha * dt / dx**2
    u = np.full(nx, U)
    u[0] = u[-1] = 0.0
    for _ in range(steps):
        u[1:-1] = u[1:-1] + r * (u[2:] - 2 * u[1:-1] + u[:-2])
    return u[nx // 2], r

for t in [5, 20, 60]:
    one = series(L / 2, t, 1)
    many = series(L / 2, t, 200)
    fd, r = finite_difference(t)
    print(f"t = {t:2d} s: series 1 term {one:6.2f}, 200 terms {many:6.2f}, finite difference {fd:6.2f} (r = {r:.3f})")

fd_bad, r_bad = finite_difference(60, r=0.55)
print(f"Explicit scheme with r = {r_bad:.3f}: mid-plane value {fd_bad:.3g} (unstable)")
Output
t =  5 s: series 1 term 100.47, 200 terms  95.50, finite difference  95.51 (r = 0.400)
t = 20 s: series 1 term  49.37, 200 terms  49.36, finite difference  49.32 (r = 0.400)
t = 60 s: series 1 term   7.42, 200 terms   7.42, finite difference   7.41 (r = 0.400)
Explicit scheme with r = 0.550: mid-plane value -6.18e+101 (unstable)

The series converges quickly once t is not tiny, and the finite-difference result agrees to a fraction of a degree. With r just above ½, the same scheme produces nonsense. Commercial finite element and finite volume programs solve the same equations on complex three-dimensional geometries, and they are checked against exact solutions such as these.

Common mistakes

  • MistakeSeparating variables when the boundary conditions are not zero.

    InsteadSubtract the steady-state solution first so that the remaining problem has homogeneous boundary conditions.

  • MistakeForgetting the factor 2/L in the sine coefficients.

    Insteadbₙ = (2/L)∫₀ᴸ f(x) sin(nπx/L) dx.

  • MistakeKeeping many terms of a heat series at long times.

    InsteadHigher modes decay as e^(−n²t/τ); one term is often enough.

  • MistakeExpecting the wave equation's modes to decay like the heat equation's.

    InsteadUndamped wave modes oscillate forever; only damping removes them.

  • MistakeChoosing a large time step in an explicit scheme.

    InsteadKeep r = αΔt/Δx² ≤ ½ for stability.

Summary and key terms

  • The heat, wave and Laplace equations are the prototypes of parabolic, hyperbolic and elliptic PDEs.
  • Fourier sine series represent functions on an interval; bₙ = (2/L)∫ f sin(nπx/L) dx, by orthogonality.
  • Separation of variables reduces a PDE to ODEs and an eigenvalue problem.
  • Heat-equation modes decay as e^(−α(nπ/L)²t); after a short time only the first mode remains.
  • Wave-equation modes oscillate at ωₙ = nπc/L; the initial shape decides which are excited.
  • Laplace's equation in a rectangle gives sine series in one direction and sinh functions in the other.
  • Finite differences solve PDEs numerically; the explicit heat scheme needs r ≤ ½.
Partial differential equation
An equation involving partial derivatives with respect to more than one variable.
Thermal diffusivity
α = k/(ρcₚ), the rate at which temperature changes spread.
Heat equation
u_t = αu_xx, governing conduction and diffusion.
Wave equation
u_tt = c²u_xx, governing vibrating strings and waves.
Laplace's equation
u_xx + u_yy = 0, governing steady states.
Fourier series
A representation of a function as a sum of sines and cosines.
Gibbs phenomenon
The persistent overshoot of Fourier partial sums near a jump.
Separation of variables
Seeking solutions as products of functions of single variables.
Finite-difference method
Approximating derivatives by differences on a grid.

Practice problems

Work each problem on paper first, then reveal the answer to check.

  1. Find the sine series coefficients of f(x) = x on 0 < x < π.

    Show answer

    bₙ = 2(−1)^(n+1)/n.

  2. Which harmonics appear in the sine series of a constant?

    Show answer

    Only odd n, with bₙ = 4U/(nπ).

  3. A copper bar (α = 1.1 × 10⁻⁴ m²/s) is 0.2 m long with ends held at 0. Find the first-mode time constant.

    Show answer

    L²/(απ²) = 0.04/(1.1 × 10⁻⁴ × 9.87) = 37 s.

  4. By what factor does the third heat mode decay faster than the first?

    Show answer

    9 times faster.

  5. In the quench example, estimate the mid-plane excess after 30 s.

    Show answer

    127.3 e^(−30/21.1) = 30.7 °C.

  6. A string has c = 300 m/s and L = 0.6 m. Find its fundamental frequency in hertz.

    Show answer

    f₁ = c/(2L) = 250 Hz.

  7. A string is plucked at its midpoint. Which mode has zero amplitude: 2, 3 or 5?

    Show answer

    Mode 2 (all even modes have a node at the centre).

  8. Separate variables in u_t = αu_xx and state the two ODEs.

    Show answer

    X″ + λX = 0 and G′ + αλG = 0.

  9. For an explicit heat scheme with α = 1.2 × 10⁻⁵ m²/s and Δx = 1 mm, what is the largest stable time step?

    Show answer

    Δt ≤ ½Δx²/α = 0.042 s.

  10. A square plate has the top edge at 80 °C and the other edges at 20 °C. What is the centre temperature?

    Show answer

    20 + 60/4 = 35 °C.

Lesson quiz · 5 questions

Score 60% or more to complete this lesson.

Take the quiz