Book 6D

© 2026 NeckPinch · www.neckpinch.com · All rights reserved.

Course 6Book 6D: Diffusions, Finance and ComputationChapter 9

Finite Difference Methods

Explicit, implicit and Crank–Nicolson schemes, consistency, stability and the Lax equivalence theorem.

37 min read · Updated Oct 20, 2026

Read with Morton and Mayers, Numerical Solution of Partial Differential Equations (chapters 2–5: parabolic equations, stability and convergence, hyperbolic equations), or LeVeque, Finite Difference Methods for Ordinary and Partial Differential Equations (chapters 9–10); Jost, Partial Differential Equations, section 4.1 (the discrete Laplacian and its maximum principle); and Taylor I, chapter 3 (Fourier series, including the discrete Fourier transform). Wilmott, Howison and Dewynne, The Mathematics of Financial Derivatives, chapter 8, treats the Black–Scholes grid. This chapter proves the truncation error estimates, stability by the discrete maximum principle and by von Neumann analysis, the convergence theorem (the easy half of Lax equivalence), the CFL condition, and the Thomas algorithm; the full Lax equivalence theorem is stated. The numerical results quoted were computed for this chapter.

In this chapter · 10 sections
  1. 9.1Forecasting the weather by hand
  2. 9.2Grids and truncation error
  3. 9.3Stability by the maximum principle
  4. 9.4Von Neumann analysis
  5. 9.5Convergence: the Lax equivalence theorem
  6. 9.6Solving the implicit equations: the Thomas algorithm
  7. 9.7Transport, waves and the CFL condition
  8. 9.8Spectral methods and the FFT
  9. 9.9History
  10. 9.10Exercises
  11. ↗Free resources

Most PDE cannot be solved by formula, and even when they can (the heat equation, Black–Scholes) the formula is often less useful than a number. Finite difference methods replace derivatives by difference quotients on a grid and the PDE by a large system of algebraic equations. They are the oldest and most transparent numerical methods for PDE, they are what most option pricing software does when no formula exists, and they carry the analytic ideas of Course 6 into the discrete world: the maximum principle becomes a condition on the time step, Fourier analysis becomes von Neumann stability analysis, and well-posedness becomes stability.

The central lesson is the Lax equivalence theorem: a consistent scheme converges if and only if it is stable. Consistency (the scheme approximates the PDE) is easy to check by Taylor expansion and almost never fails. Stability (errors do not grow) is the real constraint, and ignoring it gives nonsense: the explicit scheme for the heat equation, run with a time step 5%5\% above its stability limit, turns an option price of 10.4510.45 into about 300300, and 20%20\% above, into −3×1012-3\times10^{12} (Exercise 9.13).

By the end of this chapter you will be able to:

  • derive the explicit, implicit and Crank–Nicolson schemes for the heat equation and compute their truncation errors;
  • prove stability of the explicit scheme for r=k/h2≤12r = k/h^2 \leq \frac12 by the discrete maximum principle, and compute amplification factors by von Neumann analysis;
  • prove that a consistent, stable scheme converges with the order of its truncation error;
  • explain the CFL condition for transport and wave equations, and why upwinding is needed;
  • solve tridiagonal systems in linear time, and set up a Black–Scholes solver in log-price with correct boundary conditions;
  • describe spectral methods and the FFT.

Forecasting the weather by hand

In the world Data Richardson's forecast

During the First World War, while serving as an ambulance driver on the Western Front, Lewis Fry Richardson computed a weather forecast by hand. He took the observed state of the atmosphere over central Europe at 7 a.m. on 20 May 1910, discretised the equations of fluid dynamics on a grid of cells, and stepped them forward six hours. The calculation took him weeks. His result, published in Weather Prediction by Numerical Process (1922), predicted a surface pressure change of about 145145 hectopascals in six hours at one point, an absurd value: real pressure changes over six hours are a few hectopascals. The failure is now understood to come mainly from imbalances in the initial data, which excited fast gravity waves that the equations then amplified, a stability problem of the kind this chapter analyses.

In 1928 Richard Courant, Kurt Friedrichs and Hans Lewy explained one essential constraint: an explicit scheme cannot converge unless its time step is small enough that the numerical domain of dependence contains the true one (the CFL condition). John von Neumann developed Fourier stability analysis at Los Alamos in the 1940s, and in 1950 Jule Charney, Ragnar Fjørtoft and von Neumann made the first successful computer forecast, on the ENIAC, using a simplified equation chosen to filter out the fast waves. Modern weather and climate models, and the solvers behind every engineering simulation, rest on the stability theory that grew out of these episodes.

Grids and truncation error

Consider the heat equation ut=uxxu_t = u_{xx} on 0<x<10 < x < 1, t>0t > 0, with u(0,t)=u(1,t)=0u(0, t) = u(1, t) = 0 and u(x,0)=g(x)u(x, 0) = g(x). Choose a space step h=1Jh = \frac1J and a time step kk, grid points xj=jhx_j = jh, tn=nkt_n = nk, and approximations Ujn≈u(xj,tn)U^n_j \approx u(x_j, t_n). The basic difference quotients are

Ujn+1−Ujnk≈ut,δ2Uj=Uj+1−2Uj+Uj−1h2≈uxx.\frac{U^{n+1}_j - U^n_j}{k} \approx u_t, \qquad \delta^2U_j = \frac{U_{j+1} - 2U_j + U_{j-1}}{h^2} \approx u_{xx}.

The ratio

r=kh2r = \frac{k}{h^2}

will govern stability: the heat equation's scaling (6A.3 The Heat Equation on ℝⁿ) says one unit of time is worth two units of space, and so does the grid.

The explicit (forward Euler) scheme evaluates δ2\delta^2 at the old time level:

Ujn+1=Ujn+r(Uj+1n−2Ujn+Uj−1n).(E)U^{n+1}_j = U^n_j + r\big(U^n_{j+1} - 2U^n_j + U^n_{j-1}\big). \tag{E}

The truncation error τjn\tau^n_j is what is left when the exact solution is put into the scheme, written as an approximation of the PDE:

τjn=u(xj,tn+1)−u(xj,tn)k−δ2u(xj,tn).\tau^n_j = \frac{u(x_j, t_{n+1}) - u(x_j, t_n)}{k} - \delta^2u(x_j, t_n).

A scheme is consistent if τ→0\tau \to 0 as h,k→0h, k \to 0, and has order (p,q)(p, q) if τ=O(kp+hq)\tau = O(k^p + h^q).

Proposition 9.1 Truncation error of the explicit scheme

If uu is smooth, τjn=k2utt−h212uxxxx+O(k2+h4)\tau^n_j = \frac k2u_{tt} - \frac{h^2}{12}u_{xxxx} + O(k^2 + h^4), evaluated at (xj,tn)(x_j, t_n). In particular ∣τ∣≤k2∥utt∥∞+h212∥uxxxx∥∞|\tau| \leq \frac k2\|u_{tt}\|_\infty + \frac{h^2}{12}\|u_{xxxx}\|_\infty: the scheme is first order in time and second order in space.

Proof. By Taylor's theorem in tt, u(x,t+k)−u(x,t)k=ut+k2utt(x,t+ϑk)\frac{u(x, t + k) - u(x, t)}{k} = u_t + \frac k2u_{tt}(x, t + \vartheta k). In xx, u(x±h)=u±hux+h22uxx±h36uxxx+h424uxxxx(ξ±)u(x \pm h) = u \pm hu_x + \frac{h^2}{2}u_{xx} \pm \frac{h^3}{6}u_{xxx} + \frac{h^4}{24}u_{xxxx}(\xi_\pm), and adding, the odd terms cancel: δ2u=uxx+h212uxxxx(ξ)\delta^2u = u_{xx} + \frac{h^2}{12}u_{xxxx}(\xi) for some ξ\xi (by the intermediate value theorem applied to the average of the two fourth derivatives). Subtract, and use ut=uxxu_t = u_{xx}.

If r=16r = \frac16, the leading terms cancel: since utt=uxxxxu_{tt} = u_{xxxx} for the heat equation, k2utt−h212uxxxx=h22(r−16)uxxxx=0\frac k2u_{tt} - \frac{h^2}{12}u_{xxxx} = \frac{h^2}{2}\big(r - \frac16\big)u_{xxxx} = 0, and the scheme becomes fourth order in space, a curiosity known since the 1950s.

Stability by the maximum principle

Theorem 9.2 Convergence of the explicit scheme

If r≤12r \leq \frac12, the explicit scheme (E) satisfies the discrete maximum principle max⁡j∣Ujn+1∣≤max⁡j∣Ujn∣\max_j|U^{n+1}_j| \leq \max_j|U^n_j|, and its error ejn=Ujn−u(xj,tn)e^n_j = U^n_j - u(x_j, t_n) satisfies

max⁡j∣ejn∣≤tnmax⁡m<n, j∣τjm∣≤tn(k2∥utt∥∞+h212∥uxxxx∥∞).\max_j|e^n_j| \leq t_n\max_{m<n,\,j}|\tau^m_j| \leq t_n\Big(\frac k2\|u_{tt}\|_\infty + \frac{h^2}{12}\|u_{xxxx}\|_\infty\Big).

Proof. Rewrite (E) as Ujn+1=rUj+1n+(1−2r)Ujn+rUj−1nU^{n+1}_j = rU^n_{j+1} + (1 - 2r)U^n_j + rU^n_{j-1}. For r≤12r \leq \frac12 the coefficients are non-negative and sum to 11: each new value is a weighted average of old values, so it lies between their minimum and maximum (with the zero boundary values included). That is the discrete maximum principle, the counterpart of 6A.5 Maximum Principles.

The exact solution satisfies the same scheme up to the truncation error: ujn+1=ruj+1n+(1−2r)ujn+ruj−1n+kτjnu^{n+1}_j = ru^n_{j+1} + (1 - 2r)u^n_j + ru^n_{j-1} + k\tau^n_j. Subtracting, the error satisfies

ejn+1=rej+1n+(1−2r)ejn+rej−1n−kτjn,e^{n+1}_j = re^n_{j+1} + (1 - 2r)e^n_j + re^n_{j-1} - k\tau^n_j,

with e0=0e^0 = 0 and zero boundary errors. By the averaging property, max⁡j∣ejn+1∣≤max⁡j∣ejn∣+kmax⁡j∣τjn∣\max_j|e^{n+1}_j| \leq \max_j|e^n_j| + k\max_j|\tau^n_j|, and summing over nn steps gives the bound.

The proof has a structure worth isolating, because it is general: the error obeys the scheme with the truncation error as a source, and stability (the scheme does not amplify) turns a bound on the source into a bound on the solution, accumulated over n=tn/kn = t_n/k steps. Each step contributes kτk\tau, and there are tn/kt_n/k of them, so the global error is of the same order as the local truncation error.

If r>12r > \frac12 the coefficient 1−2r1 - 2r is negative, the averaging property is lost, and the scheme is unstable: the grid mode (−1)j(-1)^j is multiplied by 1−4r<−11 - 4r < -1 at every step (Exercise 9.6).

Von Neumann analysis

On a periodic grid (or ignoring boundaries), every scheme with constant coefficients maps the discrete Fourier mode Uj=eijθU_j = e^{ij\theta} (−π<θ≤π-\pi < \theta \leq \pi) to a multiple ξ(θ)eijθ\xi(\theta)e^{ij\theta}, where the amplification factor ξ(θ)\xi(\theta) is found by substitution. For the explicit scheme,

ξ(θ)=1+r(eiθ−2+e−iθ)=1−4rsin⁡2θ2.\xi(\theta) = 1 + r\big(e^{i\theta} - 2 + e^{-i\theta}\big) = 1 - 4r\sin^2\frac\theta2.

Since a general grid function is a sum of modes (the discrete Fourier transform), and the scheme acts on each independently, the scheme is stable in ℓ2\ell^2 exactly when ∣ξ(θ)∣≤1+Ck|\xi(\theta)| \leq 1 + Ck for all θ\theta: the von Neumann condition (for single-step scalar schemes with constant coefficients it is necessary and sufficient; Morton and Mayers, section 2.7). For (E), ξ\xi ranges over [1−4r,1][1 - 4r, 1], and ∣ξ∣≤1|\xi| \leq 1 iff r≤12r \leq \frac12, the same condition the maximum principle gave. The most dangerous mode is θ=π\theta = \pi, the sawtooth (−1)j(-1)^j, which no smooth solution contains but rounding errors always do.

Implicit schemes. The backward Euler scheme evaluates δ2\delta^2 at the new time level,

Ujn+1−rUj+1n+1+2rUjn+1−rUj−1n+1=Ujn,U^{n+1}_j - rU^{n+1}_{j+1} + 2rU^{n+1}_j - rU^{n+1}_{j-1} = U^n_j,

with ξ(θ)=11+4rsin⁡2(θ/2)∈(0,1]\xi(\theta) = \frac{1}{1 + 4r\sin^2(\theta/2)} \in (0, 1]: unconditionally stable, for every rr. It also satisfies the discrete maximum principle for every rr (Exercise 9.7). The price is that each step requires solving a linear system, and the truncation error is still O(k+h2)O(k + h^2). The Crank–Nicolson scheme (John Crank and Phyllis Nicolson, 1947) averages the two:

Ujn+1−Ujnk=12(δ2Ujn+1+δ2Ujn),ξ(θ)=1−2rsin⁡2(θ/2)1+2rsin⁡2(θ/2).\frac{U^{n+1}_j - U^n_j}{k} = \frac12\big(\delta^2U^{n+1}_j + \delta^2U^n_j\big), \qquad \xi(\theta) = \frac{1 - 2r\sin^2(\theta/2)}{1 + 2r\sin^2(\theta/2)}.

It is centred at tn+1/2t_{n+1/2}, hence second order in time, τ=O(k2+h2)\tau = O(k^2 + h^2), and ∣ξ∣≤1|\xi| \leq 1 for all rr. But as rsin⁡2θ2→∞r\sin^2\frac\theta2 \to \infty, ξ→−1\xi \to -1: high-frequency modes are not damped but flip sign at every step. For smooth data this is harmless; for data with a kink, like an option payoff, it produces slowly decaying oscillations near the kink, visible in the computed delta and gamma. The standard cure (Rolf Rannacher, 1984) is to take the first few steps with backward Euler, which damps high frequencies strongly, and then switch to Crank–Nicolson.

Convergence: the Lax equivalence theorem

Write a linear one-step scheme as Un+1=SkUnU^{n+1} = S_kU^n (for implicit schemes SkS_k includes the inverse of the implicit matrix), with SkS_k acting on grid functions with some norm ∥⋅∥\|\cdot\|. The scheme is stable if ∥Skn∥≤C\|S_k^n\| \leq C for nk≤Tnk \leq T, uniformly as h,k→0h, k \to 0 along the chosen refinement path (for example rr fixed).

Theorem 9.3 Consistency and stability imply convergence

If the scheme is stable with constant CC and the exact solution satisfies un+1=Skun+kτnu^{n+1} = S_ku^n + k\tau^n with ∥τn∥≤ε(h,k)→0\|\tau^n\| \leq \varepsilon(h, k) \to 0, then for nk≤Tnk \leq T,

∥Un−un∥≤C T ε(h,k).\|U^n - u^n\| \leq C\,T\,\varepsilon(h, k).

Conversely (the Lax equivalence theorem, Peter Lax and Robert Richtmyer, 1956; statement), for a consistent scheme approximating a well-posed linear initial value problem, convergence for all initial data implies stability.

Proof. The error en=Un−une^n = U^n - u^n satisfies en+1=Sken−kτne^{n+1} = S_ke^n - k\tau^n with e0=0e^0 = 0, so en=−k∑m=0n−1Skn−1−mτme^n = -k\sum_{m=0}^{n-1}S_k^{n-1-m}\tau^m and ∥en∥≤k∑m<nCε=Cnkε≤CTε\|e^n\| \leq k\sum_{m<n}C\varepsilon = Cnk\varepsilon \leq CT\varepsilon.

The converse is a consequence of the uniform boundedness principle (4A.2 Baire Category and Its Consequences): if the scheme converged for every initial value but ∥Skn∥\|S_k^n\| were unbounded, Banach–Steinhaus would produce initial data for which the computed solutions are unbounded, contradicting convergence. So for linear problems the theory is complete: convergence = consistency + stability, and the work is in proving stability.

Example 9.4 A Black–Scholes solver

In log-price x=log⁡Sx = \log S and time to expiry τ=T−t\tau = T - t, the Black–Scholes equation (6D.6 Black–Scholes) becomes the constant-coefficient equation

vτ=12σ2vxx+(r−12σ2)vx−rvv_\tau = \frac12\sigma^2v_{xx} + \Big(r - \frac12\sigma^2\Big)v_x - rv

(Exercise 9.10), to be solved forward in τ\tau from the payoff v(x,0)=(ex−K)+v(x, 0) = (e^x - K)^+. Truncate to ∣x−log⁡K∣≤L|x - \log K| \leq L with L=5σTL = 5\sigma\sqrt T (five standard deviations of the log-price) and impose the asymptotic values of a call at the ends: v≈0v \approx 0 for very low prices and v≈S−Ke−rτv \approx S - Ke^{-r\tau} for very high ones. With K=100K = 100, r=0.05r = 0.05, σ=0.2\sigma = 0.2, T=1T = 1, centred differences in xx and Crank–Nicolson in τ\tau, using MM space intervals and MM time steps, the computed at-the-money price differs from the exact value 10.450610.4506 by:

MM Crank–Nicolson error Backward Euler error
5050 −0.0363-0.0363 −0.0576-0.0576
100100 −0.0090-0.0090 −0.0196-0.0196
200200 −0.0022-0.0022 −0.0075-0.0075
400400 −0.0006-0.0006 −0.0032-0.0032

Each halving of the steps divides the Crank–Nicolson error by 44, as second order predicts. The backward Euler error is dominated by its O(k)O(k) time error and falls more slowly. With the explicit scheme on the M=100M = 100 grid, stability requires 12σ2kh2≤12\frac12\sigma^2\frac{k}{h^2} \leq \frac12, that is N≥100N \geq 100 time steps: with N=110N = 110 the error is 0.00050.0005; with N=95N = 95 the computed price is about 303303; with N=80N = 80, about −3×1012-3\times10^{12}.

Solving the implicit equations: the Thomas algorithm

Implicit schemes in one space dimension require, at each time step, the solution of a tridiagonal system

ajUj−1+bjUj+cjUj+1=dj,j=1,…,J−1a_jU_{j-1} + b_jU_j + c_jU_{j+1} = d_j, \qquad j = 1, \ldots, J - 1

(with a1=cJ−1=0a_1 = c_{J-1} = 0 after the boundary values are moved to the right side). Gaussian elimination without pivoting, organised as one forward sweep and one backward sweep, solves it in O(J)O(J) operations:

c1′=c1b1,d1′=d1b1;cj′=cjbj−ajcj−1′,dj′=dj−ajdj−1′bj−ajcj−1′;c'_1 = \frac{c_1}{b_1},\quad d'_1 = \frac{d_1}{b_1}; \qquad c'_j = \frac{c_j}{b_j - a_jc'_{j-1}},\quad d'_j = \frac{d_j - a_jd'_{j-1}}{b_j - a_jc'_{j-1}};
UJ−1=dJ−1′,Uj=dj′−cj′Uj+1.U_{J-1} = d'_{J-1}, \qquad U_j = d'_j - c'_jU_{j+1}.

This is the Thomas algorithm (Llewellyn Thomas, 1949). It is stable, with no pivoting needed, when the matrix is diagonally dominant, ∣bj∣≥∣aj∣+∣cj∣|b_j| \geq |a_j| + |c_j| (Exercise 9.9), which is the case for the implicit heat and Black–Scholes matrices: their diagonal is 1+2r1 + 2r (plus rkrk) and off-diagonals −r-r (plus small drift terms). So an implicit step costs about as much as an explicit one, and the restriction k≤h22k \leq \frac{h^2}{2} disappears. In two or more space dimensions the systems are no longer tridiagonal, and one uses alternating direction implicit (ADI) splittings, which reduce each step to tridiagonal solves in one direction at a time, or iterative solvers.

Transport, waves and the CFL condition

For the transport equation ut+aux=0u_t + au_x = 0 (a>0a > 0), information travels to the right at speed aa (6B.1 First-Order Equations and Characteristics). The explicit scheme with a centred space difference,

Ujn+1=Ujn−ν2(Uj+1n−Uj−1n),ν=akh,U^{n+1}_j = U^n_j - \frac\nu2\big(U^n_{j+1} - U^n_{j-1}\big), \qquad \nu = \frac{ak}{h},

has ξ(θ)=1−iνsin⁡θ\xi(\theta) = 1 - i\nu\sin\theta, with ∣ξ∣2=1+ν2sin⁡2θ>1|\xi|^2 = 1 + \nu^2\sin^2\theta > 1: it is unconditionally unstable, for every time step. The upwind scheme differences in the direction the information comes from,

Ujn+1=Ujn−ν(Ujn−Uj−1n)=(1−ν)Ujn+νUj−1n,U^{n+1}_j = U^n_j - \nu\big(U^n_j - U^n_{j-1}\big) = (1 - \nu)U^n_j + \nu U^n_{j-1},

a weighted average when 0≤ν≤10 \leq \nu \leq 1, hence stable in the maximum norm, and first order accurate.

Proposition 9.5 The Courant–Friedrichs–Lewy condition

An explicit scheme in which Ujn+1U^{n+1}_j depends only on Uj−pn,…,Uj+pnU^n_{j-p}, \ldots, U^n_{j+p} cannot converge for all initial data unless the exact domain of dependence of each grid point is contained in the numerical one. For ut+aux=0u_t + au_x = 0 with the upwind or Lax–Friedrichs stencil (p=1p = 1), this is

∣a∣kh≤1.|a|\frac kh \leq 1.

Proof. After nn steps, UjnU^n_j depends only on initial values in [xj−pnh,xj+pnh][x_j - pnh, x_j + pnh], while the exact solution at (xj,tn)(x_j, t_n) is g(xj−atn)g(x_j - at_n). If ∣a∣tn>pnh|a|t_n > pnh, i.e. ∣a∣kh>p|a|\frac kh > p, the point xj−atnx_j - at_n lies outside the numerical domain of dependence. Changing gg near that point changes the exact solution but not the numerical one, so the scheme cannot converge for both data.

The CFL condition is necessary, not sufficient (the centred scheme satisfies it and is still unstable). For the wave equation utt=c2uxxu_{tt} = c^2u_{xx} the standard leapfrog scheme Ujn+1−2Ujn+Ujn−1k2=c2δ2Ujn\frac{U^{n+1}_j - 2U^n_j + U^{n-1}_j}{k^2} = c^2\delta^2U^n_j is stable exactly when ckh≤1c\frac kh \leq 1 (Exercise 9.11). Note the different scalings: for hyperbolic problems an explicit scheme needs k=O(h)k = O(h), for parabolic problems k=O(h2)k = O(h^2), which is why explicit schemes are natural for waves and implicit ones for diffusion.

Spectral methods and the FFT

For smooth periodic problems, finite differences can be replaced by spectral methods: expand the solution in Fourier modes, u(x,t)=∑ku^k(t)eikxu(x, t) = \sum_k\hat u_k(t)e^{ikx}, differentiate exactly (uxx^=−k2u^k\widehat{u_{xx}} = -k^2\hat u_k), and truncate to ∣k∣<N/2|k| < N/2. For the heat equation on the circle this solves the problem exactly mode by mode, u^k(t)=e−k2tu^k(0)\hat u_k(t) = e^{-k^2t}\hat u_k(0) (6A.6 Weak Solutions and Elliptic Regularity). For smooth solutions the truncation error decays faster than any power of NN, exponentially for analytic solutions, compared with the fixed algebraic rates of finite differences. Nonlinear terms are computed pointwise on the grid and transformed back (pseudospectral methods).

What makes this practical is the fast Fourier transform: the discrete Fourier transform U^k=∑j<NUje−2πijk/N\hat U_k = \sum_{j<N}U_je^{-2\pi ijk/N} of NN values costs O(N2)O(N^2) operations directly but only O(Nlog⁡N)O(N\log N) if NN is a power of 22, by splitting the sum into even and odd jj and recursing (Exercise 9.12). James Cooley and John Tukey published the algorithm in 1965 (Gauss had found it around 1805, in unpublished work on asteroid orbits). In finance, the FFT computes option prices for whole ranges of strikes at once from a model's characteristic function (6D.10 Monte Carlo, Fourier and Finite Element Methods).

Where this goes Numerical geometric flows

The simulations of neckpinches and other singularities of Ricci flow, by David Garfinkle and James Isenberg and others, discretise the rotationally symmetric flow, a parabolic system in one space variable, by finite differences. They face exactly the constraints of this chapter: the explicit stability condition involves the local diffusion coefficient, which grows as curvature concentrates, so the time step must shrink near a singularity (Exercise 9.14). Mean curvature flow is computed by finite elements (6D.10 Monte Carlo, Fourier and Finite Element Methods) or level sets with monotone schemes, which converge to viscosity solutions (6C.9 Hamilton–Jacobi Equations and Viscosity Solutions).

History

Richardson's numerical weather prediction appeared in 1922 and Courant, Friedrichs and Lewy's paper in 1928. John Crank and Phyllis Nicolson published their scheme in 1947. Von Neumann's stability analysis was developed at Los Alamos in the 1940s and described in print around 1950, the year of the ENIAC forecast. Llewellyn Thomas's tridiagonal algorithm dates from 1949, the Lax–Richtmyer equivalence theorem from 1956, and the Cooley–Tukey FFT from 1965. Brennan and Schwartz brought finite differences to option pricing in 1977–78.

Recall Where we stand

Finite difference schemes replace derivatives by difference quotients; their truncation error, found by Taylor expansion, is O(k+h2)O(k + h^2) for explicit and backward Euler and O(k2+h2)O(k^2 + h^2) for Crank–Nicolson. The explicit heat scheme is a weighted average, hence stable and convergent, iff r=k/h2≤12r = k/h^2 \leq \frac12; von Neumann analysis gives the amplification factors 1−4rsin⁡2θ21 - 4r\sin^2\frac\theta2, (1+4rsin⁡2θ2)−1(1 + 4r\sin^2\frac\theta2)^{-1} and 1−2rsin⁡2(θ/2)1+2rsin⁡2(θ/2)\frac{1 - 2r\sin^2(\theta/2)}{1 + 2r\sin^2(\theta/2)}. Consistency plus stability gives convergence with error CTεCT\varepsilon (and conversely, by Lax equivalence). Tridiagonal systems cost O(J)O(J) by the Thomas algorithm. For transport, centred explicit schemes are unstable, upwinding works for ∣a∣k/h≤1|a|k/h \leq 1, and the CFL condition is necessary for every explicit scheme. A Black–Scholes solver in log-price with Crank–Nicolson converges at second order. Spectral methods with the FFT converge faster than any power for smooth periodic problems. 6D.10 Monte Carlo, Fourier and Finite Element Methods covers the other two pillars of computation: Monte Carlo and finite elements.

Exercises

Exercise 9.6 Watching the explicit scheme explode

Apply (E) on a periodic grid with r=1r = 1 to the initial data Uj0=ε(−1)jU^0_j = \varepsilon(-1)^j. Show that Ujn=(−3)nε(−1)jU^n_j = (-3)^n\varepsilon(-1)^j, and compute the size after 1010 steps for ε=10−16\varepsilon = 10^{-16} (a rounding error). What is the exact solution of the heat equation with data of this kind as h→0h \to 0?

Solution

Uj1=ε(−1)j(1+r(−1−2−1))=(1−4r)ε(−1)j=−3ε(−1)jU^1_j = \varepsilon(-1)^j\big(1 + r(-1 - 2 - 1)\big) = (1 - 4r)\varepsilon(-1)^j = -3\varepsilon(-1)^j. After 1010 steps the amplitude is 310×10−16≈5.9×10−123^{10}\times10^{-16} \approx 5.9\times10^{-12}; after 4040 steps, 340×10−16≈1.2×1033^{40}\times10^{-16} \approx 1.2\times10^3. The exact heat flow damps the mode eiπx/he^{i\pi x/h} by e−π2t/h2e^{-\pi^2t/h^2}, essentially instantly: the scheme turns the most strongly damped mode into the most strongly amplified.

Exercise 9.7 The implicit scheme and the maximum principle

Show that the backward Euler scheme satisfies max⁡j∣Ujn+1∣≤max⁡j∣Ujn∣\max_j|U^{n+1}_j| \leq \max_j|U^n_j| for every r>0r > 0 (with zero boundary values). (Look at the index jj where ∣Ujn+1∣|U^{n+1}_j| is largest.)

Solution

Let ∣Ujn+1∣|U^{n+1}_j| be maximal at jj, say Ujn+1=M>0U^{n+1}_j = M > 0. Then (1+2r)M=Ujn+rUj+1n+1+rUj−1n+1≤Ujn+2rM(1 + 2r)M = U^n_j + rU^{n+1}_{j+1} + rU^{n+1}_{j-1} \leq U^n_j + 2rM, so M≤Ujn≤max⁡∣Un∣M \leq U^n_j \leq \max|U^n|. The case of a negative minimum is symmetric.

Exercise 9.8 Crank–Nicolson in practice

(a) Show that ∣ξ(θ)∣≤1|\xi(\theta)| \leq 1 for the Crank–Nicolson amplification factor for all rr and θ\theta. (b) From the table in Example 9.4, estimate the order of convergence of each scheme from consecutive errors. (c) Use Richardson extrapolation on the Crank–Nicolson values at M=200M = 200 and M=400M = 400: if the error is Ch2Ch^2, then 4V400−V2003\frac{4V_{400} - V_{200}}{3} removes the leading error. Compute the extrapolated error.

Solution

(a) With s=2rsin⁡2θ2≥0s = 2r\sin^2\frac\theta2 \geq 0, ξ=1−s1+s∈(−1,1]\xi = \frac{1 - s}{1 + s} \in (-1, 1]. (b) Crank–Nicolson: 0.03630.0090≈4.0\frac{0.0363}{0.0090} \approx 4.0, 0.00900.0022≈4.0\frac{0.0090}{0.0022} \approx 4.0, so order log⁡24=2\log_24 = 2. Backward Euler: ratios about 2.92.9, 2.62.6, 2.42.4, approaching 22 (first order) as the O(k)O(k) error dominates. (c) Errors e200≈−0.002249e_{200} \approx -0.002249, e400≈−0.000562e_{400} \approx -0.000562: 4e400−e2003≈−0.002248+0.0022493\frac{4e_{400} - e_{200}}{3} \approx \frac{-0.002248 + 0.002249}{3}, which is below 10−610^{-6}: a thousandfold improvement at no extra cost.

Exercise 9.9 The Thomas algorithm

(a) Derive the recursion of the Thomas algorithm from Gaussian elimination. (b) Show by induction that if ∣bj∣>∣aj∣+∣cj∣|b_j| > |a_j| + |c_j| for all jj then ∣cj′∣<1|c'_j| < 1, so the denominators bj−ajcj−1′b_j - a_jc'_{j-1} never vanish. (c) Count the operations.

Solution

(a) Eliminating Uj−1U_{j-1} from equation jj using the reduced equation Uj−1+cj−1′Uj=dj−1′U_{j-1} + c'_{j-1}U_j = d'_{j-1} gives (bj−ajcj−1′)Uj+cjUj+1=dj−ajdj−1′(b_j - a_jc'_{j-1})U_j + c_jU_{j+1} = d_j - a_jd'_{j-1}; divide by the coefficient of UjU_j. (b) ∣c1′∣=∣c1∣/∣b1∣<1|c'_1| = |c_1|/|b_1| < 1; if ∣cj−1′∣<1|c'_{j-1}| < 1 then ∣bj−ajcj−1′∣≥∣bj∣−∣aj∣>∣cj∣|b_j - a_jc'_{j-1}| \geq |b_j| - |a_j| > |c_j|, so ∣cj′∣<1|c'_j| < 1. (c) About 8J8J arithmetic operations: linear in JJ, compared with O(J3)O(J^3) for a dense solve.

Exercise 9.10 The Black–Scholes equation in log-price

With x=log⁡Sx = \log S and τ=T−t\tau = T - t, show that ∂tv+rS∂Sv+12σ2S2∂SSv−rv=0\partial_tv + rS\partial_Sv + \frac12\sigma^2S^2\partial_{SS}v - rv = 0 becomes vτ=12σ2vxx+(r−12σ2)vx−rvv_\tau = \frac12\sigma^2v_{xx} + (r - \frac12\sigma^2)v_x - rv. Why is a uniform grid in xx better than a uniform grid in SS?

Solution

S∂S=∂xS\partial_S = \partial_x and S2∂SS=∂xx−∂xS^2\partial_{SS} = \partial_{xx} - \partial_x, and ∂t=−∂τ\partial_t = -\partial_\tau. Substituting gives the stated equation, with constant coefficients. A uniform xx-grid is geometric in SS: fine near small prices, coarse far out, matching the scale of relative price changes; and constant coefficients make the stability analysis of this chapter apply directly.

Exercise 9.11 The leapfrog scheme for waves

For Ujn+1−2Ujn+Ujn−1k2=c2δ2Ujn\frac{U^{n+1}_j - 2U^n_j + U^{n-1}_j}{k^2} = c^2\delta^2U^n_j, substitute Ujn=ξneijθU^n_j = \xi^ne^{ij\theta} to get ξ2−2(1−2ν2sin⁡2θ2)ξ+1=0\xi^2 - 2\big(1 - 2\nu^2\sin^2\frac\theta2\big)\xi + 1 = 0 with ν=ckh\nu = \frac{ck}{h}. Show that both roots have modulus 11 for all θ\theta iff ν≤1\nu \leq 1, and that otherwise one root has modulus greater than 11.

Solution

The roots have product 11. With β=1−2ν2sin⁡2θ2\beta = 1 - 2\nu^2\sin^2\frac\theta2, they are complex conjugates of modulus 11 when ∣β∣≤1|\beta| \leq 1, and real with one of modulus >1> 1 when ∣β∣>1|\beta| > 1. Since β≤1\beta \leq 1 always, the condition is β≥−1\beta \geq -1, i.e. ν2sin⁡2θ2≤1\nu^2\sin^2\frac\theta2 \leq 1 for all θ\theta, i.e. ν≤1\nu \leq 1.

Exercise 9.12 The FFT recursion

For N=2MN = 2M, write the DFT U^k=∑j<NUjωjk\hat U_k = \sum_{j<N}U_j\omega^{jk}, ω=e−2πi/N\omega = e^{-2\pi i/N}, as Ek+ωkOkE_k + \omega^kO_k, where EE and OO are the DFTs of length MM of the even- and odd-indexed entries. Deduce the cost recursion C(N)=2C(N/2)+O(N)C(N) = 2C(N/2) + O(N) and hence C(N)=O(Nlog⁡N)C(N) = O(N\log N).

Solution

U^k=∑m<MU2mω2mk+ωk∑m<MU2m+1ω2mk\hat U_k = \sum_{m<M}U_{2m}\omega^{2mk} + \omega^k\sum_{m<M}U_{2m+1}\omega^{2mk}, and ω2=e−2πi/M\omega^2 = e^{-2\pi i/M}, so the two sums are length-MM DFTs (periodic in kk with period MM). Combining them for all NN values of kk costs O(N)O(N). Unrolling C(N)=2C(N/2)+cNC(N) = 2C(N/2) + cN over log⁡2N\log_2N levels gives cNlog⁡2NcN\log_2N.

Exercise 9.13 Reading the explosion

In Example 9.4, the explicit scheme with h=0.02h = 0.02 and diffusion coefficient 12σ2=0.02\frac12\sigma^2 = 0.02 has reff=0.02kh2r_{\text{eff}} = 0.02\frac{k}{h^2}. Compute reffr_{\text{eff}} for N=110N = 110, 100100, 9595 and 8080 time steps over one year, and predict from the amplification factor of the sawtooth mode, 1−4reff1 - 4r_{\text{eff}}, how fast errors grow per step in the unstable cases.

Solution

k=1/Nk = 1/N, so reff=0.020.0004N=50Nr_{\text{eff}} = \frac{0.02}{0.0004N} = \frac{50}{N}: 0.4550.455, 0.50.5, 0.5260.526, 0.6250.625. The sawtooth factor 1−4reff1 - 4r_{\text{eff}} is −0.82-0.82, −1-1, −1.105-1.105, −1.5-1.5. For N=95N = 95 errors grow by about 10%10\% per step, about 1.10595≈1.3×1041.105^{95} \approx 1.3\times10^4 overall from tiny rounding and kink errors; for N=80N = 80, by 1.580≈1.3×10141.5^{80} \approx 1.3\times10^{14}. That matches the computed failures (∼300\sim300 and ∼3×1012\sim3\times10^{12}) in order of magnitude.

Exercise 9.14 Rehearsal: time steps for a geometric flow

On a surface, Ricci flow of a conformal metric e2w(dx2+dy2)e^{2w}(dx^2 + dy^2) is the equation wt=e−2wΔww_t = e^{-2w}\Delta w (11A.12 Ricci Flow on Surfaces). Discretise on a square grid with spacing hh and the explicit scheme Wn+1=Wn+ke−2WnΔhWnW^{n+1} = W^n + ke^{-2W^n}\Delta_hW^n, with Δh\Delta_h the five-point Laplacian. (a) Freezing the coefficient, show that the scheme is a weighted average at each point if k e−2W4h2≤1k\,e^{-2W}\frac{4}{h^2} \leq 1, i.e. k≤h24e2min⁡Wk \leq \frac{h^2}{4}e^{2\min W}. (b) The Gaussian curvature is K=−e−2wΔwK = -e^{-2w}\Delta w; where the metric is shrinking, ww is decreasing. Explain why the allowed time step shrinks as a region of the surface contracts, and why simulations of singularities (like a neckpinch) need adaptive time steps or implicit schemes.

Solution

(a) WPn+1=WP+ke−2WPh2(∑Q∼PWQ−4WP)=(1−4λ)WP+λ∑Q∼PWQW^{n+1}_P = W_P + \frac{ke^{-2W_P}}{h^2}\big(\sum_{Q\sim P}W_Q - 4W_P\big) = (1 - 4\lambda)W_P + \lambda\sum_{Q\sim P}W_Q with λ=ke−2WPh2\lambda = \frac{ke^{-2W_P}}{h^2}; the coefficients are non-negative iff 4λ≤14\lambda \leq 1. (b) The diffusion coefficient e−2we^{-2w} is the inverse of the metric's conformal factor: as a region shrinks (w→−∞w \to -\infty), the effective diffusion in coordinates speeds up, the allowed kk falls like e2min⁡we^{2\min w}, and a fixed time step eventually violates stability before the singular time. Simulations therefore adapt kk to the current solution (or rescale, or use implicit steps), just as the analysis of singularities rescales by the curvature (11B.1 Ricci Solitons).

Free resources for this chapter

Chosen for what this chapter covers, and all free to read. Links checked Oct 20, 2026.

© 2026 NeckPinch (www.neckpinch.com). All content in the guidebook (text, mathematics, figures and exercises) is protected by copyright. All rights reserved. No part may be copied, republished or redistributed without written permission.