MAT1041 · Week 4 · - The Determinant of a Matrix

Determinant: cofactor expansion and computing with row operations

You learn the minor and cofactor, cofactor expansion along any row or column, the triangular matrix rule, and how row operations change the determinant, so you can compute 3×3 and 4×4 determinants without a calculator.

determinantminorcofactorcofactor expansionsign patterntriangular matrixSarrus' ruleelementary row operationrow reductionsingular matrix

The determinant assigns a single number to a square matrix, and that number says a lot about the matrix: if it is zero the matrix is singular, the system does not have a unique solution, the columns are dependent. This week we learn to compute the number; next week its properties and uses (Cramer, adjoint). The problem book’s favorite method is reducing to triangular form with row operations, so the emphasis is there.

Golden rules:

  1. When expanding by cofactors, choose the row or column with the most zeros.
  2. Draw the sign table in the corner of the page: ++ at the top left, then a checkerboard.
  3. In row operations, prefer Ri←Ri+cRjR_i \leftarrow R_i + cR_j. It does not change the determinant.
  4. If you swapped rows, track (−1)(-1); if you multiplied a row by cc, track the factor cc.

2×2 and 3×3 determinants

det⁡[abcd]=∣abcd∣=ad−bc.\det\begin{bmatrix} a & b \\ c & d \end{bmatrix} = \begin{vmatrix} a & b \\ c & d \end{vmatrix} = ad - bc.

det⁡A\det A and ∣A∣|A| are two ways of writing the same thing. (∣A∣|A| here is not an absolute value; a determinant can be negative.)

Minor and cofactor

For an n×nn \times n matrix AA:

  • The minor MijM_{ij}: the determinant of the (n−1)×(n−1)(n-1) \times (n-1) matrix that remains when row ii and column jj are deleted from AA.
  • The cofactor Cij=(−1)i+jMijC_{ij} = (-1)^{i+j}M_{ij}.

The sign (−1)i+j(-1)^{i+j} gives a checkerboard pattern:

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

Cofactor expansion

The determinant can be expanded along any row or column and always gives the same result:

det⁡A=ai1Ci1+ai2Ci2+⋯+ainCin(row i),det⁡A=a1jC1j+⋯+anjCnj(column j).\det A = a_{i1}C_{i1} + a_{i2}C_{i2} + \dots + a_{in}C_{in} \quad (\text{row } i), \qquad \det A = a_{1j}C_{1j} + \dots + a_{nj}C_{nj} \quad (\text{column } j).

Since the term of a zero entry is zero anyway, choosing the row with the most zeros shortens the work.

Example 1. A=[2−13104−251]A = \begin{bmatrix} 2 & -1 & 3 \\ 1 & 0 & 4 \\ -2 & 5 & 1 \end{bmatrix}. There is a zero in column 2, so let us expand there. The signs for column 2 are −,+,−-, +, -.

C12 = (-1)^(1+2) · det[1 4; -2 1] = -(1 + 8)  = -9
C22 = its factor a22 = 0, no need to compute
C32 = (-1)^(3+2) · det[2 3; 1 4]  = -(8 - 3)  = -5
det A = (-1)(-9) + 0 + (5)(-5) = 9 - 25 = -16

Sarrus’ rule (only 3×3). Rewrite the first two columns to the right. Add the products of the three downward diagonals and subtract the products of the three upward ones. For the same matrix: down 0+8+15=230 + 8 + 15 = 23, up 0+40−1=390 + 40 - 1 = 39, det⁡=23−39=−16\det = 23 - 39 = -16. Sarrus’ rule does not work for 4×44 \times 4.

Example 2 (4×4, use the zeros).

det⁡[1020310200402013]=4⋅(+1)⋅det⁡[100312203]=4⋅1⋅(3−0)=12.\det\begin{bmatrix} 1 & 0 & 2 & 0 \\ 3 & 1 & 0 & 2 \\ 0 & 0 & 4 & 0 \\ 2 & 0 & 1 & 3 \end{bmatrix} = 4 \cdot (+1) \cdot \det\begin{bmatrix} 1 & 0 & 0 \\ 3 & 1 & 2 \\ 2 & 0 & 3 \end{bmatrix} = 4 \cdot 1 \cdot (3 - 0) = 12.

Row 3 has only one entry (a33=4a_{33} = 4, sign ++). We expanded the remaining 3×33 \times 3 along row 1: only 1⋅(1⋅3−2⋅0)=31 \cdot (1 \cdot 3 - 2 \cdot 0) = 3.

Triangular matrices

The determinant of an upper triangular, lower triangular or diagonal matrix is the product of the diagonal entries:

det⁡[25−10−34006]=2⋅(−3)⋅6=−36.\det\begin{bmatrix} 2 & 5 & -1 \\ 0 & -3 & 4 \\ 0 & 0 & 6 \end{bmatrix} = 2 \cdot (-3) \cdot 6 = -36.

Why? If you expand along the first column, only a11a_{11} remains, and the remaining matrix is triangular too; repeat. This rule is the basis of the next method.

Determinant with row operations

Cofactor expansion needs about n!n! multiplications for n×nn \times n; it is laborious for 4×44 \times 4 and a nightmare for 5×55 \times 5. A better way: make the matrix triangular with row operations, multiply the diagonal, and account for the effect of the operations you did.

OperationEffect on the determinantHow to remember
Ri↔RjR_i \leftrightarrow R_j×(−1)\times(-1)every swap flips the sign
Ri←cRiR_i \leftarrow cR_i×c\times ca common factor comes out of a row
Ri←Ri+cRjR_i \leftarrow R_i + cR_junchangedthe safest operation

In practice it is more natural to think of taking out a common factor from a row: ∣2413∣=2∣1213∣\begin{vmatrix} 2 & 4 \\ 1 & 3 \end{vmatrix} = 2\begin{vmatrix} 1 & 2 \\ 1 & 3 \end{vmatrix}.

Example 3. det⁡A\det A, A=[24−261304012136110]A = \begin{bmatrix} 2 & 4 & -2 & 6 \\ 1 & 3 & 0 & 4 \\ 0 & 1 & 2 & 1 \\ 3 & 6 & 1 & 10 \end{bmatrix}.

Take 2 out of row 1: det⁡A=2det⁡A′\det A = 2 \det A', where row 1 of A′A' is (1,2,−1,3)(1, 2, -1, 3). Then only addition operations:

[12−131304012136110]→R4←R4−3R1R2←R2−R1[12−13011101210041]→R3←R3−R2[12−13011100100041]→R4←R4−4R3[12−13011100100001]\begin{bmatrix} 1 & 2 & -1 & 3 \\ 1 & 3 & 0 & 4 \\ 0 & 1 & 2 & 1 \\ 3 & 6 & 1 & 10 \end{bmatrix} \xrightarrow[R_4 \leftarrow R_4 - 3R_1]{R_2 \leftarrow R_2 - R_1} \begin{bmatrix} 1 & 2 & -1 & 3 \\ 0 & 1 & 1 & 1 \\ 0 & 1 & 2 & 1 \\ 0 & 0 & 4 & 1 \end{bmatrix} \xrightarrow{R_3 \leftarrow R_3 - R_2} \begin{bmatrix} 1 & 2 & -1 & 3 \\ 0 & 1 & 1 & 1 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 4 & 1 \end{bmatrix} \xrightarrow{R_4 \leftarrow R_4 - 4R_3} \begin{bmatrix} 1 & 2 & -1 & 3 \\ 0 & 1 & 1 & 1 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix}

The product of the diagonal is 1. With the 2 we took out at the start: det⁡A=2⋅1=2\det A = 2 \cdot 1 = 2.

PITFALL · “I reduced it to I, so det = 1”. Reducing AA to II does not make det⁡A=1\det A = 1. Along the way, every swap leaves a (−1)(-1) and every scaling 1cRi\frac1c R_i leaves a factor cc. Collect them all, then decide.

PITFALL · mixed operations. Written in one step, R2←3R2−R1R_2 \leftarrow 3R_2 - R_1 looks innocent, but it hides R2←3R2R_2 \leftarrow 3R_2: the determinant is multiplied by 3. Harmless in systems, an error in determinants.

Column operations

Since det⁡AT=det⁡A\det A^T = \det A (next week), the three rules above apply to columns as well. If one column is a multiple of another, the determinant is 0; swapping two columns flips the sign.

Quick signs that the determinant is zero

Situations that let you say det⁡A=0\det A = 0 without computing:

What you seeWhy
A zero row or zero columnexpanding along it, every term is 0
Two equal rowsafter swapping the matrix is the same but det must change sign: d=−d⇒d=0d = -d \Rightarrow d = 0
One row is a multiple of anotheran addition produces a zero row
One row is a combination of the otherslikewise a zero row

Example: in [1−23405−24−6]\begin{bmatrix} 1 & -2 & 3 \\ 4 & 0 & 5 \\ -2 & 4 & -6 \end{bmatrix}, row 3 =−2×= -2 \times row 1, so the determinant is 0 (Q9).

Parametric determinants

Questions like “find the values of tt for which det⁡=0\det = 0” serve two purposes: finding singularity (week 5) and finding eigenvalues (week 13, the same calculation det⁡(A−λI)=0\det(A - \lambda I) = 0). Method: catch a common factor with row operations and keep the factored form.

∣t111t111t∣→R1←R1+R2+R3∣t+2t+2t+21t111t∣=(t+2)∣1111t111t∣\begin{vmatrix} t & 1 & 1 \\ 1 & t & 1 \\ 1 & 1 & t \end{vmatrix} \xrightarrow{R_1 \leftarrow R_1 + R_2 + R_3} \begin{vmatrix} t+2 & t+2 & t+2 \\ 1 & t & 1 \\ 1 & 1 & t \end{vmatrix} = (t+2)\begin{vmatrix} 1 & 1 & 1 \\ 1 & t & 1 \\ 1 & 1 & t \end{vmatrix}

Then R2←R2−R1R_2 \leftarrow R_2 - R_1, R3←R3−R1R_3 \leftarrow R_3 - R_1: the diagonal is 1,t−1,t−11, t - 1, t - 1. The result is (t+2)(t−1)2(t + 2)(t - 1)^2. Much shorter than expanding everything and solving a cubic polynomial.

Common mistakes

WrongRight
Taking the sign of C12C_{12} and C21C_{21} as ++(−1)1+2=−1(-1)^{1+2} = -1
Forgetting to multiply by aija_{ij} in the cofactor expansionThe term is aijCija_{ij}C_{ij}
Using Sarrus’ rule for 4×44 \times 4Only for 3×33 \times 3
Not flipping the sign when swapping rowsEvery swap is ×(−1)\times(-1)
Forgetting cc after Ri←cRiR_i \leftarrow cR_idet⁡(new)=c⋅det⁡(old)\det(\text{new}) = c \cdot \det(\text{old})
Reducing to II and saying “det = 1”Track the factors of the operations
Doing (−2)⋅(−3)(-2) \cdot (-3) in your head and losing a signWrite it with parentheses on paper
Thinking $A

Test yourself

Exam-style questions. Solve them on paper first, then reveal the answer.

Question 1easy

Compute det⁡[3−245]\det\begin{bmatrix} 3 & -2 \\ 4 & 5 \end{bmatrix}.

Show answer
23

ad−bc=3⋅5−(−2)⋅4=15+8=23ad - bc = 3 \cdot 5 - (-2) \cdot 4 = 15 + 8 = 23.
Minus times minus: −(−8)=+8-(-8) = +8. Write it with parentheses.

Question 2easy

Let A=[1423−10526]A = \begin{bmatrix} 1 & 4 & 2 \\ 3 & -1 & 0 \\ 5 & 2 & 6 \end{bmatrix}. Find the minor M23M_{23} and the cofactor C23C_{23}.

Show answer
M23=−18, C23=18M_{23} = -18,\ C_{23} = 18

M23M_{23}: delete row 2 and column 3, what remains is [1452]\begin{bmatrix} 1 & 4 \\ 5 & 2 \end{bmatrix}. det⁡=2−20=−18\det = 2 - 20 = -18.C23=(−1)2+3M23=−(−18)=18C_{23} = (-1)^{2+3}M_{23} = -(-18) = 18.

Question 3medium

Use cofactor expansion along the best row or column to compute det⁡[201340105]\det\begin{bmatrix} 2 & 0 & 1 \\ 3 & 4 & 0 \\ 1 & 0 & 5 \end{bmatrix}.

Show answer
36

Column 2 has only one nonzero entry: a22=4a_{22} = 4, with sign (−1)2+2=+(-1)^{2+2} = +.det⁡=4⋅det⁡[2115]=4(10−1)=36\det = 4 \cdot \det\begin{bmatrix} 2 & 1 \\ 1 & 5 \end{bmatrix} = 4(10 - 1) = 36.

Question 4medium

Use row operations to compute det⁡[132273−114]\det\begin{bmatrix} 1 & 3 & 2 \\ 2 & 7 & 3 \\ -1 & 1 & 4 \end{bmatrix}.

Show answer
10

Use only the addition operation (Ri←Ri+cRjR_i \leftarrow R_i + cR_j), the determinant does not change.R2←R2−2R1R_2 \leftarrow R_2 - 2R_1: (0,1,−1)(0, 1, -1). R3←R3+R1R_3 \leftarrow R_3 + R_1: (0,4,6)(0, 4, 6). R3←R3−4R2R_3 \leftarrow R_3 - 4R_2: (0,0,10)(0, 0, 10).
Upper triangular: det⁡=1⋅1⋅10=10\det = 1 \cdot 1 \cdot 10 = 10.

Question 5easy

Compute det⁡[25−170−34100160004]\det\begin{bmatrix} 2 & 5 & -1 & 7 \\ 0 & -3 & 4 & 1 \\ 0 & 0 & 1 & 6 \\ 0 & 0 & 0 & 4 \end{bmatrix}.

Show answer
-24

Upper triangular matrix: the determinant is the product of the diagonal. 2⋅(−3)⋅1⋅4=−242 \cdot (-3) \cdot 1 \cdot 4 = -24.
The numbers above the diagonal do not matter at all.

Question 6medium

Use row operations to compute det⁡[1210253113320124]\det\begin{bmatrix} 1 & 2 & 1 & 0 \\ 2 & 5 & 3 & 1 \\ 1 & 3 & 3 & 2 \\ 0 & 1 & 2 & 4 \end{bmatrix}.

Show answer
2

R2←R2−2R1R_2 \leftarrow R_2 - 2R_1: (0,1,1,1)(0, 1, 1, 1). R3←R3−R1R_3 \leftarrow R_3 - R_1: (0,1,2,2)(0, 1, 2, 2).R3←R3−R2R_3 \leftarrow R_3 - R_2: (0,0,1,1)(0, 0, 1, 1). R4←R4−R2R_4 \leftarrow R_4 - R_2: (0,0,1,3)(0, 0, 1, 3). R4←R4−R3R_4 \leftarrow R_4 - R_3: (0,0,0,2)(0, 0, 0, 2).
All are addition operations. Diagonal: 1⋅1⋅1⋅2=21 \cdot 1 \cdot 1 \cdot 2 = 2.

Question 7medium

AA is 3×33 \times 3 with det⁡A=5\det A = 5. BB is obtained from AA by R1↔R2R_1 \leftrightarrow R_2, then R3←4R3R_3 \leftarrow 4R_3, then R2←R2+7R1R_2 \leftarrow R_2 + 7R_1. Find det⁡B\det B.

Show answer
-20

Swap ×(−1)\times(-1), 4R34R_3 ×4\times 4, addition ×1\times 1.det⁡B=5⋅(−1)⋅4⋅1=−20\det B = 5 \cdot (-1) \cdot 4 \cdot 1 = -20.

Question 8hard

Find all values of tt for which det⁡[t111t111t]=0\det\begin{bmatrix} t & 1 & 1 \\ 1 & t & 1 \\ 1 & 1 & t \end{bmatrix} = 0.

Show answer
t=1t = 1 or t=−2t = -2

R1←R1+R2+R3R_1 \leftarrow R_1 + R_2 + R_3 (two additions, det unchanged): (t+2,t+2,t+2)(t + 2, t + 2, t + 2). Factor (t+2)(t + 2) out of the row: (1,1,1)(1, 1, 1).
Then R2←R2−R1R_2 \leftarrow R_2 - R_1: (0,t−1,0)(0, t - 1, 0), R3←R3−R1R_3 \leftarrow R_3 - R_1: (0,0,t−1)(0, 0, t - 1).det⁡=(t+2)⋅1⋅(t−1)(t−1)=(t−1)2(t+2)\det = (t + 2) \cdot 1 \cdot (t - 1)(t - 1) = (t - 1)^2(t + 2).
Check t=0t = 0: (1)(2)=2(1)(2) = 2; directly 0−1(0−1)+1(1−0)=20 - 1(0 - 1) + 1(1 - 0) = 2.

Question 9easy

Without expanding, find det⁡[1−23405−24−6]\det\begin{bmatrix} 1 & -2 & 3 \\ 4 & 0 & 5 \\ -2 & 4 & -6 \end{bmatrix}.

Show answer
0

Row 3 =−2×= -2 \times row 1. R3←R3+2R1R_3 \leftarrow R_3 + 2R_1 produces a zero row, the determinant does not change, and a matrix with a zero row has determinant 0.

Question 10medium

Suppose det⁡[abcdefghi]=3\det\begin{bmatrix} a & b & c \\ d & e & f \\ g & h & i \end{bmatrix} = 3. Find det⁡[defabc2g2h2i]\det\begin{bmatrix} d & e & f \\ a & b & c \\ 2g & 2h & 2i \end{bmatrix}.

Show answer
-6

The first two rows are swapped: ×(−1)\times(-1). Row 3 is multiplied by 2: ×2\times 2.3⋅(−1)⋅2=−63 \cdot (-1) \cdot 2 = -6.

Question 11hard

Compute det⁡[1112354925]\det\begin{bmatrix} 1 & 1 & 1 \\ 2 & 3 & 5 \\ 4 & 9 & 25 \end{bmatrix}.

Show answer
6

R2←R2−2R1R_2 \leftarrow R_2 - 2R_1: (0,1,3)(0, 1, 3). R3←R3−4R1R_3 \leftarrow R_3 - 4R_1: (0,5,21)(0, 5, 21). R3←R3−5R2R_3 \leftarrow R_3 - 5R_2: (0,0,6)(0, 0, 6).det⁡=1⋅1⋅6=6\det = 1 \cdot 1 \cdot 6 = 6.
This is a Vandermonde determinant: (3−2)(5−2)(5−3)=6(3 - 2)(5 - 2)(5 - 3) = 6.

Question 12medium

Solve det⁡[x−21−5x+4]=0\det\begin{bmatrix} x - 2 & 1 \\ -5 & x + 4 \end{bmatrix} = 0.

Show answer
x=1x = 1 or x=−3x = -3

(x−2)(x+4)−(1)(−5)=x2+2x−8+5=x2+2x−3=(x+3)(x−1)(x - 2)(x + 4) - (1)(-5) = x^2 + 2x - 8 + 5 = x^2 + 2x - 3 = (x + 3)(x - 1).
The roots are x=1x = 1, x=−3x = -3.

Verification: All determinants were computed in node by exact elimination with BigInt fractions; the minors and cofactors were checked separately, and the row-operation traces were applied step by step; the parametric determinant was compared with the factored formula at many values of t (verify/MAT1041/04.mjs).

Review card

2×2: det = ad - bc. M_ij = the det of what remains after deleting row i and column j. C_ij = (-1)^(i+j) M_ij. Sign table: + - + / - + - / + - + (a12, a21 are minus!) Cofactor expansion: along any row/column: det = Σ a_ij C_ij. Choose the one with the MOST ZEROS. Sarrus (ONLY 3×3): 3 down diagonals (+), 3 up diagonals (-). Triangular/diagonal matrix: det = product of the diagonal. Effect of row operations: Ri ↔ Rj → × (-1) Ri ← cRi → × c (c factors out of the row) Ri ← Ri + cRj → unchanged (safest) Ri ← 3Ri - Rj → × 3 (mixed operation, careful) Zero row/column, two equal or proportional rows → det = 0. The same rules hold for COLUMNS. Strategy: make it triangular using additions, multiply the diagonal, account for swaps and scalings.