Tutorials › Linear Algebra › A Worked 3 by 3 Inverse with Row Exchanges

Elementary Matrices and Inverses · Tutorial 93 of 1000

A Worked 3 by 3 Inverse with Row Exchanges

Learn how to use row exchanges and other row operations to find and verify a 3 by 3 matrix inverse.

Beginner 10 min read

What You'll Learn

  • Set up the augmented matrix used to find an inverse by row reduction
  • Exchange rows when a pivot position is zero
  • Track every row operation on both the original matrix and the identity matrix
  • Read the inverse from the reduced augmented matrix
  • Justify why reducing to the identity produces a two-sided inverse
  • Verify a proposed inverse by multiplying in the correct order

Why Row Exchanges Appear

To find an inverse by row reduction, we place a square matrix beside the identity matrix and apply row operations to the entire augmented matrix. If the left block becomes the identity, the right block is the inverse. A row exchange is sometimes essential: a prospective pivot entry may be zero even though another row has a usable entry in that column. The exchange changes the order of the equations, but it does not change the validity of the row-reduction process.

A square matrix \(\mathbf{A}\in\mathbb{R}^{3\times3}\) is invertible if there is a matrix \(\mathbf{B}\in\mathbb{R}^{3\times3}\) such that \(\mathbf{A}\mathbf{B}=\mathbf{B}\mathbf{A}=\mathbf{I}_3\). Such a matrix \(\mathbf{B}\) is called the inverse of \(\mathbf{A}\), written \(\mathbf{A}^{-1}\). The augmented-matrix method searches for row operations that transform the left block \(\mathbf{A}\) into \(\mathbf{I}_3\), while recording their combined effect in the right block.

Row-reduction rule: Start with \([\mathbf{A}\mid\mathbf{I}_3]\) and apply every row operation to the whole augmented matrix. If the result is \([\mathbf{I}_3\mid\mathbf{B}]\), then \(\mathbf{B}=\mathbf{A}^{-1}\). A row exchange \(R_i\leftrightarrow R_j\) exchanges those rows in both blocks.

Three elementary row operations are allowed: exchange two rows, multiply one row by a nonzero scalar, or add a multiple of one row to another. Each operation is reversible, so it preserves the equivalence of the systems represented by the rows. In the augmented inverse procedure, its effect on the right block is just as important as its effect on the left.

Why the Augmented Method Gives an Inverse

The justification uses elementary matrices, which are the matrices that perform one row operation by left multiplication. Each elementary matrix is invertible: its inverse performs the corresponding reverse row operation. Consequently, a sequence of row operations is left multiplication by a product \(\mathbf{E}\) of invertible elementary matrices, and that product is invertible.

Theorem: Let \(\mathbf{A}\in\mathbb{R}^{3\times3}\). If row operations transform \([\mathbf{A}\mid\mathbf{I}_3]\) into \([\mathbf{I}_3\mid\mathbf{B}]\), then \(\mathbf{B}=\mathbf{A}^{-1}\).

Proof. Let \(\mathbf{E}\) be the product of the elementary matrices for the row operations performed. Applying the same operations to each block gives \([\mathbf{E}\mathbf{A}\mid\mathbf{E}\mathbf{I}_3]\). Since the final left block is \(\mathbf{I}_3\), we have \(\mathbf{E}\mathbf{A}=\mathbf{I}_3\); since the final right block is \(\mathbf{B}\), we have \(\mathbf{E}\mathbf{I}_3=\mathbf{E}=\mathbf{B}\). The matrix \(\mathbf{E}\) is invertible because it is a product of invertible elementary matrices. From \(\mathbf{E}\mathbf{A}=\mathbf{I}_3\), multiplication on the left by \(\mathbf{E}^{-1}\) gives \(\mathbf{A}=\mathbf{E}^{-1}\). Therefore \(\mathbf{A}\mathbf{B}=\mathbf{E}^{-1}\mathbf{E}=\mathbf{I}_3\), and \(\mathbf{B}\mathbf{A}=\mathbf{E}\mathbf{E}^{-1}=\mathbf{I}_3\). Thus \(\mathbf{B}\) is a two-sided inverse of \(\mathbf{A}\). \(\square\)

A Row Exchange at the First Pivot

Worked Example: Exchange Rows Before the First Pivot

Find the inverse of \(\mathbf{A}=\begin{bmatrix}0&1&1\\1&0&1\\1&1&0\end{bmatrix}\). The top entry in the first column is zero. Exchange the first two rows in the entire augmented matrix:

$$ \left[\begin{array}{ccc|ccc} 0&1&1&1&0&0\\ 1&0&1&0&1&0\\ 1&1&0&0&0&1 \end{array}\right] \xrightarrow{R_1\leftrightarrow R_2} \left[\begin{array}{ccc|ccc} 1&0&1&0&1&0\\ 0&1&1&1&0&0\\ 1&1&0&0&0&1 \end{array}\right]. $$

The first pivot is now \(1\). Clear the entry beneath it by replacing \(R_3\) with \(R_3-R_1\), then clear the second entry in the new third row by replacing \(R_3\) with \(R_3-R_2\):

$$ \left[\begin{array}{ccc|ccc} 1&0&1&0&1&0\\ 0&1&1&1&0&0\\ 1&1&0&0&0&1 \end{array}\right] \xrightarrow{R_3\to R_3-R_1} \left[\begin{array}{ccc|ccc} 1&0&1&0&1&0\\ 0&1&1&1&0&0\\ 0&1&-1&0&-1&1 \end{array}\right] \xrightarrow{R_3\to R_3-R_2} \left[\begin{array}{ccc|ccc} 1&0&1&0&1&0\\ 0&1&1&1&0&0\\ 0&0&-2&-1&-1&1 \end{array}\right]. $$

Scale the third row by \(-\tfrac12\) to make its pivot \(1\). Then clear the third-column entries above that pivot by subtracting the third row from each of the first two rows:

$$ \left[\begin{array}{ccc|ccc} 1&0&1&0&1&0\\ 0&1&1&1&0&0\\ 0&0&-2&-1&-1&1 \end{array}\right] \xrightarrow{R_3\to-\frac12R_3} \left[\begin{array}{ccc|ccc} 1&0&1&0&1&0\\ 0&1&1&1&0&0\\ 0&0&1&\frac12&\frac12&-\frac12 \end{array}\right]. $$
$$ \left[\begin{array}{ccc|ccc} 1&0&1&0&1&0\\ 0&1&1&1&0&0\\ 0&0&1&\frac12&\frac12&-\frac12 \end{array}\right] \xrightarrow{R_1\to R_1-R_3} \left[\begin{array}{ccc|ccc} 1&0&0&-\frac12&\frac12&\frac12\\ 0&1&1&1&0&0\\ 0&0&1&\frac12&\frac12&-\frac12 \end{array}\right] \xrightarrow{R_2\to R_2-R_3} \left[\begin{array}{ccc|ccc} 1&0&0&-\frac12&\frac12&\frac12\\ 0&1&0&\frac12&-\frac12&\frac12\\ 0&0&1&\frac12&\frac12&-\frac12 \end{array}\right]. $$

The left block is \(\mathbf{I}_3\), so the right block gives

$$ \mathbf{A}^{-1}= \begin{bmatrix} -\frac12&\frac12&\frac12\\ \frac12&-\frac12&\frac12\\ \frac12&\frac12&-\frac12 \end{bmatrix}. $$

Check: Multiplying \(\mathbf{A}\) by this matrix, the first row of \(\mathbf{A}\) selects the sum of rows 2 and 3 of \(\mathbf{A}^{-1}\), which is \((1,0,0)\). The second row selects rows 1 and 3, whose sum is \((0,1,0)\); the third selects rows 1 and 2, whose sum is \((0,0,1)\). Hence \(\mathbf{A}\mathbf{A}^{-1}=\mathbf{I}_3\), as required.

A Row Exchange at a Later Pivot

A zero in the first pivot position is not the only reason to exchange rows. After a pivot has been used to clear entries below it, the next pivot position can be zero. If another row has a nonzero entry in that column, exchanging the rows allows the reduction to continue.

Worked Example: Exchange Rows at the Second Pivot

Find the inverse of \(\mathbf{A}=\begin{bmatrix}1&1&0\\2&2&1\\0&1&1\end{bmatrix}\). The first pivot is already \(1\). Replace \(R_2\) with \(R_2-2R_1\); the second entry of that row becomes zero, so exchange rows 2 and 3:

$$ \left[\begin{array}{ccc|ccc} 1&1&0&1&0&0\\ 2&2&1&0&1&0\\ 0&1&1&0&0&1 \end{array}\right] \xrightarrow{R_2\to R_2-2R_1} \left[\begin{array}{ccc|ccc} 1&1&0&1&0&0\\ 0&0&1&-2&1&0\\ 0&1&1&0&0&1 \end{array}\right] \xrightarrow{R_2\leftrightarrow R_3} \left[\begin{array}{ccc|ccc} 1&1&0&1&0&0\\ 0&1&1&0&0&1\\ 0&0&1&-2&1&0 \end{array}\right]. $$

Now the second and third pivots are both \(1\). Subtract row 3 from row 2 to clear the entry above the third pivot, then subtract the new row 2 from row 1 to clear the entry above the second pivot:

$$ \left[\begin{array}{ccc|ccc} 1&1&0&1&0&0\\ 0&1&1&0&0&1\\ 0&0&1&-2&1&0 \end{array}\right] \xrightarrow{R_2\to R_2-R_3} \left[\begin{array}{ccc|ccc} 1&1&0&1&0&0\\ 0&1&0&2&-1&1\\ 0&0&1&-2&1&0 \end{array}\right] \xrightarrow{R_1\to R_1-R_2} \left[\begin{array}{ccc|ccc} 1&0&0&-1&1&-1\\ 0&1&0&2&-1&1\\ 0&0&1&-2&1&0 \end{array}\right]. $$

Thus the right block is the inverse:

$$ \mathbf{A}^{-1}= \begin{bmatrix} -1&1&-1\\ 2&-1&1\\ -2&1&0 \end{bmatrix}. $$

Check: The rows of \(\mathbf{A}\mathbf{A}^{-1}\) are, respectively, row 1 plus row 2 of the inverse, twice row 1 plus twice row 2 plus row 3, and row 2 plus row 3. These are \((1,0,0)\), \((0,1,0)\), and \((0,0,1)\). Therefore \(\mathbf{A}\mathbf{A}^{-1}=\mathbf{I}_3\).

A Compact Example with Exact Fractions

Worked Example: A First-Column Exchange

Find the inverse of \(\mathbf{A}=\begin{bmatrix}0&2&0\\1&1&0\\0&0&3\end{bmatrix}\). Exchange rows 1 and 2, then scale row 2 by \(\tfrac12\) and row 3 by \(\tfrac13\):

$$ \left[\begin{array}{ccc|ccc} 0&2&0&1&0&0\\ 1&1&0&0&1&0\\ 0&0&3&0&0&1 \end{array}\right] \xrightarrow{R_1\leftrightarrow R_2} \left[\begin{array}{ccc|ccc} 1&1&0&0&1&0\\ 0&2&0&1&0&0\\ 0&0&3&0&0&1 \end{array}\right]. $$
$$ \left[\begin{array}{ccc|ccc} 1&1&0&0&1&0\\ 0&2&0&1&0&0\\ 0&0&3&0&0&1 \end{array}\right] \xrightarrow{R_2\to\frac12R_2} \left[\begin{array}{ccc|ccc} 1&1&0&0&1&0\\ 0&1&0&\frac12&0&0\\ 0&0&3&0&0&1 \end{array}\right] \xrightarrow{R_3\to\frac13R_3} \left[\begin{array}{ccc|ccc} 1&1&0&0&1&0\\ 0&1&0&\frac12&0&0\\ 0&0&1&0&0&\frac13 \end{array}\right]. $$

Finally, replace \(R_1\) with \(R_1-R_2\):

$$ \left[\begin{array}{ccc|ccc} 1&1&0&0&1&0\\ 0&1&0&\frac12&0&0\\ 0&0&1&0&0&\frac13 \end{array}\right] \xrightarrow{R_1\to R_1-R_2} \left[\begin{array}{ccc|ccc} 1&0&0&-\frac12&1&0\\ 0&1&0&\frac12&0&0\\ 0&0&1&0&0&\frac13 \end{array}\right]. $$

Therefore \(\mathbf{A}^{-1}=\begin{bmatrix}-\tfrac12&1&0\\\tfrac12&0&0\\0&0&\tfrac13\end{bmatrix}\). Check: Row 1 of \(\mathbf{A}\) is twice row 2 of the inverse, giving \((1,0,0)\). Row 2 of \(\mathbf{A}\) adds rows 1 and 2 of the inverse, giving \((0,1,0)\). Row 3 is three times row 3 of the inverse, giving \((0,0,1)\). Thus the product is \(\mathbf{I}_3\).

Common Pitfall: Exchanging Only One Block

A row operation on an augmented matrix must act on both blocks. A tempting but incorrect calculation is to exchange the first two rows of \(\mathbf{A}\) to get a usable pivot while leaving the identity block unchanged. That starts from \([\mathbf{P}\mathbf{A}\mid\mathbf{I}_3]\), not from a row-equivalent version of \([\mathbf{A}\mid\mathbf{I}_3]\), where \(\mathbf{P}\) exchanges the first two rows. Reducing that altered matrix would produce the inverse of \(\mathbf{P}\mathbf{A}\), not the inverse of \(\mathbf{A}\).

For the first example, the incorrect right block would be the correct inverse with its first two columns exchanged: \(\begin{bmatrix}\frac12&-\frac12&\frac12\\-\frac12&\frac12&\frac12\\\frac12&\frac12&-\frac12\end{bmatrix}\). Multiplying \(\mathbf{A}\) by this matrix gives a first row of \((0,1,0)\), not \((1,0,0)\). The correction is to perform \(R_1\leftrightarrow R_2\) on the entire augmented matrix, including the identity block.

When using the method, check the left block after each operation and keep the right block aligned row by row. Once the left block is the identity, read the entire right block as the candidate inverse and check the product \(\mathbf{A}\mathbf{A}^{-1}\). These checks catch arithmetic errors and confirm the result for the particular matrix.

Check Your Understanding

For each question, track operations on the full augmented matrix and verify any inverse by multiplication.

  1. Why is a row exchange allowed when the next pivot position is zero?
  2. In the first worked example, which row exchange creates a nonzero first pivot?
  3. For \(\begin{bmatrix}0&1&0\\1&0&1\\0&1&1\end{bmatrix}\), identify an initial row exchange and describe the next pivot step.
  4. Explain why the right block must be changed whenever a row operation is applied to the left block.
  5. State the two product identities that a computed inverse should satisfy.

Test yourself: Linear Algebra final exam practice

Ready to check what you know? Work a full-length practice final, then open the complete worked solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers the full Calculus AB & BC curriculum (the core of Calculus I and II): full review, every practice question, and step-by-step solutions to each one.

QR code to download the Calc Pass app

Get the Calc Pass App

Scan to download and practice on the go, with instant scoring.

Calc Pass Volume 1: 1,114 Practice Questions book cover

Vol. 1: 1,114 Questions

The complete practice question bank, organized by AB & BC topic.

View on Amazon
Calc Pass Volume 2: Solutions Manual book cover

Vol. 2: Solutions Manual

Fully worked solutions to every question in Volume 1.

View on Amazon