Interactive Educational Modules in
Scientific Computing

Gauss-Jordan Elimination

This module illustrates Gauss-Jordan elimination for computing the inverse of a matrix. The initial matrix is reduced to diagonal form by applying a sequence of elementary elimination matrices to annihilate both the subdiagonal and superdiagonal entries in successive columns. Each elementary elimination matrix is composed of an identity matrix plus some multipliers in the relevant column. Row interchanges (pivoting) can be used to avoid potential division by zero and limit the magnitudes of the multipliers, thereby enhancing numerical stability. The same sequence of elementary elimination matrices is also applied to an auxiliary matrix that is initially the identity matrix. After the original matrix has reached diagonal form, it is scaled to obtain an identity matrix. The same scaling applied to the transformed auxiliary matrix yields the inverse of the original matrix.

The user first selects a matrix size (n = 2, 3, or 4), then selects a matrix by choosing a preset example, a random matrix, or typing in desired entries. The successive steps of Gauss-Jordan elimination are then carried out sequentially by repeatedly clicking on NEXT or on the currently highlighted step. The current column is indicated by an arrow. For each column, the default choice of pivot is the largest entry on or below the diagonal (partial pivoting), but any nonzero entry can be selected as pivot by clicking on it. Row interchanges are depicted explicitly. Each Gauss-Jordan elimination step is also applied to an auxiliary matrix on the right, which is initially the identity matrix. When Gauss-Jordan elimination is complete, the remaining diagonal matrix on the left is scaled to produce an identity matrix, at which point the matrix on the right will be the inverse of the original matrix. Formats provided for displaying numeric entries include exponential (e), fixed (f), and generic (g), with g the default.

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

Developers: Jessica Schoen and Michael Heath