Many problems in applied mathematics involve the solution of a differential equation. Simple differential equations can be solved analytically: we can find a formula expressing the solution for any value of the independent variable. But most equations are nonlinear and this approach does not work; we must solve the equation by approximate numerical means. The big question is:
“Does the numerical solution resemble the true solution of the equation?”
The answer is: “Not necessarily”.
There are often specific criteria that must be satisfied to ensure that the answer `crunched out’ by the computer is a reasonable approximation to reality. Although the principles of numerical stability are quite general, they are best illustrated by simple examples. We will look at some of these below.

Smooth curve: True solution. Black dots: stable solution. Red dots: unstable solution (time step too large).
The Simplest Cases
To begin, we take a simple first-order linear ordinary differential equation (ODE):
For , the solution
decays exponentially with time. We would expect the numerical solution to do the same. We call this equation the diffusion equation, as it represents a diffusive or damped process.
Let’s discretise the time, replacing a continuous variable by a discrete sequence , ranging from the initial time to time
. We denote the numerical solution at these times by
. For the exact solution we have
. We may also write this as
where
. Note that for
we have
, confirming that the solution decreases with
.
Euler’s Explicit Method for the Diffusion Equation
We replace the derivative in the ODE by a finite difference and evaluate the -term at the start of each interval
; this is known as Euler’s method:
Now seeking a solution of the form , we see that we must have
For , we have
so the solution decays. Moreover, for small values of
we have
, so that the numerical solution should be close to the true solution, at least for small times. However, if either
or the time step is large, we may have
which means that
. The numerical solution grows with time and also oscillates between positive and negative values each time step (see illustration above). This solution bears no resemblance to the true (analytical) solution. We see that, for a fixed
, a necessary condition for a reasonable solution is that the time step should not be too large:
This is the stability criterion for the Euler forward scheme with the diffusion equation.
An Implicit Method for the Diffusion Equation
Next, we evaluate the -term at the end of the time step:
Then the amplitude is given by
which always has modulus smaller than unity: . Consequently, the numerical solution always decays with time and does not oscillate. We say that the implicit method, or backward method, is unconditionally stable.
The Leapfrog Method for the Diffusion Equation
Now for a surprise: we examine the stability of the so-called leapfrog method. Here, the -term is evaluated at the centre of the time step. We might reasonably expect this to yield greater accuracy than either the forward or backward method.
The finite difference equation for the leapfrog method is
Plugging in a solution of the form , this yields a quadratic equation for
:
This has two roots,
It is very clear that the root has modulus greater than 1.
This is unexpected: the leapfrog method is always unstable for the diffusion equation.
The Leapfrog Method for the Wave Equation
The above analysis would suggest that the leapfrog method is useless. However, for some equations it is a very attractive scheme. We consider the simple one-dimensional wave equation
We know that this has an analytical solution representing an oscillation or wave-like motion in time. Let us see if this is found for the leapfrog approximation. The ODE is approximated by the finite difference equation
Substituting we get a quadratic equation:
which has the two roots:
where we have written .
It is easy to show that, for there are two unimodular roots, that is
, as is the case for the analytical solution. On the other hand, if
, there are two real roots, and one of them has a modulus greater than unity. So, the solution blows up.
We conclude that there is a condition for stability of the solution:
Remarks
The Table above shows the contrasting stability properties of the forward and leapfrog schemes for the two simple equations: the Euler scheme is stable for diffusion and unstable for advection; the Leapfrog scheme is unstable for diffusion and stable for advection. Thus, if we wish to integrate an equation with both processes, we might use one scheme for the diffusion term and another for advection.
The stability criteria have major practical implications. Limitations on the size of the time step mean that more time steps must be taken to reach a given range. In the case of numerical weather prediction, this constrains the delivery time of the computer forecasts.
The first comprehensive analysis of the stability properties of finite difference approximations to differential equations was by Richard Courant, Kurt Friedrichs and Hans Lewy, published in 1928. The constraint on the time step is usually called the CFL criterion. We hope to consider this topic in more detail in a later post.
Sources
The earliest detailed consideration of numerical stability of finite-difference approximations to differential equations is:
Courant, R., K. Friedrichs and H. Lewy, 1928: Über die partiellen Differenzengleichungen der mathematischen Physik, Math. Ann., 100 (1), 32-74.
Translation, “On the partial difference equations of mathematical physics”,
IBM J. Res. Dev., 11 (2), 215–234. Available at
https://web.stanford.edu/class/cme324/classics/courant-friedrichs-lewy.pdf