Condition Numbers
Learning Objectives
- Compute the condition number
- Quantify the impact of a high condition number
Condition Number Definition
The condition number of a square nonsingular matrix is defined by
which is also the condition number associated with solving the linear system . A matrix with a large condition number is said to be ill-conditioned.
The condition number can be measured with any -norm, so to be precise we typically specify the norm being used, i.e. , .
If is singular ( does not exist), we can define by convention.
The identity matrix is well conditioned. Assuming the inverse of exists, This is the smallest possible condition number.
Things to Remember About Condition Numbers
- For any matrix ,
- For the identity matrix ,
- For any matrix and a nonzero scalar ,
- For any diagonal matrix , =
- The condition number is a measure of how close a matrix is to being singular: a matrix with large condition number is nearly singular, whereas a matrix with a condition number close to 1 is far from being singular.
- The determinant of a matrix is NOT a good indicator to check whether a matrix is near singularity.
Perturbed Matrix Problem and Error Bound
Let be the solution of and be the solution of the perturbed problem . Let be the absolute error in output. Then we have
so
Now we want to see how the relative error in output is related to the relative error in input :
where we used
Then
Therefore, if we know the relative error in input, then we can use the condition number of the system to obtain an upper bound for the relative error of our computed solution (output).
Residual vs Error
The residual vector of approximate solution for the linear system is defined as
. In the perturbed matrix problem described above, we have
Therefore, equation (1) can also be written as
If we define relative residual as , we can see that small relative residual implies small relative error in approximate solution only if is well-conditioned ( is small).
Alternative Definitions of Relative Residual
There are other closely related quantities that also have the name “relative residual”. Note that
In summary,
We can divide this inequality by to obtain
The quantity is also known as the relative residual. This inequality is useful mathematically, but involves the norm of the unknown solution, so it isn’t a practical way to bound the relative error. Since , we have
but are sometimes equal for certain choices of .
We can also divide equation (2) by to obtain
The left-hand side is no longer the relative error (the norm of the approximate solution is in the denominator, not the exact solution), but the right-hand side can still provide a reasonable estimate of the relative error. It is also computable, since the norm of the true solution does not appear on the right-hand side.
For this reason, the quantity is also known as the relative residual. This is used in the next section to describe the relationship between the residual and errors in the matrix .
While 3 different quantities all being named “relative residual” may be confusing, you should be able to determine which one is being discussed by the context.
Gaussian Elimination (with Partial Pivoting) is Guaranteed to Produce a Small Residual
When we use Gaussian elimination with partial pivoting to compute the solution for the linear system
and obtain an approximate solution , the residual vector satisfies:
where is backward error in (which is defined by ), is a coefficient related to and is machine epsilon.
Typically is small with partial pivoting, but can be arbitrarily large without pivoting.
Therefore, Gaussian elimination with partial pivoting yields small relative residual regardless of conditioning of the system.
For more details, see Gaussian Elimination & Roundoff Error.
Accuracy Rule of Thumb and Example
Suppose we apply Gaussian elimination with partial pivoting and back substitution to the linear system and obtain a computed solution . If the entries in and are accurate to decimal digits, and , then the elements of the solution vector will be accurate to about decimal digits.
For a proof of this rule of thumb, please see Fundamentals of Matrix Computations by David S. Watkins.
Example: How many accurate decimal digits in the solution can we expect to obtain if we solve a linear system where using Gaussian elimination with partial pivoting, assuming we are using IEEE double precision and the inputs are accurate to machine precision?
In IEEE double precision, , which means the entries in and are accurate to decimal digits.
Then, using the rule of thumb, we know the entries in will be accurate to about decimal digits.
Review Questions
ChangeLog
- 2022-03-19 Yuxuan Chen yuxuan19@illinois.edu: added condition number bullet pounts, minor fixes
- 2017-10-27 Erin Carrier ecarrie2@illinois.edu: adds review questions, minor fixes throughout, revised rule of thumb wording
- 2017-10-27 Yu Meng <yumeng5@illinois.edu: first complete draft
- 2017-10-17 Luke Olson <lukeo.illinois.edu: outline