Linear Algebra, Live
Strang §5.2 · Permutations and cofactors

Cofactor expansion: a big determinant from smaller ones

Slide 5 found det A fast by elimination, but the answer came out of a process, not a formula. Cofactors give the formula. Think of a big job shared among helpers: each entry in row 1 hands its share of the work to a smaller determinant. To find that share, cross out the entry's row and its column. The smaller determinant that is left is the entry's minor. Give it a sign from the pattern + − +, and you have the entry's cofactor. Multiply each entry by its cofactor and add: that is det A. By hand this is great for 3 by 3, and hopeless for big matrices.

Lesson 6 · slide 6Cofactors
aᵢⱼ = entry in row i, column j    det A = a₁₁C₁₁ + a₁₂C₁₂ + a₁₃C₁₃    C₁ⱼ = (−1)^(1+j) · det(A without row 1 and column j)
Key ideas
  1. aᵢⱼ is the entry in row i, column j of A. The minor of entry aᵢⱼ is the determinant of A with row i and column j crossed out.
  2. The cofactor Cᵢⱼ is that minor times (−1)^(i+j): signs + − + in row 1, − + − in row 2, and so on, like a checkerboard.
  3. Expanding along any row (or column): det A = sum of entries × their cofactors. (This follows from rule 3; take it on trust.)
  4. Fully expanded, a 3 by 3 determinant is a sum of 3! = 3·2·1 = 6 products (n!, “n factorial”, means n·(n − 1)·…·1). Each uses one entry from every row and every column. An n by n has n! of them.

Where the number comes from

Elimination gives det A fast. The cofactor formula shows what det A is made of: a sum of products, each using one entry from every row and every column.

The 2 by 2 case

For abcd we can find the formula from the three rules of slide 4. Split each row into two pieces: ab = a0 + 0b and cd = c0 + 0d. Rule 3 splits det into four determinants, one for each choice of piece:

det abcd = det a0c0 + det a00d + det 0bc0 + det 0b0d
The first and last have a zero column, so their det is 0 (det Aᵀ = det A turns it into a zero row)
Pull the numbers out of the rows (rule 3):   ad · det 1001 + bc · det 0110
= ad · 1 + bc · (−1) = ad − bc   (rule 1, and rule 2: 0110 is I with its rows swapped)

The same splitting works for 3 by 3. Split each row into 3 pieces, one entry each. Any choice that takes two entries from the same column leaves a zero column, so it gives 0. What survives are the 6 choices with one entry in every row and every column. Each is a product of three entries times the det of I with its rows reordered, which is +1 or −1 by rule 2.

For example, the 2 by 2 formula on 3124:

3·4 − 1·2 = 12 − 2 = 10

Expanding a 3 by 3 along row 1

aᵢⱼ is the entry in row i, column j. Take each entry of row 1 and cross out its row and column. The 2 by 2 left over is its minor. Multiply entry × minor, with signs + − +:

det A = a₁₁(a₂₂a₃₃ − a₂₃a₃₂) − a₁₂(a₂₁a₃₃ − a₂₃a₃₁) + a₁₃(a₂₁a₃₂ − a₂₂a₃₁)

Each minor with its sign is a cofactor. Try it on the matrix K from lesson 2:

K = 2114−60−272
2·((−6)·2 − 0·7) − 1·(4·2 − 0·(−2)) + 1·(4·7 − (−6)·(−2))
= 2·(−12) − 1·8 + 1·16 = −24 − 8 + 16 = −16 ✓ (the same as the pivots 2 · (−8) · 1)
Each entry of row 1 in turn: cross out its row and column, find the small determinant that is left, and attach the sign + − +. The three pieces add up to det K = −16.

The checkerboard of signs

The signs form a checkerboard, with + in the top left. The sign for row i, column j is (−1)^(i+j):

+−+−+−+−+   row 2, column 1: (−1)^(2+1) = −1

You may expand along any row or any column, as long as you use these signs (this also follows from rule 3; take it on trust). Along row 2 of K, the signs are − + −:

−4·(1·2 − 1·7) + (−6)·(2·2 − 1·(−2)) − 0·(…)
= −4·(−5) − 6·6 − 0 = 20 − 36 = −16 ✓

Pick the easiest row

A zero entry kills its whole term, so pick the row or column with the most zeros. In K, row 2 has a 0, so only two minors were needed above.

Keep reading with the full course

Finish lesson 6 and you will be able to: see a matrix as a move of the plane, and build one from where two arrows land.

Still locked here:

  • The rest of this explanation
  • 4 more examples with step-by-step solutions
  • Five extra members-only problems with worked solutions

$20 once, lifetime access. Lessons 1 to 3 stay free.

Examples

Example 1 · A 2 by 2 as a cofactor expansion

3124: expand along row 1.

Show solutionHide solution
3 · (minor 4) − 1 · (minor 2) = 12 − 2 = 10
Exercise Fix the cofactor expansion in the lab so that it gives the right determinant. Edit the code and press Run.
slide_6.py Loading Python…
1
Output · Ctrl+Enter runs
Press Run to execute this slide's code. Ctrl+Enter works too.

Questions and comments

Stuck on something, or found a mistake? Ask here and I'll answer. You sign in with GitHub.

The full course

From Ax = b to PCA, by running it

Lessons 1 to 3 are free. Finish all eight and you will be able to:

You get: all 8 lessons with Python labs · every worked example and solution · 5 extra problems per lesson · your progress tracked · answers to your questions · every future update.

$20 once · lifetime access
Continue to checkout →

Already a member? Log in to the course