From Row Operations to Matrix Multiplication
Row operations change a matrix in a controlled way: they exchange two rows, multiply a row by a nonzero scalar, or add a multiple of one row to another. Each such operation can itself be represented by a matrix. Multiplying on the left by that matrix performs the corresponding operation on the rows of a second matrix. This provides an algebraic way to record row operations and explains why the order of matrix factors matters when several operations are performed.
Throughout this tutorial the scalar field is \(\mathbb{R}\). Let \(\mathbf{A}\in\mathbb{R}^{m\times n}\), and write its rows as \(\mathbf{r}_1,\dots,\mathbf{r}_m\). A row operation on \(\mathbf{A}\) changes one or more of these rows, while keeping the matrix size \(m\times n\) unchanged. To represent an operation on these \(m\) rows, we need a matrix with \(m\) rows and \(m\) columns.
The key point is that an elementary matrix acts on the rows of a matrix of compatible size. It must have as many columns as the matrix being multiplied, so if \(\mathbf{A}\) has \(m\) rows, the product \(\mathbf{E}\mathbf{A}\) is defined for an \(m\times m\) elementary matrix \(\mathbf{E}\). The entries of \(\mathbf{A}\) need not be square: \(\mathbf{A}\) may have any positive number \(n\) of columns.
Proof. Denote row \(k\) of \(\mathbf{A}\) by \(\mathbf{r}_k\), and let \(e_{k\ell}\) be the entry of \(\mathbf{E}\) in row \(k\), column \(\ell\). By the definition of matrix multiplication, row \(k\) of \(\mathbf{E}\mathbf{A}\) is \(\sum_{\ell=1}^{m}e_{k\ell}\mathbf{r}_{\ell}\). It is therefore enough to examine the rows of \(\mathbf{E}\) created by each allowed operation.
If the operation is \(R_i\leftrightarrow R_j\), the rows of \(\mathbf{E}\) are the rows of \(\mathbf{I}_m\) with rows \(i\) and \(j\) exchanged. Consequently, row \(i\) of \(\mathbf{E}\mathbf{A}\) is \(\mathbf{r}_j\), row \(j\) is \(\mathbf{r}_i\), and every other row \(k\) is \(\mathbf{r}_k\). This is precisely the row swap.
If the operation is \(R_i\to cR_i\), where \(c\ne0\), row \(i\) of \(\mathbf{E}\) has \(c\) in column \(i\) and zero elsewhere. Thus row \(i\) of \(\mathbf{E}\mathbf{A}\) is \(c\mathbf{r}_i\); each other row \(k\) is still \(\mathbf{r}_k\). This is precisely the stated scaling.
If the operation is \(R_i\to R_i+cR_j\), where \(i\ne j\), row \(i\) of \(\mathbf{E}\) has a \(1\) in column \(i\), a \(c\) in column \(j\), and zeros elsewhere. Thus row \(i\) of the product is \(\mathbf{r}_i+c\mathbf{r}_j\). Each row \(k\ne i\) remains \(\mathbf{r}_k\), because its row in \(\mathbf{E}\) is unchanged from \(\mathbf{I}_m\). This proves the claim for row replacement as well, and these are all three allowed operations. \(\square\)
Two-by-Two Examples
Worked Example: Swapping Two Rows
Let \(\mathbf{A}=\begin{bmatrix}1&2\\3&4\end{bmatrix}\). To exchange its two rows, perform \(R_1\leftrightarrow R_2\) on \(\mathbf{I}_2\). This gives the elementary matrix \(\mathbf{E}=\begin{bmatrix}0&1\\1&0\end{bmatrix}\). Now multiply on the left:
The first row of the product is the original second row, and its second row is the original first row, as required.
Check: applying \(R_1\leftrightarrow R_2\) directly to \(\mathbf{A}\) gives \(\begin{bmatrix}3&4\\1&2\end{bmatrix}\), the same result as the multiplication.
Worked Example: Scaling a Row
Let \(\mathbf{B}=\begin{bmatrix}2&1\\3&-1\end{bmatrix}\), and apply \(R_2\to -2R_2\). Applying this operation to \(\mathbf{I}_2\) gives \(\mathbf{F}=\begin{bmatrix}1&0\\0&-2\end{bmatrix}\). The product is
The first row remains \((2,1)\). The second row is \(-2(3,-1)=(-6,2)\), so the product has carried out the requested scaling.
Check: applying \(R_2\to-2R_2\) directly to \(\mathbf{B}\) also gives \(\begin{bmatrix}2&1\\-6&2\end{bmatrix}\).
A Three-by-Three Row Replacement
Worked Example: Adding a Multiple of One Row to Another
Let \(\mathbf{C}=\begin{bmatrix}1&2&-1\\0&3&4\\2&-1&5\end{bmatrix}\), and apply \(R_3\to R_3+2R_1\). Start with \(\mathbf{I}_3\) and perform the same operation on its third row. The resulting elementary matrix is \(\mathbf{G}=\begin{bmatrix}1&0&0\\0&1&0\\2&0&1\end{bmatrix}\). Multiplying gives
The first two rows are unchanged. The third row is the original third row plus twice the original first row: \((2,-1,5)+2(1,2,-1)=(2,-1,5)+(2,4,-2)=(4,3,3)\).
Check: applying \(R_3\to R_3+2R_1\) directly gives third row \((4,3,3)\), so the direct row operation and the product agree.
Reading the Elementary Matrix
The rows of the elementary matrix show exactly which original rows contribute to each row of the product. For a swap, two rows of the identity have traded places. For a scaling, one row of the identity has been multiplied by the scaling factor. For a replacement \(R_i\to R_i+cR_j\), row \(i\) of the identity acquires the extra \(c\) in column \(j\). Matrix multiplication then forms each output row using the coefficients in the corresponding row of the elementary matrix.
This perspective also explains why an elementary matrix has the same size as the identity matrix on which its operation was performed, rather than the same size as \(\mathbf{A}\). The row operation concerns the rows of \(\mathbf{A}\), so the number of rows determines the size of the left factor. The number of columns of \(\mathbf{A}\) does not change which rows are exchanged or combined.
When a sequence of row operations is carried out, each operation has its own elementary matrix. The first operation is represented by the factor nearest \(\mathbf{A}\) in the product, because matrix multiplication is evaluated from right to left. For example, if \(\mathbf{E}_1\) represents the first operation and \(\mathbf{E}_2\) the second, the resulting matrix is \(\mathbf{E}_2\mathbf{E}_1\mathbf{A}\): first \(\mathbf{E}_1\) acts on \(\mathbf{A}\), then \(\mathbf{E}_2\) acts on the result. Reversing these factors generally represents a different order of operations.
Common Pitfall: Multiplying on the Wrong Side
Left multiplication performs row operations; right multiplication does not generally perform the same row operation. For a concrete check, use the swap matrix \(\mathbf{E}=\begin{bmatrix}0&1\\1&0\end{bmatrix}\) and \(\mathbf{A}=\begin{bmatrix}1&2\\3&4\end{bmatrix}\). We found that \(\mathbf{E}\mathbf{A}=\begin{bmatrix}3&4\\1&2\end{bmatrix}\), which swaps the rows. But multiplying on the right gives
This has exchanged the columns of \(\mathbf{A}\), not its rows. A common incorrect calculation is to write \(\mathbf{A}\mathbf{E}\) when the aim is to swap rows. The correction is to put the elementary matrix on the left: \(\mathbf{E}\mathbf{A}\). More generally, check both the side of multiplication and the dimensions: an \(m\times m\) elementary matrix on the left acts on the \(m\) rows.
The connection is useful because row reduction can now be described with matrix products. Each individual row operation corresponds to left multiplication by an elementary matrix, and a sequence corresponds to a product of such matrices. This lets us keep track of row operations algebraically while still checking them with ordinary matrix multiplication. The essential rule is simple: form the elementary matrix by performing the desired operation on the appropriate identity matrix, then multiply the target matrix on the left.
Check Your Understanding
For each question, identify the row operation and use the elementary matrix to verify the resulting rows.
- What elementary matrix performs \(R_1\leftrightarrow R_2\) on a matrix with two rows?
- Find the elementary matrix for \(R_1\to 3R_1\) in a three-row matrix.
- For a three-row matrix, construct the elementary matrix for \(R_2\to R_2-4R_3\).
- If \(\mathbf{A}\) has size \(3\times5\), what size must an elementary matrix have to perform a row operation by left multiplication?
- Using \(\mathbf{A}=\begin{bmatrix}1&2\\3&4\end{bmatrix}\), compute \(\mathbf{A}\mathbf{E}\) for the row-swap elementary matrix \(\mathbf{E}\), and explain why that product is not the row swap of \(\mathbf{A}\).