advanced36 min studyLesson 79 in Mathematics

Finite differences: consistency and stability

Separate local truncation error from error amplification and apply the Lax equivalence principle within its actual hypotheses.

On this page

What you’ll understand

  • Derive the explicit heat stencil and its local truncation error.
  • Use a Fourier amplification factor to test periodic-grid stability.
  • State the scope of consistency plus stability implying convergence.

Replacing derivatives by differences can produce an update that looks exactly like the intended PDE yet amplifies tiny errors until the computed result becomes meaningless. Accuracy of the local formula and stability of repeated updates are separate questions. The heat equation offers a complete small example: its explicit stencil is easy to derive, and one dimensionless ratio determines whether a periodic-grid Fourier mode grows. The useful conclusion comes from combining the two analyses with a well-posed continuum problem.

Consistency asks what equation the stencil approximates

On a uniform grid x_j=jh and times t_n=nk, approximate the heat equation by a forward time difference and a centered second spatial difference. The update is U_j^(n+1)=U_j^n+r(U_(j+1)^n−2U_j^n+U_(j−1)^n), where r=κk/h². Insert a sufficiently smooth exact solution into the difference equation, divide by k in the residual convention, and expand in Taylor series. The residual is O(k+h²) on a bounded time interval if the needed time and fourth spatial derivatives stay uniformly bounded.

That statement concerns the scheme's agreement with the PDE on smooth inputs, not the computed solution's global error. It also depends on implementing initial and boundary data consistently. A second-order interior stencil can still have poor overall accuracy if a boundary approximation is first order or imposes the wrong condition. The time and spatial step sizes are not independent when stability restricts their ratio. Refining only h with k fixed can make the method less stable even though the centered spatial derivative becomes more accurate as a local formula.

Ujn+1=(1−2r)Ujn+rUj−1n+rUj+1n,r=κkh2,τ=O(k+h2)U_j^{n+1}=(1-2r)U_j^n+rU_{j-1}^n+rU_{j+1}^n,\qquad r=\frac{\kappa k}{h^2},\qquad \tau=O(k+h^2)
This is forward Euler in time and a centered second difference in space. The truncation residual uses the difference equation divided by k, with sufficiently smooth exact solutions and consistent data discretization.↔ Scroll wide equations horizontally.

Stability controls repeated amplification

For a periodic grid, insert a Fourier error mode exp(ijθ) into the linear update. Its amplification factor is G(θ)=1−4r sin²(θ/2). Discrete L2 stability over repeated time steps requires |G(θ)|≤1 for all resolvable frequencies, giving 0≤r≤1/2. At r=1/2 the highest alternating mode has G=−1, so it changes sign without decaying. For r>1/2 that mode has magnitude greater than one and grows. A stable discretization need not reproduce every physical decay rate exactly, especially near the resolution limit.

There is also a direct maximum-norm argument when 0≤r≤1/2: each new grid value is a convex combination of its old value and its two neighbors. With compatible boundary handling, it cannot create a larger absolute maximum than the data already supply. Outside that range the central coefficient is negative and this argument fails. Fourier analysis here uses periodicity; a bounded interval with other boundary stencils requires the stability analysis of the complete discrete operator, not a claim that the interior symbol alone proves everything.

G(θ)=1−4rsin⁡2(θ/2),∣G(θ)∣≤1 for all θ  ⟺  0≤r≤12G(\theta)=1-4r\sin^2(\theta/2),\qquad |G(\theta)|\leq1\ \text{for all }\theta\iff 0\leq r\leq\frac12
The amplification test applies to the explicit heat stencil on a periodic uniform grid with κ≥0. At the limiting ratio, the grid-scale alternating mode is bounded but not damped.↔ Scroll wide equations horizontally.

Convergence needs a theorem with hypotheses

The Lax–Richtmyer equivalence theorem concerns consistent linear approximations of a well-posed linear initial-value problem in an appropriate normed-space framework. With its approximation and time-step hypotheses, stability is equivalent to convergence on fixed finite time intervals. The proof tracks an error recurrence: each step introduces a small truncation defect, and a uniform bound on the discrete evolution prevents accumulated defects from exploding. This is not an unconditional guarantee for every nonlinear scheme, arbitrary discontinuous solution, or changing boundary treatment. Nonlinear conservation laws need additional structure such as entropy consistency and compactness.

The optimization lab provides an inspectable scalar amplification analogy. Its quadratic gradient iteration multiplies x by 1−η each step. Choose η below two, then above two, to compare shrinking and growing iterates; reset before making a comparison. This is not the heat stencil, and η is not automatically the heat ratio r. For one particular Fourier mode, the analogy uses η=4r sin²(θ/2), which changes with frequency. The lab illustrates repeated multiplication; the stencil analysis supplies the full range of modes and its PDE-specific stability restriction.

A locally accurate stencil can amplify grid noise

Take κ=1, h=0.1, and time step k=0.006 on a periodic grid with an even number of points. Analyze the alternating error mode.

  1. Compute r=κk/h²=0.006/0.01=0.6, which exceeds the explicit stability threshold 1/2. The centered difference remains a consistent spatial approximation as part of a refining family, but this chosen ratio is unstable.

  2. For the alternating mode θ=π, sin²(θ/2)=1. Thus G=1−4·0.6=−1.4: each step flips the error sign and multiplies its magnitude by 1.4.

  3. After ten steps, its magnitude is multiplied by 1.4^10≈28.9255. An initial amplitude 0.001 has become about 0.0289255 in simulated time 0.06.

  4. Reduce k to 0.004 while keeping h fixed. Then r=0.4 and the same mode has G=−0.6, so after ten steps its amplitude is 0.001·0.6^10≈0.0000060466.

The result

The unstable ratio amplifies high-frequency noise by about 28.9 in ten updates; the stable ratio damps that same mode.

Explore the model

Interactive lab

Interactive lab · optimization

Observe a scalar amplification factor

Change η in x_n=(1−η)^n x₀ for the quadratic f=x²/2. Compare η=1.6 and η=2.4, resetting between runs: the multiplier is −0.6 or −1.4. This is an analogy to one heat-stencil Fourier mode, not a spatial PDE solver or an automatic identification of η with r.

Observe a scalar amplification factorGradient descent on f(x) = x²/2: xₙ = (1 − η)ⁿx₀. Playback advances two discrete iterations per second. Values outside |x| ≤ 4 are explicitly reported. Current readings: Position x0: 2; Objective x²/2: 2; Iteration behavior: Stable step. All parameters are adjustable with the labeled controls below.−4−202402.174.356.528.7Parameter xf(x) = x²/2n = 0
ObjectiveDiscrete iterate
Position x0
2
Objective x²/2
2
Iteration behavior
Stable step
n = 0 · t = 0 s

Gradient descent on f(x) = x²/2: xₙ = (1 − η)ⁿx₀. Playback advances two discrete iterations per second. Values outside |x| ≤ 4 are explicitly reported. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.

Look forRepeated multiplication can overwhelm a small starting error when its factor has magnitude above one.

Check your understanding

What happens if h is halved while k and κ remain fixed in the explicit heat stencil?

Try it yourself

With κ=0.2 and h=0.05, determine the largest time step allowed by the stated periodic-grid explicit L2 stability test. What happens to the alternating mode exactly at that step?

Take a moment to make a prediction or work it out on paper. Open a hint when you need one.

Give me a hint

Solve κk/h²≤1/2 and substitute r=1/2 into G(π).

Compare with the solution

The bound is k≤h2/(2κ)=0.0025/0.4=0.00625k\leq h^2/(2\kappa)=0.0025/0.4=0.00625. At equality the alternating mode has G=1−4(1/2)=−1, so it flips sign without decreasing in magnitude. The update is stable in the stated norm but does not reproduce the physical damping of this grid-scale component. Choosing a smaller step restores strict damping of that component.

Take it with you

  • Consistency measures the stencil's local equation error.
  • Stability measures amplification by the complete discrete evolution.
  • Lax equivalence has linear well-posed-problem hypotheses and a specified norm framework.

Read further

Original sources and deeper explanations to follow at your own pace.

Optional progress, saved in this browser when available. Revisit any lesson at any time.

Lesson not marked complete.