The Crank–Nicolson method is an implicit numerical method for approximating solutions of time-dependent differential equations. It advances a solution by averaging the rates of change at the beginning and end of each time step. Originally developed for the heat equation, it is widely used with spatial discretizations of partial differential equations. Its main advantages are second-order accuracy in time and unconditional stability for standard linear diffusion problems. Its principal limitation is weak damping of rapidly decaying components, which can produce numerical oscillations even when the computation remains stable.
Formulation
Consider an initial-value problem for an ordinary differential equation, possibly vector-valued:
Let , and let approximate . The Crank–Nicolson update is
Because the unknown appears on both sides, the method is implicit: each step generally requires solving an algebraic equation or system.
The formula follows by integrating the differential equation over one time step,
and approximating the integral using the trapezoidal rule. For ordinary differential equations, this time-stepping formula is therefore also called the implicit trapezoidal method. The name Crank–Nicolson is especially common when it is applied to spatially discretized partial differential equations.
For a linear system
the update becomes
where is the identity matrix. With constant and constant step size, the left-hand matrix remains unchanged throughout the computation.
Discretization of the heat equation
For the one-dimensional heat equation with constant diffusivity ,
introduce a uniform spatial grid , and write for the approximation to . A centered finite-difference approximation in space, combined with Crank–Nicolson time stepping, gives
Defining
the scheme can be written as
For prescribed values at the two endpoints, the unknown interior values form a tridiagonal system of linear equations. A specialized elimination algorithm solves this system with work proportional to the number of spatial grid points.
Boundary conditions must be incorporated consistently. Time-dependent prescribed boundary values contribute at both and ; derivative or flux conditions require appropriate boundary approximations.
Accuracy and convergence
For a sufficiently smooth solution, the implicit trapezoidal method has a one-step local error of order and a global error of order over a fixed time interval. These statements use big-O notation and assume the usual regularity and stability conditions.
For the centered heat-equation discretization, the expected combined error is
provided that the solution and boundary data are sufficiently smooth and the algebraic systems are solved accurately enough. This follows from Taylor expansions in time and space together with an appropriate stability estimate.
Second-order time accuracy does not guarantee second-order accuracy for an entire simulation. The observed order can be reduced by:
- nonsmooth initial data;
- incompatible initial and boundary conditions;
- lower-order boundary or spatial approximations;
- inaccurate treatment of forcing terms;
- insufficiently accurate nonlinear or linear solves.
For a spatially discretized partial differential equation, error constants may also depend on the spatial mesh and on the regularity of the solution.
Stability
The standard scalar test equation for numerical stability is
Crank–Nicolson gives
Its stability function satisfies
Consequently, the method is A-stable: every decaying scalar linear mode is stable for every positive time-step size.
For standard spatial discretizations of diffusion, this leads to unconditional stability in the appropriate norm. Unlike an explicit forward-Euler discretization, the method does not require a restriction proportional to merely to prevent instability.
This statement has a limited scope. It does not mean that arbitrarily large time steps are accurate, nor does it establish unconditional stability for every nonlinear equation or every spatial discretization. Systems with non-normal operators can also require analysis beyond inspection of their eigenvalues.
Lack of strong damping
Although A-stable, Crank–Nicolson is not L-stable, because
rather than zero.
The exact solution of a strongly decaying mode becomes negligible over a sufficiently long step. Crank–Nicolson instead gives such a mode an amplification factor close to : its sign alternates while its magnitude decreases slowly. This is important for stiff differential equations, where some components decay much faster than others.
Oscillations and positivity
For the uniform-grid heat equation, a spatial Fourier mode with phase increment has amplification factor
Although for every , the factor becomes negative when
High-frequency modes can therefore alternate in sign between time levels. Discontinuous or sharply varying initial data often contain substantial high-frequency content, making these oscillations conspicuous.
Stability, nonnegative modal amplification, and preservation of nonnegative solution values are distinct properties. For example, ensures nonnegative amplification for every Fourier mode in this analysis. For the usual one-dimensional Dirichlet discretization, is a sufficient condition for positivity preservation of the update with nonnegative data. These are different criteria, not competing definitions of stability.
A common treatment of nonsmooth initial data is Rannacher smoothing: an initial Crank–Nicolson step is replaced by two backward-Euler half-steps, sometimes with the procedure extended over several initial intervals. Backward Euler strongly damps rapidly varying components before second-order time stepping begins.
Implementation
Linear problems
For constant-coefficient linear problems, a matrix factorization of the left-hand matrix can be computed once and reused. In one spatial dimension, the tridiagonal structure makes this particularly efficient.
In multiple dimensions or on unstructured meshes, the system is usually larger but remains a sparse matrix system. Direct or iterative solvers may be used. Although unconditional stability permits larger time steps, the resulting systems can become harder to solve, and accuracy requirements still constrain the step size.
Nonlinear problems
For a nonlinear system , each step requires solving
Newton's method is a common choice. Its Jacobian is
Replacing the nonlinear solve with an extrapolation, a single iteration, or an explicitly evaluated nonlinear term produces a modified scheme. Its accuracy and stability require separate assessment.
Finite-element systems
A spatial finite-element discretization often yields
where is a mass matrix and represents the spatial operator. Crank–Nicolson gives
Thus, the method is not tied to finite differences: it is a time discretization that can be combined with several spatial approximation methods.
Relation to other time-stepping methods
Crank–Nicolson is the member of the family
The choices and give forward Euler and backward Euler, respectively. Among these fixed- schemes, provides second-order time accuracy.
Crank–Nicolson should be distinguished from the implicit midpoint method,
They coincide for autonomous linear systems, but generally differ for nonlinear equations and for time-dependent forcing. Properties of one method therefore cannot automatically be attributed to the other.
History and applications
John Crank and Phyllis Nicolson presented the method in 1947 in work on numerical solutions of heat-conduction equations. The endpoint-averaging formula is related to the older trapezoidal integration rule; its association with Crank and Nicolson reflects its development and use for time-dependent partial differential equations.
Applications include heat conduction, diffusion, reaction–diffusion systems, and financial option-pricing equations. Its suitability depends partly on whether weak damping of fast modes is desirable or problematic.
For a spatially discretized Schrödinger equation with a time-independent Hermitian Hamiltonian, the Crank–Nicolson update preserves the discrete norm in exact arithmetic. This follows because its update matrix is a unitary matrix. In that setting, the absence of artificial amplitude damping is useful, although phase error remains and still limits the time-step size.