In numerical analysis, the condition number of a function measures how much the output value of the function can change for a small change in the input argument. This is used to measure how sensitive a function is to changes or errors in the input, and how much error in the output results from an error in the input. Very frequently, one is solving the inverse problem: given
f(x)=y,
The condition number is derived from the theory of propagation of uncertainty, and is formally defined as the value of the asymptotic worst-case relative change in output for a relative change in input. The "function" is the solution of a problem and the "arguments" are the data in the problem. The condition number is frequently applied to questions in linear algebra, in which case the derivative is straightforward but the error could be in many different directions, and is thus computed from the geometry of the matrix. More generally, condition numbers can be defined for non-linear functions in several variables.
A problem with a low condition number is said to be well-conditioned, while a problem with a high condition number is said to be ill-conditioned. In non-mathematical terms, an ill-conditioned problem is one where, for a small change in the inputs (the independent variables) there is a large change in the answer or dependent variable. This means that the correct solution/answer to the equation becomes hard to find. The condition number is a property of the problem. Paired with the problem are any number of algorithms that can be used to solve the problem, that is, to calculate the solution. Some algorithms have a property called backward stability; in general, a backward stable algorithm can be expected to accurately solve well-conditioned problems. Numerical analysis textbooks give formulas for the condition numbers of problems and identify known backward stable algorithms.
As a rule of thumb, if the condition number
\kappa(A)=10k
k
Given a problem
f
\tilde{f}
x
\tilde{f}(x),
\deltaf(x):=f(x)-\tilde{f}(x),
\|\deltaf(x)\|=\left\|f(x)-\tilde{f}(x)\right\|
\|\deltaf(x)\|/\|f(x)\|=\left\|f(x)-\tilde{f}(x)\right\|/\|f(x)\|.
In this context, the absolute condition number of a problem
f
\lim | |
\varepsilon → 0+ |
\sup\|\delta
\|\deltaf(x)\| | |
\|\deltax\| |
and the relative condition number is
\lim | |
\varepsilon → 0+ |
\sup\|\delta
\|\deltaf(x)\|/\|f(x)\| | |
\|\deltax\|/\|x\| |
.
For example, the condition number associated with the linear equationAx = b gives a bound on how inaccurate the solution x will be after approximation. Note that this is before the effects of round-off error are taken into account; conditioning is a property of the matrix, not the algorithm or floating-point accuracy of the computer used to solve the corresponding system. In particular, one should think of the condition number as being (very roughly) the rate at which the solution x will change with respect to a change in b. Thus, if the condition number is large, even a small error in b may cause a large error in x. On the other hand, if the condition number is small, then the error in x will not be much bigger than the error in b.
The condition number is defined more precisely to be the maximum ratio of the relative error in x to the relative error in b.
Let e be the error in b. Assuming that A is a nonsingular matrix, the error in the solution A−1b is A−1e. The ratio of the relative error in the solution to the relative error in b is
{ | \left\|A-1e\right\| |
\left\|A-1b\right\| |
The maximum value (for nonzero b and e) is then seen to be the product of the two operator norms as follows:
\begin{align} maxe,b\left\{
\left\|A-1e\right\| | |
\|e\| |
\|b\| | |
\left\|A-1b\right\| |
\right\} &=maxe\left\{
\left\|A-1e\right\| | |
\|e\| |
\right\}maxb\left\{
\|b\| | |
\left\|A-1b\right\| |
\right\}\\ &=maxe\left\{
\left\|A-1e\right\| | |
\|e\| |
\right\}maxx\left\{
\|Ax\| | |
\|x\| |
\right\}\\ &=\left\|A-1\right\|\|A\|. \end{align}
The same definition is used for any consistent norm, i.e. one that satisfies
\kappa(A)=\left\|A-1\right\|\left\|A\right\|\ge\left\|A-1A\right\|=1.
When the condition number is exactly one (which can only happen if A is a scalar multiple of a linear isometry), then a solution algorithm can find (in principle, meaning if the algorithm introduces no errors of its own) an approximation of the solution whose precision is no worse than that of the data.
However, it does not mean that the algorithm will converge rapidly to this solution, just that it will not diverge arbitrarily because of inaccuracy on the source data (backward error), provided that the forward error introduced by the algorithm does not diverge as well because of accumulating intermediate rounding errors.
The condition number may also be infinite, but this implies that the problem is ill-posed (does not possess a unique, well-defined solution for each choice of data; that is, the matrix is not invertible), and no algorithm can be expected to reliably find a solution.
The definition of the condition number depends on the choice of norm, as can be illustrated by two examples.
If
\| ⋅ \|
\| ⋅ \|2
\kappa(A)=
\sigmamax(A) | |
\sigmamin(A) |
,
where
\sigmamax(A)
\sigmamin(A)
A
A
λmax(A)
λmin(A)
A
A
\kappa(A)=1.
The condition number with respect to L2 arises so often in numerical linear algebra that it is given a name, the condition number of a matrix.
If
\| ⋅ \|
Linfty
A
aii\ne0
i
\kappa(A)\geq
maxi(|aii|) | |
mini(|aii|) |
recalling that the eigenvalues of any triangular matrix are simply the diagonal entries.
The condition number computed with this norm is generally larger than the condition number computed relative to the Euclidean norm, but it can be evaluated more easily (and this is often the only practicably computable condition number, when the problem to solve involves a non-linear algebra, for example when approximating irrational and transcendental functions or numbers with numerical methods).
If the condition number is not significantly larger than one, the matrix is well-conditioned, which means that its inverse can be computed with good accuracy. If the condition number is very large, then the matrix is said to be ill-conditioned. Practically, such a matrix is almost singular, and the computation of its inverse, or solution of a linear system of equations is prone to large numerical errors.
A matrix that is not invertible is often said to have a condition number equal to infinity. Alternatively, it can be defined as
\kappa(A)=\|A\|\|A\dagger\|
A\dagger
Condition numbers can also be defined for nonlinear functions, and can be computed using calculus. The condition number varies with the point; in some cases one can use the maximum (or supremum) condition number over the domain of the function or domain of the question as an overall condition number, while in other cases the condition number at a particular point is of more interest.
f
\left|xf'/f\right|
x
\left| | xf'(x) | \right|=\left| |
f(x) |
(logf)' | |
(logx)' |
\right|.
Note that this is the absolute value of the elasticity of a function in economics.
Most elegantly, this can be understood as (the absolute value of) the ratio of the logarithmic derivative of
f
(logf)'=f'/f
x
(logx)'=x'/x=1/x
xf'/f
f'
f
More directly, given a small change
\Deltax
x
x
[(x+\Deltax)-x]/x=(\Deltax)/x
f(x)
[f(x+\Deltax)-f(x)]/f(x)
[f(x+\Deltax)-f(x)]/f(x) | |
(\Deltax)/x |
=
x | |
f(x) |
f(x+\Deltax)-f(x) | |
(x+\Deltax)-x |
=
x | |
f(x) |
f(x+\Deltax)-f(x) | |
\Deltax |
.
The last term is the difference quotient (the slope of the secant line), and taking the limit yields the derivative.
Condition numbers of common elementary functions are particularly important in computing significant figures and can be computed immediately from the derivative. A few important ones are given below:
Name | Symbol | Condition number | ||||
---|---|---|---|---|---|---|
Addition / subtraction | x+a | \left | \frac\right | |||
Scalar multiplication | ax | 1 | ||||
Division | 1/x | 1 | ||||
xn | n | |||||
ex | x | |||||
Natural logarithm function | ln(x) | \left | \frac\right | |||
Sine function | \sin(x) | x\cot(x) | ||||
Cosine function | \cos(x) | x\tan(x) | ||||
Tangent function | \tan(x) | x(\tan(x)+\cot(x)) | ||||
Inverse sine function | \arcsin(x) |
\arcsin(x)} | ||||
Inverse cosine function | \arccos(x) |
\arccos(x)} | ||||
Inverse tangent function | \arctan(x) |
|
Condition numbers can be defined for any function
f
m
x
n
f(x)
The condition number of
f
x
f(x)
x
\deltax
x
\lim | |
\varepsilon\to0+ |
\sup\|\delta\left[\left.
\left\|f(x+\deltax)-f(x)\right\| | |
\|f(x)\| |
\right/
\|\deltax\| | |
\|x\| |
\right],
where
\| ⋅ \|
f
If
f
\|J(x)\| | |
\|f(x)\|/\|x\| |
,
where denotes the Jacobian matrix of partial derivatives of
f
x
\|J(x)\|