Interactive Educational Modules in
Scientific Computing

Matrix Condition Number

This module illustrates a geometric interpretation of the condition number of a matrix A, which measures the ratio of the maximum relative stretching to the maximum relative shrinking the matrix does to any nonzero vectors, and is defined by The matrix transforms the unit sphere in the 2-norm into an ellipsoid whose principal axes are images of unit vectors maximally stretched or shrunk by the matrix. Thus, the condition number of the matrix is given by the ratio of the lengths of the principal axes of the ellipsoid. An ill-conditioned matrix skews the unit sphere into a long thin cigar or needle shape, whereas the image retains a more nearly spherical shape for a well-conditioned matrix. The matrix condition number provides an error bound for the solution to a system of linear equations.

The user can enter a matrix in the array on the lower left or can use a preset or random example. The unit circle is shown on the left, the corresponding ellipse produced by the matrix is shown on the right, and the numerical value of the condition number of the matrix is printed below. The principal axes of the ellipsoid are indicated on the right by colored arrows, and their preimages are shown on the left by arrows with corresponding colors. Note that the scales of the two graphs are always the same, but both are rescaled for each choice of matrix in order to accommodate a range of sizes for the ellipse on the right.

Reference: Michael T. Heath, Scientific Computing, An Introductory Survey, 2nd edition, McGraw-Hill, New York, 2002. See Section 2.3.3, especially Example 2.6.

Developers: Sukolsak Sakshuwong and Michael Heath