## Determinant and row reduction

Let $$A$$ be an $$n \times n$$ matrix. Suppose that transforming $$A$$ to a matrix in reduced row-echelon form using elementary row operations gives us the matrix $$R$$.

Recall that there exist elementary matrices $$M_1,\ldots,M_k$$ such that $$M_k M_{k-1} \cdots M_1 A = R$$. Taking the determinants of both sides, we get $$\det(M_k M_{k-1} \cdots M_1 A ) = \det(R)$$. Now, using the fact that the determinant of a product of matrices is the same as the product of the determinants of the matrices, we get that $\det(A) = \frac{\det(R)}{\det(M_1)\cdots \det(M_k)}.$ (For this formula to make sense, we must have $$\det(M_i)\neq 0$$ for all $$i = 1,\ldots, k$$. This fact is established below.)

Note that $$R$$ is either the identity matrix or contains a row of 0's. Hence, $$\det(R)$$ is either 1 or 0. As a result, if we know the determinants of elementary matrices, we can get the value of the determinant of $$A$$.

## Determinants of elementary matrices

The determinants of elementary matrices are quite easy to compute as we will now see.

### 1. $$R_i \leftarrow R_i + \alpha R_j$$

The elementary matrix that corresponds to adding a scalar multiple of a row to another row is a triangular matrix with 1's on the diagonal. As we have seen, the determinant of a triangular matrix is given by the product of the diagonal entries. Hence, the determinant of such an elementary matrix is 1. For example, the elementary matrix $$\begin{bmatrix} 1 & -2\\ 0 & 1\end{bmatrix}$$ corresponds to adding $$-2$$ times row 2 to row 1. Its determinant is $$1$$.

### 2. $$R_i \leftarrow \alpha R_i$$, $$\alpha \neq 0$$

The elementary matrix that corresponds to multiplying row $$i$$ by a nonzero constant $$\alpha$$ is a diagonal matrix with 1's on the diagonal except at the $$i$$th diagonal entry, which is $$\alpha$$. So the determinant, given by the product of the diagonal entries, is simply $$\alpha$$. For example, the elementary matrix $$\begin{bmatrix} 1 & 0 & 0\\ 0 & \frac{1}{2} & 0\\0 & 0 & 1\end{bmatrix}$$ corresponds to multiplying row 2 by $$\frac{1}{2}$$. Its determinant is $$\frac{1}{2}$$.

### 3. $$R_i \leftrightarrow R_j$$

Finally, the elementary matrix that corresponds to interchanging row $$i$$ and row $$j$$ is a permutation matrix for a permutation with an odd number of inversions. Hence, its determinant is $$-1$$.

## Computation example

Let $$A = \begin{bmatrix} 1 & 0 & -1\\ 2 & 1 & -2\\ 0 & -1 & 2\end{bmatrix}$$. We will compute $$\det(A)$$ using row reduction.

Performing $$R_2 \leftarrow R_2 + (-2) R_1$$ gives $$\begin{bmatrix} 1 & 0 & -1\\ 0 & 1 & 0\\ 0 & -1 & 2\end{bmatrix}$$. Call this matrix $$Q_1$$. Then $$\det(A) = \det(Q_1)$$ since the determinant of the elementary martrix that corresponds to the elementary row operation is 1. (See discussion above.)

Now, applying $$R_3 \leftarrow R_3 + R_2$$ to $$Q_1$$ gives $$\begin{bmatrix} 1 & 0 & -1\\ 0 & 1 & 0\\ 0 & 0 & 2\end{bmatrix}$$. Call this matrix $$Q_2$$. Then $$\det(Q_1) = \det(Q_2)$$ since the determinant of the elementary martrix that corresponds to the elementary row operation is 1. So $$\det(A) = \det(Q_2) = 2$$ since $$Q_2$$ is a triangular matrix and the product of the diagonal entries is $$2$$.

Remark. Note that the elementary row operation that adds a multiple of a row to another row does not alter the determinant. And the elementary row operation that interchange two rows simply flips the sign of the determinant. Hence, one often uses only these operations to bring the matrix into triangular form when computing the determinant using row reduction. For example,

$\begin{array}{rcll} \left| \begin{array}{ccc} -4 & 1 & 1 \\ 1 & 2 & 0 \\ -1 & 1 & 1 \end{array}\right | & = & \left| \begin{array}{ccc} -4 & 1 & 1 \\ 1 & 2 & 0 \\ 0 & 3 & 1 \end{array}\right | & (R_3 \leftarrow R_3 + R_2) \\ & = & \left| \begin{array}{ccc} 0 & 9 & 1 \\ 1 & 2 & 0 \\ 0 & 3 & 1 \end{array}\right | & (R_1 \leftarrow R_1 + 4R_2) \\ & = & \left| \begin{array}{ccc} 0 & 0 & -2 \\ 1 & 2 & 0 \\ 0 & 3 & 1 \end{array}\right | & (R_1 \leftarrow R_1 - 3R_2) \\ & = & -\left| \begin{array}{ccc} 1 & 2 & 0 \\ 0 & 0 & -2 \\ 0 & 3 & 1 \end{array}\right | & (R_1 \leftrightarrow R_2) \\ & = & -\left(-\left| \begin{array}{ccc} 1 & 2 & 0 \\ 0 & 3 & 1 \\ 0 & 0 & -2 \end{array}\right | \right) & (R_2 \leftrightarrow R_3) \\ & = & \left| \begin{array}{ccc} 1 & 2 & 0 \\ 0 & 3 & 1 \\ 0 & 0 & -2 \end{array}\right | \end{array}$ Now the matrix is upper triangular. So the determinant is $$1\cdot 3 \cdot (-2) = -6$$.

## Exercises

1. Compute the determinant of each of the following:

1. $$\begin{bmatrix} 1 & 2 \\ -1 & -3\end{bmatrix}$$.

2. $$\begin{bmatrix} 2 & 0 & 1 \\ -1 & 1 & -3 \\ 1 & 0 & 0\end{bmatrix}$$.

2. Let $$A$$ be a $$3\times 3$$ matrix with $$\det(A) = 2$$. Suppose that $$B$$ is obtained from $$A$$ by performing the following sequence of elementary row operations $$R_1 \leftrightarrow R_3$$, $$R_2 \leftarrow -\frac{1}{3}R_2$$, $$R_3 \leftarrow R_3 + 2R_1$$. What is $$\det(B)$$?