Unit 5, lesson 25

Computing Determinants with Row Operations

How each row operation changes a determinant, why a triangular determinant is the product of its diagonal, how minors and cofactors give cofactor expansion, and why the determinant is linear in one column and multiplicative.

  • Video 25
  • Computing and Using Determinants

Expanding an n×nn \times n determinant all the way down produces n!n! products, which is already 3,628,8003{,}628{,}800 products for a 10×1010 \times 10 matrix. Elimination reaches a triangular matrix far faster, and the determinant of a triangular matrix is just the product of its diagonal entries. The price is bookkeeping, because some row operations change the determinant and others do not. This lesson keeps a ledger of those changes, adds cofactor expansion as a definition and a second method of calculation, and proves that the determinant of a product is the product of the determinants.

Key terms

Row operations and the determinant

Definition Let AA be an n×nn \times n matrix and let BB be obtained from AA by one row operation.

  1. If BB swaps two rows of AA, then det⁡B=−det⁡A\det B = -\det A.
  2. If BB multiplies one row of AA by a scalar kk, then det⁡B=kdet⁡A\det B = k \det A.
  3. If BB adds a multiple of one row of AA to a different row, then det⁡B=det⁡A\det B = \det A.

These rules hold for every nn and follow from cofactor expansion and linearity, described below. A determinant ledger records the factor of each operation, −1-1 for a swap, kk for a scaling and 11 for a replacement. If operations with factors f1,…,fmf_1, \dots, f_m turn AA into BB, then det⁡B=f1f2⋯fmdet⁡A\det B = f_1 f_2 \cdots f_m \det A. When every factor is nonzero, as in elimination, this can be solved for det⁡A\det A. Multiplying a row by 00 cannot be undone and is never an elimination step.

In plain words A swap flips the sign, a scaling multiplies by the scale factor, and a row replacement changes nothing. Keep a running record of the factors, and as long as none of them is zero, the matrix at the end still tells you the determinant you started with.

Example Start from

A=[1234],det⁡A=4−6=−2.\begin{gathered} A = \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix}, \\[0.4em] \det A = 4 - 6 = -2. \end{gathered}

Applied to AA one at a time, a swap, a scaling of the first row by 55, and the replacement R2→R2−3R1R_2 \to R_2 - 3R_1 give

∣3412∣=2=−det⁡A,∣51034∣=−10=5det⁡A,∣120−2∣=−2=det⁡A.\begin{aligned} \begin{vmatrix} 3 & 4 \\ 1 & 2 \end{vmatrix} &= 2 = -\det A, \\[0.4em] \begin{vmatrix} 5 & 10 \\ 3 & 4 \end{vmatrix} &= -10 = 5 \det A, \\[0.4em] \begin{vmatrix} 1 & 2 \\ 0 & -2 \end{vmatrix} &= -2 = \det A. \end{aligned}

Watch the step R2→2R2−R1R_2 \to 2R_2 - R_1. It scales row 22 by 22 before subtracting row 11, so it doubles the determinant,

∣1256∣=6−10=−4=2det⁡A.\begin{aligned} \begin{vmatrix} 1 & 2 \\ 5 & 6 \end{vmatrix} &= 6 - 10 \\[0.4em] &= -4 = 2 \det A. \end{aligned}

Determinant of a triangular matrix

Definition A square matrix is upper triangular if every entry below the main diagonal is 00, and lower triangular if every entry above it is 00. The determinant of an n×nn \times n triangular matrix A=[aij]A = [a_{ij}], upper or lower, is the product of its diagonal entries,

det⁡A=a11a22⋯ann.\det A = a_{11} a_{22} \cdots a_{nn}.

In particular it is 00 exactly when some diagonal entry is 00. A diagonal matrix is both upper and lower triangular.

In plain words For a triangular matrix only the diagonal counts. Expand an upper triangular matrix along its first column, whose only possibly nonzero entry is a11a_{11}, and repeat with the smaller triangular matrix that remains. Elimination brings any square matrix to upper triangular form, so with a ledger this rule computes any determinant. It applies only to triangular matrices.

Example Two row replacements bring

M=[120251013]M = \begin{bmatrix} 1 & 2 & 0 \\ 2 & 5 & 1 \\ 0 & 1 & 3 \end{bmatrix}

to triangular form, first R2→R2−2R1R_2 \to R_2 - 2R_1 and then R3→R3−R2R_3 \to R_3 - R_2, and neither changes the determinant.

det⁡M=∣120011013∣=∣120011002∣=1⋅1⋅2=2.\begin{aligned} \det M &= \begin{vmatrix} 1 & 2 & 0 \\ 0 & 1 & 1 \\ 0 & 1 & 3 \end{vmatrix} \\[0.4em] &= \begin{vmatrix} 1 & 2 & 0 \\ 0 & 1 & 1 \\ 0 & 0 & 2 \end{vmatrix} \\[0.4em] &= 1 \cdot 1 \cdot 2 = 2. \end{aligned}

The diagonal of MM itself has product 1⋅5⋅3=151 \cdot 5 \cdot 3 = 15, which is not det⁡M\det M. The diagonal rule needs a triangular matrix, and MM is not one.

Cofactor

Definition Let AA be an n×nn \times n matrix with n≥2n \ge 2. Deleting row ii and column jj of AA leaves an (n−1)×(n−1)(n - 1) \times (n - 1) submatrix AijA_{ij}. Its determinant Mij=det⁡AijM_{ij} = \det A_{ij} is the (i,j)(i, j) minor of AA, and the (i,j)(i, j) cofactor of AA is

Cij=(−1)i+jMij.C_{ij} = (-1)^{i + j} M_{ij}.

Some books call the submatrix AijA_{ij} itself the minor matrix. The sign (−1)i+j(-1)^{i + j} is ++ when i+ji + j is even and −- when i+ji + j is odd, which gives a checkerboard pattern that starts with ++ in the top left corner,

[+−+−+−+−+].\begin{bmatrix} {+} & {-} & {+} \\ {-} & {+} & {-} \\ {+} & {-} & {+} \end{bmatrix}.

In plain words A minor is the smaller determinant left after crossing out one row and one column. The cofactor is that minor with the sign of its position on the checkerboard.

Example For the matrix MM above, crossing out row 11 and then column 11, 22 or 33 gives

C11=+∣5113∣=14,C12=−∣2103∣=−6,C13=+∣2501∣=2.\begin{aligned} C_{11} &= +\begin{vmatrix} 5 & 1 \\ 1 & 3 \end{vmatrix} = 14, \\[0.4em] C_{12} &= -\begin{vmatrix} 2 & 1 \\ 0 & 3 \end{vmatrix} = -6, \\[0.4em] C_{13} &= +\begin{vmatrix} 2 & 5 \\ 0 & 1 \end{vmatrix} = 2. \end{aligned}

The (1,2)(1, 2) minor of MM is 66, not the entry 22 in that position, and the minus sign of position (1,2)(1, 2) makes the cofactor −6-6.

Cofactor expansion

Definition The determinant of a 1×11 \times 1 matrix [a][a] is aa. For n≥2n \ge 2 the determinant of an n×nn \times n matrix AA is its cofactor expansion along the first row,

det⁡A=∑k=1na1kC1k=a11C11+⋯+a1nC1n,\begin{aligned} \det A &= \sum_{k=1}^{n} a_{1k} C_{1k} \\[0.4em] &= a_{11}C_{11} + \cdots + a_{1n}C_{1n}, \end{aligned}

where each cofactor is, up to sign, a determinant of size n−1n - 1. Expansion along any row ii or any column jj gives the same number,

det⁡A=∑k=1naikCik=∑k=1nakjCkj.\begin{aligned} \det A &= \sum_{k=1}^{n} a_{ik} C_{ik} \\[0.4em] &= \sum_{k=1}^{n} a_{kj} C_{kj}. \end{aligned}

For n=2n = 2 this is ad−bcad - bc, and for n=2n = 2 and n=3n = 3 it equals the oriented area or volume of the columns. It follows that det⁡A⊤=det⁡A\det A^{\top} = \det A, so every rule for rows also holds for columns. Expanding all the way down writes det⁡A\det A as a sum of n!n! signed products, each taking exactly one entry from every row and every column.

In plain words Pick a row or a column, multiply each entry by its cofactor and add. A row or column with many zeros saves work, because a zero entry removes its whole term. On a large matrix without zeros the number of terms grows very fast, and elimination is the better hand method.

Example Expanding MM along its first row with the cofactors found above gives

det⁡M=1⋅14+2⋅(−6)+0⋅2=2,\begin{aligned} \det M &= 1 \cdot 14 + 2 \cdot (-6) + 0 \cdot 2 \\[0.4em] &= 2, \end{aligned}

which agrees with the elimination ledger. Two independent methods giving the same value is a good check on signs.

Linearity in one column

Definition Fix every column of an n×nn \times n matrix except column jj, and let D(x)D(\mathbf{x}) be the determinant of the matrix whose column jj is x\mathbf{x}. Then for all vectors u,v\mathbf{u}, \mathbf{v} in Rn\mathbb{R}^n and every scalar cc,

D(u+v)=D(u)+D(v),D(cu)=c D(u).\begin{gathered} D(\mathbf{u} + \mathbf{v}) = D(\mathbf{u}) + D(\mathbf{v}), \\[0.4em] D(c\mathbf{u}) = c\,D(\mathbf{u}). \end{gathered}

This follows from expansion along column jj, whose cofactors do not involve column jj. The same holds for each row. Together with the swap rule, linearity has two consequences. A matrix with two equal columns has determinant 00, since swapping them changes the sign but not the matrix. A matrix whose columns are linearly dependent has determinant 00, since expanding by linearity in a column that is a combination of the others gives only determinants with a repeated column. The row version explains the replacement rule. Adding cc times row kk to a different row ii splits the determinant into det⁡A\det A plus cc times a determinant with two equal rows, which is 00. The rule concerns one column at a time. For n≥2n \ge 2 the determinant det⁡(A+B)\det(A + B) need not equal det⁡A+det⁡B\det A + \det B, and det⁡(cA)=cndet⁡A\det(cA) = c^n \det A for every n×nn \times n matrix AA.

In plain words With every other column held still, the determinant behaves like a linear function of the one column you vary. For n≥2n \ge 2 it is not linear in the whole matrix, because changing every column at once creates extra mixed terms.

Example Here a tuple such as (1,0)(1, 0) stands for a column vector. With the first column (1,0)(1, 0) held fixed and (3,4)=(2,3)+(1,1)(3, 4) = (2, 3) + (1, 1) in the second column,

∣1304∣=∣1203∣+∣1101∣=3+1=4.\begin{aligned} \begin{vmatrix} 1 & 3 \\ 0 & 4 \end{vmatrix} &= \begin{vmatrix} 1 & 2 \\ 0 & 3 \end{vmatrix} + \begin{vmatrix} 1 & 1 \\ 0 & 1 \end{vmatrix} \\[0.4em] &= 3 + 1 = 4. \end{aligned}

By contrast, the 2×22 \times 2 identity has det⁡I=1\det I = 1, but det⁡(I+I)=det⁡(2I)=4\det(I + I) = \det(2I) = 4, not 1+1=21 + 1 = 2. Both columns were doubled, so the determinant was multiplied by 222^2.

Multiplicativity of the determinant

Definition For n×nn \times n matrices AA and BB,

det⁡(AB)=det⁡A det⁡B.\det(AB) = \det A \, \det B.

To prove it, recall that multiplying BB on the left by an elementary matrix EE performs the matching row operation on BB, so det⁡(EB)=det⁡E det⁡B\det(EB) = \det E \, \det B, where det⁡E\det E is −1-1 for a swap, kk for scaling a row by k≠0k \ne 0, and 11 for a replacement. If AA is invertible, it is a product of elementary matrices A=E1E2⋯EmA = E_1 E_2 \cdots E_m. Applying the rule mm times gives det⁡(AB)=det⁡E1⋯det⁡Emdet⁡B\det(AB) = \det E_1 \cdots \det E_m \det B, and the case B=IB = I shows that det⁡E1⋯det⁡Em=det⁡A\det E_1 \cdots \det E_m = \det A. If AA is singular, its columns are dependent, so det⁡A=0\det A = 0. The columns of ABAB lie in Col⁡A\operatorname{Col} A, whose dimension is less than nn, so they are dependent too and det⁡(AB)=0\det(AB) = 0.

In plain words Applying BB and then AA scales oriented area or volume first by det⁡B\det B and then by det⁡A\det A, so the factors multiply. Their product does not depend on the order, so det⁡(AB)=det⁡(BA)\det(AB) = \det(BA) even when ABAB and BABA are different matrices.

Example Take

A=[2103],B=[1221],\begin{gathered} A = \begin{bmatrix} 2 & 1 \\ 0 & 3 \end{bmatrix}, \\[0.4em] B = \begin{bmatrix} 1 & 2 \\ 2 & 1 \end{bmatrix}, \end{gathered}

with det⁡A=6\det A = 6 and det⁡B=−3\det B = -3. The two products are different matrices,

AB=[4563],BA=[2745],\begin{gathered} AB = \begin{bmatrix} 4 & 5 \\ 6 & 3 \end{bmatrix}, \\[0.4em] BA = \begin{bmatrix} 2 & 7 \\ 4 & 5 \end{bmatrix}, \end{gathered}

yet det⁡(AB)=12−30=−18\det(AB) = 12 - 30 = -18 and det⁡(BA)=10−28=−18\det(BA) = 10 - 28 = -18, both equal to 6⋅(−3)6 \cdot (-3).

Check yourself

  1. A 3×33 \times 3 matrix AA has det⁡A=4\det A = 4. Swap rows 11 and 33, then multiply row 22 by −2-2, then add 55 times row 11 to row 33. What is the determinant of the result?
Show the answer

The ledger has factor −1-1 for the swap, −2-2 for the scaling and 11 for the replacement. The determinant of the result is (−1)(−2)(1)⋅4=8(-1)(-2)(1) \cdot 4 = 8.

  1. Let AA and BB be 3×33 \times 3 matrices with det⁡A=2\det A = 2 and det⁡B=−3\det B = -3. Find det⁡(AB)\det(AB) and det⁡(2A)\det(2A). Must det⁡(A+B)\det(A + B) equal −1-1?
Show the answer

By multiplicativity, det⁡(AB)=2⋅(−3)=−6\det(AB) = 2 \cdot (-3) = -6. The matrix 2A2A has all three columns doubled, so det⁡(2A)=23⋅2=16\det(2A) = 2^3 \cdot 2 = 16, not 44. The sum need not have determinant −1-1. For A=diag⁡(2,1,1)A = \operatorname{diag}(2, 1, 1) and B=diag⁡(−3,1,1)B = \operatorname{diag}(-3, 1, 1) the sum is diag⁡(−1,2,2)\operatorname{diag}(-1, 2, 2), whose determinant is −4-4.

  1. Find the determinant of
K=[012311101]K = \begin{bmatrix} 0 & 1 & 2 \\ 3 & 1 & 1 \\ 1 & 0 & 1 \end{bmatrix}

by elimination with a ledger, then check it by cofactor expansion along the first row.

Show the answer

The top left entry is 00, so start with the swap R1↔R3R_1 \leftrightarrow R_3, which contributes the factor −1-1. The replacements R2→R2−3R1R_2 \to R_2 - 3R_1 and then R3→R3−R2R_3 \to R_3 - R_2 leave the determinant unchanged.

det⁡K=−∣101311012∣=−∣10101−2012∣=−∣10101−2004∣=−(1⋅1⋅4)=−4.\begin{aligned} \det K &= -\begin{vmatrix} 1 & 0 & 1 \\ 3 & 1 & 1 \\ 0 & 1 & 2 \end{vmatrix} \\[0.4em] &= -\begin{vmatrix} 1 & 0 & 1 \\ 0 & 1 & -2 \\ 0 & 1 & 2 \end{vmatrix} \\[0.4em] &= -\begin{vmatrix} 1 & 0 & 1 \\ 0 & 1 & -2 \\ 0 & 0 & 4 \end{vmatrix} \\[0.4em] &= -(1 \cdot 1 \cdot 4) = -4. \end{aligned}

For the check, the first entry of row 11 is 00, so its term drops out, and

det⁡K=−1∣3111∣+2∣3110∣=−1⋅2+2⋅(−1)=−4.\begin{aligned} \det K &= -1\begin{vmatrix} 3 & 1 \\ 1 & 1 \end{vmatrix} + 2\begin{vmatrix} 3 & 1 \\ 1 & 0 \end{vmatrix} \\[0.4em] &= -1 \cdot 2 + 2 \cdot (-1) = -4. \end{aligned}

Both methods give det⁡K=−4\det K = -4.

How this lesson connects

Where this leads in Linear Algebra II