---
tag: M92S0Y15N1
kind: statement
role: theorem
name: Crank–Nicolson method
msc: [65M06, 65M12]
uses: [VP2HN86VAG, X7HYEBA5SA, FNGWJR2FPK, D5M7TRD3MY]
about: [VP2HN86VAG]
sources:
  - url: https://en.wikipedia.org/wiki/Crank%E2%80%93Nicolson_method
---

## Statement

Let $\kappa > 0$ and consider the [[heat equation|VP2HN86VAG]] $u_t = \kappa u_{xx}$ on $0 < x < 1$, $t > 0$, with $u(0, t) = u(1, t) = 0$ and a given initial value $u(x, 0)$.
Let $M \ge 1$, $\Delta x = 1/(M + 1)$, $x_j = j \Delta x$, $\Delta t > 0$, $t_n = n \Delta t$ and $r = \kappa \Delta t / \Delta x^2$.
For a grid vector $v = (v_0, \ldots, v_{M+1})$ with $v_0 = v_{M+1} = 0$, put $(\delta^2 v)_j = (v_{j+1} - 2 v_j + v_{j-1}) / \Delta x^2$.
The Crank–Nicolson method computes $u^{n+1}$ from $u^n$ by
$$\frac{u_j^{n+1} - u_j^n}{\Delta t} = \frac{\kappa}{2} \left( (\delta^2 u^{n+1})_j + (\delta^2 u^n)_j \right), \qquad 1 \le j \le M.$$

1. Each step has a unique solution $u^{n+1}$, given by a tridiagonal linear system.
2. The method is unconditionally stable: $\norm{u^{n+1}}_{2} \le \norm{u^n}_2$ for every $r > 0$, where $\norm{v}_2^2 = \Delta x \sum_{j=1}^M v_j^2$.
3. Assume the exact solution has bounded derivatives $u_{ttt}$, $u_{xxtt}$ and $u_{xxxx}$. Then the local truncation error is $O(\Delta t^2 + \Delta x^2)$. On each interval $[0, T]$ the error $\max_{n \Delta t \le T} \norm{u(\cdot, t_n) - u^n}_2$ is also $O(\Delta t^2 + \Delta x^2)$.

## Remarks

The vectors $s^{(k)}_j = \sin(k \pi x_j)$, $1 \le k \le M$, are eigenvectors of $\delta^2$ with eigenvalues $-\frac{4}{\Delta x^2} \sin^2 \frac{k \pi \Delta x}{2}$, and they are orthogonal.
In this basis each step multiplies the $k$-th component by $g_k = \frac{1 - 2 r \sigma_k}{1 + 2 r \sigma_k}$ with $\sigma_k = \sin^2 \frac{k \pi \Delta x}{2} \in (0, 1)$, and $\abs{g_k} < 1$ for all $r > 0$; this gives clauses 1 and 2.
Clause 3 follows from Taylor expansion about $(x_j, t_n + \Delta t/2)$ and from stability, as in the [[Lax equivalence theorem|D5M7TRD3MY]].
The method is the trapezoidal rule applied to the [[method of lines|FNGWJR2FPK]] semi-discretisation $u' = \kappa \delta^2 u$.
For large $r$, $g_k$ is close to $-1$ for the high frequencies, so rough initial data produce slowly decaying oscillations: the method is A-stable but not L-stable.

## Explanations

### L1 human

The Crank–Nicolson method advances the heat equation in time by averaging the explicit and the implicit [[finite difference|X7HYEBA5SA]] formulas.
This averaging centres the scheme at the half step, which makes it second-order accurate in time as well as in space.
It is stable for every time step, unlike the explicit method, which needs $r \le 1/2$.
The price is a tridiagonal system to solve at each step, which costs only a few operations per grid point.

### L2 human

It is the default second-order method for diffusion problems, including the Black–Scholes equation in finance.
For non-smooth data it is often started with a few backward Euler steps (Rannacher smoothing) to damp the oscillating modes.
In several space dimensions the systems are no longer tridiagonal, which motivates alternating-direction implicit methods.
