The lines and cross at . Raise the second right-hand side to and the crossing jumps to , although no number in the data moved by more than one hundredth. Both answers are exact, so the jump comes from the system itself, whose two lines are nearly parallel, and not from rounding. This lesson measures that kind of sensitivity with the induced matrix norm and the condition number, and it keeps it apart from the accuracy of the method used to solve the system.
Key terms
Perturbation of the data
Definition Let be an invertible real matrix, let be a vector in , and let be the solution of . A perturbation of the data replaces by while stays fixed. The new solution is , and subtracting the two systems gives
Sizes are measured with a chosen vector norm, on this page the Euclidean length . The absolute error, or absolute change, of the solution is , and for its relative error is . The data have absolute error and, for , relative error . Against a zero baseline a relative error is undefined, and only the absolute error is reported. Changes in the matrix itself need a separate analysis.
In plain words A perturbation is a small change in the measured right-hand side. The absolute error says how large the change is, and the relative error compares it with the size of the quantity being changed, which is what a percentage reports. These numbers depend on units, so coordinates measured in different units should be scaled to comparable sizes before their lengths are compared.
Example Tuples such as stand for column vectors on this page. The opening example has
and . The change moves the solution to , so , and indeed . The absolute errors are and . Since and , the relative errors are
A change of about percent in the data produced a percent change in the solution.
Induced matrix norm
Definition Let be a real matrix. Its induced Euclidean norm is the largest length of over unit vectors in ,
The maximum is always attained. It follows that for every in , both sides being when , and that is the smallest number with this property. For a product of compatible matrices, . Other vector norms induce other matrix norms in the same way, and the subscript records which one is meant.
In plain words The induced norm of a matrix is its greatest stretch factor. Feed in every vector of length one, and the length of the longest output is the norm.
Example For a square diagonal matrix the norm is the largest absolute value on the diagonal. Take
A unit vector gives , with equality at , so . The unit circle goes to an ellipse with semiaxes and . The inverse has diagonal entries and , and the same argument gives . The direction that shrinks most is the direction that stretches most.
Condition number
Definition For an invertible real matrix , the Euclidean condition number is
The smallest stretch equals , so is the ratio of the largest stretch of to its smallest. It satisfies , because , and for every scalar . For a singular matrix the definition gives no finite number.
The condition number bounds the effect of a perturbation of the data. Suppose is fixed, , and . Then
To prove it, combine with , where because . When , use the absolute bound instead. The bound is a worst case. For every some choice of and attains it, but when is large a particular perturbation may be amplified far less.
In plain words The condition number is the largest factor by which a relative error in the data can grow in the solution. It compares the strongest stretch of the matrix with its weakest one.
Example The matrix above has . The matrix of the opening example has
and a numerical computation gives and , so . The perturbation in the opening example multiplied the relative error by , within the bound. The perturbation gives and a factor of about , essentially the whole bound.
Ill-conditioned system
Definition A square system with invertible is ill-conditioned when is large, so that for some right-hand sides a small relative change in the data can cause a much larger relative change in the exact solution. It is well-conditioned when is small, so that no relative change in the data can grow by more than a modest factor. There is no fixed cutoff. If the data carry relative errors up to , the bound above only limits the relative error of the solution to , so whether counts as large depends on how accurate the data are. Ill-conditioning is a property of the exact problem in its chosen units and norm, and the size of does not decide it.
In plain words An ill-conditioned matrix stretches some directions far more than others, so by comparison it nearly flattens the weakest one. Solving the system undoes the stretching. A data error along the image of that weakest direction is multiplied by a far larger factor than an error along the image of the strongest one, however carefully the arithmetic is done.
Example The determinant measures how volume scales, not how unevenly directions are stretched. In two dimensions the matrix has determinant , but it shrinks every direction equally. Its norm is , its inverse has norm , and its condition number is . The diagonal matrix with entries and has determinant , yet its norm is , its inverse has norm , and its condition number is . The first system is perfectly conditioned and the second is ill-conditioned, the reverse of what the determinants suggest.
Conditioning versus stability
Definition Conditioning is a property of a problem. It describes how much the exact answer changes when the exact data change, and the condition number measures it. Stability is a property of an algorithm. A stable algorithm keeps the errors it introduces through rounding under control, and one common standard, backward stability, asks that the computed answer be the exact answer for slightly changed data. A stable algorithm can still return an inaccurate answer to an ill-conditioned problem, because that small change in the data can be amplified, in the worst case by a factor of about the condition number. An unstable algorithm can fail even on a well-conditioned problem.
Three practices improve the computation without changing the problem. Pivoting exchanges rows so that elimination never divides by a needlessly small pivot, and partial pivoting takes the entry of largest absolute value available in the column. Guard digits are extra digits kept in intermediate steps, with rounding only at the end. In least squares with a design matrix of full column rank, the normal equations replace by , and the ratio of the largest to the smallest stretch of is the square of that ratio for , a fact the singular value decomposition explains in general later in the course. A QR method solves instead, and for every because has orthonormal columns, so keeps the stretches of . None of these practices can lower the condition number of the problem itself.
In plain words Conditioning asks whether the question is sensitive. Stability asks whether the method adds avoidable error. A good method cannot rescue a sensitive question, and a poor method can spoil an easy one.
Example Solve and , rounding every result to three significant digits. The exact solution is and , and the coefficient matrix has condition number about , so the problem is well-conditioned. Without pivoting, gives , which rounds to . Then , and the first equation becomes , so , a wrong answer. With pivoting the rows are exchanged first, and gives , which rounds to . Then and , correct to three digits.
The normal equations show the opposite effect. For with diagonal entries and , which has condition number ,
whose condition number is .
Residual versus solution error
Definition Let be an invertible matrix, let be the exact solution of , and let be any proposed solution. Its residual lives in the output space, and its error lives in the input space. They are related by , so
and when ,
A small residual guarantees a small error only when , or in relative terms , is moderate.
In plain words The residual says how nearly the equations are satisfied, and the error says how far the proposal is from the answer. The proposal solves the system exactly for the data , so a residual acts like a change in the data, and the conditioning decides how far such a change can move the solution.
Example Take with diagonal entries and and , whose exact solution is . The proposal gives , so the residual has length . The error has length , a hundred times larger. The error points along , which shrinks a hundredfold, so it leaves only a short residual.
Check yourself
- Find the condition number of the diagonal matrix with entries and . If the matrix and the right-hand side of a system with this matrix are both multiplied by , what happens to the solution, the determinant and the condition number?
Show the answer
The largest stretch is . The inverse has diagonal entries and , so its norm is , and the condition number is .
Multiplying both sides of every equation by gives an equivalent system, so the solution does not change. The determinant grows from to . The norm of the scaled matrix is and the norm of its inverse is , so the condition number is still . A change of scale is not a change of sensitivity.
- Use the matrix and the data of the opening example. The candidate satisfies the first equation exactly and misses the second by only . Is it close to the solution?
Show the answer
No. The residual is
with length . The exact solution is , so the error is , with length . This agrees with the bound . For this ill-conditioned matrix a small residual says little about the error.
- Let have diagonal entries and , and let . Compare the relative change in the solution caused by with the one caused by . Which perturbation reaches the bound set by ?
Show the answer
The solution is , and . Both perturbations have relative size .
The first gives , a relative change of , so it is not amplified at all. The second gives , a relative change of , which is times the relative change in the data. Only the second reaches the bound. The condition number is a worst case, and whether a perturbation comes near it depends on its direction.