Post · 4 min read· pp. 600–602

What is Numerical Stability?

Numerical stability concerns how errors introduced during the execution of an algorithm affect the result. It is a property of an algorithm rather than the problem being solved. I will assume that the errors under consideration are rounding errors, but in principle the errors can be from any source.

Consider a scalar function y=f(x)y = f(x) of a scalar xx. We regard xx as the input data and yy as the output. The forward error of a computed approximation y^\widehat{y} to yy is the relative error ∣y−y^∣/∣y∣|y - \widehat{y}|/|y|. The backward error of y^\widehat{y} is

min⁡{ ∣Δx∣∣x∣:y^=f(x+Δx) }.\min\left\{\, \displaystyle\frac{|\Delta x|}{|x|}: \widehat{y} = f(x+\Delta x) \,\right\}.

If y^\widehat{y} has a small backward error then it is the exact answer for a slightly perturbed input. Here, “small’ is interpreted relative to the floating-point arithmetic, so a small backward error means one of the form cucu for a modest constant cc, where uu is the unit roundoff.

An algorithm that always produces a small backward error is called backward stable. In a backward stable algorithm the errors introduced during the algorithm have the same effect as a small perturbation in the data. If the backward error is the same size as any uncertainty in the data then the algorithm produces as good a result as we can expect.

If xx undergoes a relative perturbation of size uu then y=f(x)y = f(x) can change by as much as condf(x)u\mathrm{cond}_f(x) u, where

condf(x)=lim⁡ϵ→0sup⁡∣Δx∣≤ϵ∣x∣∣f(x+Δx)−f(x)∣ϵ∣f(x)∣\mathrm{cond}_f(x) = \lim_{\epsilon\to0} \displaystyle\sup_{|\Delta x| \le \epsilon |x|} \displaystyle\frac{|f(x+\Delta x) - f(x)|}{\epsilon|f(x)|}

is the condition number of ff at xx. An algorithm that always produces y^\widehat{y} with a forward error of order condf(x)u\mathrm{cond}_f(x) u is called forward stable.

The definition of condf(x)\mathrm{cond}_f(x) implies that a backward stable algorithm is automatically forward stable. The converse is not true. An example of an algorithm that is forward stable but not backward stable is Gauss–Jordan elimination for solving a linear system.

If y^\widehat{y} satisfies

y^+Δy=f(x+Δx),∣Δy∣≤ϵ∣y^∣,∣Δx∣≤ϵ∣x∣,\widehat{y} + \Delta y = f(x+\Delta x), \quad |\Delta y| \le \epsilon |\widehat{y}|, \quad |\Delta x| \le \epsilon |x|,

with ϵ\epsilon small in the sense described above, then the algorithm for computing yy is mixed backward–forward stable. Such an algorithm produces almost the right answer for a slightly perturbed input. The following diagram illustrates the previous equation.

mixed-err-fig.jpg

With these definitions in hand, we can turn to the meaning of the term numerically stable. Depending on the context, numerical stability can mean that an algorithm is (a) backward stable, (b) forward stable, or (c) mixed backward–forward stable.

For some problems, backward stability is difficult or impossible to achieve, so numerical stability has meaning (b) or (c). For example, let Z=xyTZ = xy^T, where xx and yy are nn-vectors. Backward stability would require the computed Z^\widehat{Z} to satisfy Z^=(x+Δx)(y+Δy)T\widehat{Z} = (x+\Delta x)(y+\Delta y)^T for some small Δx\Delta x and Δy\Delta y, meaning that Z^\widehat{Z} is a rank-11 matrix. But the computed Z^\widehat{Z} contains n2n^2 independent rounding errors and is very unlikely to have rank 11.

We briefly mention some other relevant points.

  • What is the data? For a linear system Ax=bAx = b the data is AA or bb, or both. For a nonlinear function we need to consider whether problem parameters are data; for example, for f(x)=cos⁡(3x2+2)f(x) = \cos(3x^2+2) are the 33 and the 22 constants or are they data, like xx, that can be perturbed?
  • We have measured perturbations in a relative sense. Absolute errors can also be used.
  • For problems whose inputs are matrices or vectors we need to use norms or componentwise measures.
  • Some algorithms are only unconditionally numerically stable, that is, they are numerically stable for some subset of problems. For example, the normal equations method for solving a linear least squares problem is forward stable for problems with a large residual.

References

This is a minimal set of references, which contain further useful references within.

This article is part of the “What Is” series, available from https://nhigham.com/category/what-is and in PDF form from the GitHub repository https://github.com/higham/what-is.