Post · 4 min read· pp. 501–503

What Is a Condition Number?

A condition number of a problem measures the sensitivity of the solution to small perturbations in the input data. The condition number depends on the problem and the input data, on the norm used to measure size, and on whether perturbations are measured in an absolute or a relative sense. The problem is defined by a function, which may be known explicitly or may be only implicitly defined (as when the problem is to solve an equation).

The most well known example of a condition number is the condition number of a nonsingular square matrix AA, which is κ(A)=∥A∥∥A−1∥\kappa(A) = \|A\| \|A^{-1}\|. More correctly, this is the condition number with respect to inversion, because a relative change to AA of norm ϵ\epsilon can change A−1A^{-1} by a relative amount as much as, but no more than, about κ(A)ϵ\kappa(A)\epsilon for small ϵ\epsilon. The same quantity κ(A)\kappa(A) is also the condition number for a linear system Ax=bAx = b (exactly if AA is the data, but only approximately if both AA and bb are the data).

It is easy to see that κ(A)≥1\kappa(A) \ge 1 for any norm for which ∥I∥=1\|I\| = 1 (most common norms, but not the Frobenius norm, have this property) and that κ(A)\kappa(A) tends to infinity as AA tends to singularity.

A general definition of (relative) condition number, for a function ff from Rn\mathbb{R}^n to Rn\mathbb{R}^n, is

cond(f,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)\|}.

Taking a small, nonzero ϵ\epsilon, we have

∥f(x+Δx)−f(x)∥∥f(x)∥≲cond(f,x)∥Δx∥∥x∥\displaystyle\frac{\|f(x+\Delta x) - f(x)\|}{\|f(x)\|} \lesssim \mathrm{cond}(f,x) \displaystyle\frac{\|\Delta x\|}{\|x\|}

for small ∥Δx∥\|\Delta x\|, with approximate equality for some Δx\Delta x.

An explicit expression for cond(f,x)\mathrm{cond}(f,x) can be given in terms of the Jacobian matrix, J(x)=(∂fi/∂xj)J(x) = (\partial f_i/\partial x_j):

cond(f,x)=∥x∥∥J(x)∥∥f(x)∥.\mathrm{cond}(f,x) = \displaystyle\frac{ \|x\| \| J(x) \| }{ \| f(x) \|}.

We give two examples.

  • If ff is a scalar function then J(x)=f′(x)J(x) = f'(x), so cond(f,x)=∣xf′(x)/f(x)∣\mathrm{cond}(f,x) = |xf'(x)/f(x)|. Hence, for example, cond(log⁡,x)=1/∣log⁡x∣\mathrm{cond}(\log,x) = 1/|\log x|.

  • If zz is a simple (non-repeated) root of the polynomial p(t)=antn+⋯+a1t+a0p(t) = a_n t^n + \cdots + a_1 t + a_0 then the data is the vector of coefficients a=[an,…,a0]Ta = [a_n,\dots,a_0]^T. It can be shown that the condition number of the root zz is, for the ∞\infty-norm,

    cond(z,a)=max⁡i∣ai∣∑i=0n∣z∣i∣zp′(z)∣.\mathrm{cond}(z,a) = \displaystyle\frac{ \max_i |a_i| \sum_{i=0}^n |z|^i } { |z p'(z)| }.

A general theory of condition numbers was developed by Rice (1966).

A problem is said to be well conditioned if the condition number is small and ill conditioned if the condition number is large. The meaning of “small” and “large” depends on the problem and the context. This diagram illustrates a well-conditioned function ff: small changes in xx produce small changes in ff.

cond-fig-0.jpg

The next diagram depicts an ill-conditioned function ff: small changes in xx can produce large changes in ff (but do not necessarily do so, as the closeness of f(x2)f(x_2) and f(x3)f(x_3) illustrates).

cond-fig-1.jpg

Here are a few key points about condition numbers.

  • Even though an explicit expression may be available for it, computing cond(f,x)\mathrm{cond}(f,x) is usually as expensive as computing f(x)f(x), so a lot of research has focused on obtaining inexpensive estimates of the condition number or bounds for it.
  • While κ(A)≥1\kappa(A) \ge 1, it is not true for all functions that cond(f,x)\mathrm{cond}(f,x) is bounded below by 11.
  • For a range of functions that includes the matrix inverse, matrix eigenvalues, and a root of a polynomial, it is known that the condition number is the reciprocal of the relative distance to the nearest singular problem (one with an infinite condition number).
  • As the condition number is itself a function, one can ask: What is the condition number of the condition number? For a variety of problems, including those mentioned in the previous point, the condition number of the condition number is (approximately) the condition number!

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.