Tutorials › Linear Algebra › Reversing a Sequence of Row Operations

Elementary Matrices and Inverses · Tutorial 90 of 1000

Reversing a Sequence of Row Operations

Translate row-operation sequences into matrix products, then reverse both the operations and their order to compute the inverse product.

Beginner 10 min read

What You'll Learn

  • Represent each row operation by left multiplication with an elementary matrix.
  • Write the product that represents a sequence in the correct order.
  • Reverse a sequence by applying the inverse operations in reverse order.
  • Compute and check the inverse of a product of elementary matrices.
  • Recognize why undoing the operations in their original order fails.

From a Sequence of Row Operations to a Matrix Product

A row operation changes a matrix in a controlled way. Once each operation is represented by an elementary matrix, carrying out several row operations becomes matrix multiplication. The order matters: the operation performed last appears on the left of the product. To undo the full sequence, reverse the order of the operations as well as undoing each individual operation.

Work over \(\mathbb{R}\), and let \(\mathbf{A}\) be a matrix with \(m\) rows. An elementary matrix of size \(m\times m\) is obtained by performing one elementary row operation on \(\mathbf{I}_m\). Left multiplication by that matrix performs the same row operation on any \(m\)-row matrix. The inverse of an elementary matrix represents the row operation that undoes its operation. In particular, a row exchange undoes itself, scaling a row by a nonzero \(c\) is undone by scaling it by \(1/c\), and adding \(c\) times one row to another is undone by adding \(-c\) times that row.

Definition: Suppose a sequence consists of row operations \(S_1,S_2,\dots,S_k\), in that order, and let \(\mathbf{E}_i\) be the elementary matrix representing \(S_i\). Its operation matrix is \(\mathbf{P}=\mathbf{E}_k\cdots\mathbf{E}_2\mathbf{E}_1\). It acts on an \(m\)-row matrix \(\mathbf{A}\) by \(\mathbf{P}\mathbf{A}\). The sequence is reversed by applying the inverse of \(S_k\) first, then the inverse of \(S_{k-1}\), continuing through the inverse of \(S_1\).

For example, if \(S_1\) is represented by \(\mathbf{E}_1\) and \(S_2\) by \(\mathbf{E}_2\), then first applying \(S_1\) gives \(\mathbf{E}_1\mathbf{A}\). Applying \(S_2\) to that result gives \(\mathbf{E}_2(\mathbf{E}_1\mathbf{A})=(\mathbf{E}_2\mathbf{E}_1)\mathbf{A}\). This explains why the written product runs opposite to the chronological list of operations.

Proposition: For any finite sequence of row operations \(S_1,\dots,S_k\), with elementary matrices \(\mathbf{E}_1,\dots,\mathbf{E}_k\), the result of applying the sequence to \(\mathbf{A}\) is \((\mathbf{E}_k\cdots\mathbf{E}_1)\mathbf{A}\). For the empty sequence, the operation matrix is \(\mathbf{I}_m\).

Proof. We use induction on the number \(k\) of operations. If \(k=0\), no row changes occur, so the result is \(\mathbf{I}_m\mathbf{A}=\mathbf{A}\). Now assume the statement holds for a sequence of \(k\) operations. Its result is \((\mathbf{E}_k\cdots\mathbf{E}_1)\mathbf{A}\). A further operation \(S_{k+1}\), represented by \(\mathbf{E}_{k+1}\), left-multiplies this result, giving \(\mathbf{E}_{k+1}(\mathbf{E}_k\cdots\mathbf{E}_1)\mathbf{A}=(\mathbf{E}_{k+1}\cdots\mathbf{E}_1)\mathbf{A}\) by associativity of matrix multiplication. This proves the claim for \(k+1\), and hence for every finite sequence. \(\square\)

The Rule for Reversing the Product

Theorem: Let \(\mathbf{P}=\mathbf{E}_k\cdots\mathbf{E}_1\) represent a finite sequence of row operations, where each \(\mathbf{E}_i\) is an elementary matrix. The operation matrix for undoing the sequence is \(\mathbf{Q}=\mathbf{E}_1^{-1}\cdots\mathbf{E}_k^{-1}\), and \(\mathbf{Q}\mathbf{P}=\mathbf{P}\mathbf{Q}=\mathbf{I}_m\).

Proof. To undo the last operation \(S_k\), first apply its inverse, represented by \(\mathbf{E}_k^{-1}\); then undo \(S_{k-1}\), and continue until applying \(\mathbf{E}_1^{-1}\). By the proposition, the matrix for this reversed sequence is \(\mathbf{E}_1^{-1}\cdots\mathbf{E}_k^{-1}=\mathbf{Q}\). Each elementary matrix is invertible, so \(\mathbf{E}_i^{-1}\mathbf{E}_i=\mathbf{E}_i\mathbf{E}_i^{-1}=\mathbf{I}_m\). Associativity lets us cancel adjacent inverse pairs in both products: \(\mathbf{Q}\mathbf{P}=\mathbf{E}_1^{-1}\cdots\mathbf{E}_k^{-1}\mathbf{E}_k\cdots\mathbf{E}_1=\mathbf{I}_m\) and \(\mathbf{P}\mathbf{Q}=\mathbf{E}_k\cdots\mathbf{E}_1\mathbf{E}_1^{-1}\cdots\mathbf{E}_k^{-1}=\mathbf{I}_m\). Thus the reversed sequence undoes the original on either side. If \(k=0\), both products are the empty product \(\mathbf{I}_m\), so the statement also holds for an empty sequence. \(\square\)

The theorem is a sequence-specific way to find an inverse: identify each inverse operation, reverse the order, and multiply the corresponding elementary matrices. It does not mean that the inverse product is formed by simply inverting each factor while keeping their original order.

Worked Sequences and Their Reversals

Worked Example: Exchange, Scale, Then Add

Apply, in order, \(R_1\to R_1+2R_2\), \(R_2\to 3R_2\), and \(R_1\leftrightarrow R_2\). Find the operation matrix and its inverse.

The elementary matrices are obtained by performing each operation on \(\mathbf{I}_2\):

$$ \mathbf{E}_1=\begin{bmatrix}1&2\\0&1\end{bmatrix},\qquad \mathbf{E}_2=\begin{bmatrix}1&0\\0&3\end{bmatrix},\qquad \mathbf{E}_3=\begin{bmatrix}0&1\\1&0\end{bmatrix}. $$

The chronological sequence is \(S_1,S_2,S_3\), so its product is \(\mathbf{P}=\mathbf{E}_3\mathbf{E}_2\mathbf{E}_1\). First,

$$ \mathbf{E}_2\mathbf{E}_1 =\begin{bmatrix}1&0\\0&3\end{bmatrix} \begin{bmatrix}1&2\\0&1\end{bmatrix} =\begin{bmatrix}1&2\\0&3\end{bmatrix}, \qquad \mathbf{P} =\begin{bmatrix}0&1\\1&0\end{bmatrix} \begin{bmatrix}1&2\\0&3\end{bmatrix} =\begin{bmatrix}0&3\\1&2\end{bmatrix}. $$

To reverse the sequence, first exchange the rows, then scale the new second row by \(1/3\), then replace row 1 by row 1 minus twice row 2. Thus

$$ \mathbf{Q}=\mathbf{E}_1^{-1}\mathbf{E}_2^{-1}\mathbf{E}_3^{-1} =\begin{bmatrix}1&-2\\0&1\end{bmatrix} \begin{bmatrix}1&0\\0&\frac13\end{bmatrix} \begin{bmatrix}0&1\\1&0\end{bmatrix} =\begin{bmatrix}-\frac23&1\\\frac13&0\end{bmatrix}. $$

Check: Multiplication in both orders gives

$$ \mathbf{P}\mathbf{Q} =\begin{bmatrix}1&0\\0&1\end{bmatrix}, \qquad \mathbf{Q}\mathbf{P} =\begin{bmatrix}1&0\\0&1\end{bmatrix}. $$

For instance, the first row of \(\mathbf{P}\mathbf{Q}\) is \(3\) times the second row of \(\mathbf{Q}\), namely \((1,0)\); its second row is the first row of \(\mathbf{Q}\) plus twice its second row, namely \((0,1)\). This confirms the product and its inverse.

Worked Example: Three Operations on a Matrix

Apply \(R_2\to R_2+2R_1\), then \(R_1\leftrightarrow R_3\), then \(R_3\to 2R_3\) to

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

The successive row operations give

$$ \begin{bmatrix}1&2&0\\0&1&3\\2&0&1\end{bmatrix} \xrightarrow{R_2\to R_2+2R_1} \begin{bmatrix}1&2&0\\2&5&3\\2&0&1\end{bmatrix} \xrightarrow{R_1\leftrightarrow R_3} \begin{bmatrix}2&0&1\\2&5&3\\1&2&0\end{bmatrix} \xrightarrow{R_3\to 2R_3} \begin{bmatrix}2&0&1\\2&5&3\\2&4&0\end{bmatrix}. $$

The elementary matrices and their product are

$$ \mathbf{E}_1=\begin{bmatrix}1&0&0\\2&1&0\\0&0&1\end{bmatrix},\quad \mathbf{E}_2=\begin{bmatrix}0&0&1\\0&1&0\\1&0&0\end{bmatrix},\quad \mathbf{E}_3=\begin{bmatrix}1&0&0\\0&1&0\\0&0&2\end{bmatrix}, $$
$$ \mathbf{E}_2\mathbf{E}_1 =\begin{bmatrix}0&0&1\\2&1&0\\1&0&0\end{bmatrix}, \qquad \mathbf{P}=\mathbf{E}_3\mathbf{E}_2\mathbf{E}_1 =\begin{bmatrix}0&0&1\\2&1&0\\2&0&0\end{bmatrix}. $$

Indeed, multiplying \(\mathbf{P}\mathbf{A}\) gives rows equal to row 3 of \(\mathbf{A}\), twice row 1 plus row 2, and twice row 1, respectively. The result is \(\begin{bmatrix}2&0&1\\2&5&3\\2&4&0\end{bmatrix}\), as obtained by the row operations.

The reverse operations are \(R_3\to \tfrac12R_3\), then \(R_1\leftrightarrow R_3\), then \(R_2\to R_2-2R_1\). Their product is

$$ \mathbf{Q}=\mathbf{E}_1^{-1}\mathbf{E}_2^{-1}\mathbf{E}_3^{-1} =\begin{bmatrix}1&0&0\\-2&1&0\\0&0&1\end{bmatrix} \begin{bmatrix}0&0&1\\0&1&0\\1&0&0\end{bmatrix} \begin{bmatrix}1&0&0\\0&1&0\\0&0&\frac12\end{bmatrix} =\begin{bmatrix}0&0&\frac12\\0&1&-1\\1&0&0\end{bmatrix}. $$

Check: Multiplying the final matrix from the row operations by \(\mathbf{Q}\) on the left gives \(\mathbf{Q}\mathbf{P}\mathbf{A}=\mathbf{A}\). In detail, the rows of \(\mathbf{Q}\mathbf{P}\mathbf{A}\) are half of the final third row, the final second row minus the final third row, and the final first row. They are \((1,2,0)\), \((0,1,3)\), and \((2,0,1)\), exactly the rows of \(\mathbf{A}\). Also, direct multiplication gives \(\mathbf{Q}\mathbf{P}=\mathbf{I}_3\).

Worked Example: A Product Whose Factors Do Not Commute

Consider the sequence \(R_1\to R_1+R_2\), then \(R_2\to R_2-3R_1\), then \(R_1\to R_1+2R_2\). Find its operation matrix and inverse product.

The elementary matrices are \(\mathbf{E}_1=\begin{bmatrix}1&1\\0&1\end{bmatrix}\), \(\mathbf{E}_2=\begin{bmatrix}1&0\\-3&1\end{bmatrix}\), and \(\mathbf{E}_3=\begin{bmatrix}1&2\\0&1\end{bmatrix}\). Multiplying in the order required by the sequence gives

$$ \mathbf{E}_2\mathbf{E}_1 =\begin{bmatrix}1&1\\-3&-2\end{bmatrix}, \qquad \mathbf{P}=\mathbf{E}_3\mathbf{E}_2\mathbf{E}_1 =\begin{bmatrix}-5&-3\\-3&-2\end{bmatrix}. $$

The reversed operations are \(R_1\to R_1-2R_2\), \(R_2\to R_2+3R_1\), and \(R_1\to R_1-R_2\), in that order. Therefore

$$ \mathbf{Q}=\mathbf{E}_1^{-1}\mathbf{E}_2^{-1}\mathbf{E}_3^{-1} =\begin{bmatrix}1&-1\\0&1\end{bmatrix} \begin{bmatrix}1&0\\3&1\end{bmatrix} \begin{bmatrix}1&-2\\0&1\end{bmatrix} =\begin{bmatrix}-2&3\\3&-5\end{bmatrix}. $$

Check: Multiplying back gives

$$ \mathbf{P}\mathbf{Q} =\begin{bmatrix}10-9&-15+15\\6-6&-9+10\end{bmatrix} =\begin{bmatrix}1&0\\0&1\end{bmatrix}. $$

The reverse product also gives \(\mathbf{Q}\mathbf{P}=\mathbf{I}_2\): its rows are \(2\) times the first row of \(\mathbf{P}\) with the sign reversed, plus \(3\) times the second row for the first row of the product, and \(3\) times the first row with the sign reversed, minus \(5\) times the second row for the second. Entrywise these are \((1,0)\) and \((0,1)\).

Common Mistake: Undoing Operations in the Original Order

In the last example, the correct inverse product is \(\mathbf{E}_1^{-1}\mathbf{E}_2^{-1}\mathbf{E}_3^{-1}\), because the inverse of the last operation must act first. A common error is to keep the original order and write \(\mathbf{W}=\mathbf{E}_3^{-1}\mathbf{E}_2^{-1}\mathbf{E}_1^{-1}\). The factors here are \(\mathbf{E}_3^{-1}=\begin{bmatrix}1&-2\\0&1\end{bmatrix}\), \(\mathbf{E}_2^{-1}=\begin{bmatrix}1&0\\3&1\end{bmatrix}\), and \(\mathbf{E}_1^{-1}=\begin{bmatrix}1&-1\\0&1\end{bmatrix}\), so the wrong product is

$$ \mathbf{W} =\begin{bmatrix}1&-2\\0&1\end{bmatrix} \begin{bmatrix}1&0\\3&1\end{bmatrix} \begin{bmatrix}1&-1\\0&1\end{bmatrix} =\begin{bmatrix}-5&3\\3&-2\end{bmatrix}. $$

It fails the inverse check:

$$ \mathbf{P}\mathbf{W} =\begin{bmatrix}-5&-3\\-3&-2\end{bmatrix} \begin{bmatrix}-5&3\\3&-2\end{bmatrix} =\begin{bmatrix}16&-9\\9&-5\end{bmatrix} \ne \mathbf{I}_2. $$

The correction is to write the actual undoing sequence in words first: undo the last operation, then the preceding one, and continue back to the first. Only then form the matrix product. This order check is especially useful when several operations are involved, because elementary matrices generally cannot be rearranged without changing the result.

Why Reversal Is Useful

A long row-operation sequence can be recorded compactly as a single product \(\mathbf{P}\). The theorem explains how to reverse that record without guessing: replace each operation by its inverse and list those inverse operations from last to first. The resulting product undoes the entire sequence, as confirmed by multiplying it with \(\mathbf{P}\) on either side.

This same bookkeeping is useful whenever row operations are used to transform a matrix. It separates two tasks that are easy to confuse: determining which operation undoes each individual step, and determining the order in which those undoing operations must be applied. The first task changes each operation; the second reverses the list.

Check Your Understanding

For each question, keep the chronological operation order distinct from the written matrix-product order.

  1. If the operations have elementary matrices \(\mathbf{E}_1,\mathbf{E}_2,\mathbf{E}_3\) in that order, write the operation matrix.
  2. Write the operation sequence that undoes \(R_1\leftrightarrow R_2\), followed by \(R_2\to 4R_2\).
  3. For \(\mathbf{P}=\mathbf{E}_2\mathbf{E}_1\), write the inverse product in terms of \(\mathbf{E}_1^{-1}\) and \(\mathbf{E}_2^{-1}\).
  4. Explain why scaling a row by \(c\) has an inverse row operation only when \(c\ne0\).
  5. Given a proposed reverse product \(\mathbf{Q}\), what matrix equation can you compute to check that it undoes \(\mathbf{P}\)?

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