Linear Algebra, Live
Strang §5.1 · Determinants by elimination

Computing the determinant from the pivots

Slide 4 showed that elimination steps never change det, and that a row swap only flips its sign. That gives the fast way to compute it. Think of a leaning stack of books: push it upright and it is the same pile, but now you can measure it with a ruler. Elimination pushes A upright into the triangular matrix U from lesson 2, with the same det. For a triangular matrix, det is just the numbers on the diagonal multiplied together, and those numbers are the pivots. So det A = ± (product of the pivots), with one minus sign for each row swap. This is how every computer finds a determinant.

Lesson 6 · slide 5Det from pivots
det A = ± (pivot₁ × pivot₂ × ... × pivotₙ)    det AB = det A · det B    det Aᵀ = det A
Key ideas
  1. Elimination steps (subtract a multiple of a row) keep det the same.
  2. Each row exchange flips the sign.
  3. For a triangular matrix, multiply down the diagonal.
  4. So det A = ± the product of the pivots. A zero pivot that no swap can fix means det A = 0.
  5. Two more facts: det AB = det A · det B, and det Aᵀ = det A.

A triangular matrix: multiply the diagonal

Start with a 2 by 2 triangular matrix, U = 2103. The formula gives ad − bc = 2·3 − 1·0 = 6, the two diagonal numbers multiplied. The picture says the same: the base lies along the x-axis with length 2, and the height is 3.

A triangular matrix. The square becomes a parallelogram with base 2 and height 3, so its area is 2 · 3 = 6, the product of the diagonal.

Why this works for any size: use rule 3 to pull each diagonal number out of its row. That leaves 1s on the diagonal. Elimination upward then clears the numbers above the diagonal (subtract multiples of lower rows from higher ones; slide 4 showed, using rule 3, that such steps keep det), and leaves I, with det I = 1. So det U is the product of the diagonal. (A 0 on the diagonal means a missing pivot. Elimination then makes a zero row, so det U = 0, still the product.)

Eliminate, then multiply

A 2 by 2 first. A = 2145:

row 2 − 2·row 1 → 2103   pivots 2 and 3
det A = 2 · 3 = 6    check: 2·5 − 1·4 = 10 − 4 = 6 ✓

Now a 3 by 3, the matrix from slide 4:

A = 120251013
Row 2 − 2·row 1: 011.   Then row 3 − 1·row 2: 002
U = 120011002,   pivots 1, 1, 2
det A = 1 · 1 · 2 = 2 ✓ (no row swaps)
Elimination does not change det. At the end the pivots sit on the diagonal, and their product 1 · 1 · 2 = 2 is det A.

K = 2114−60−272 from lesson 2 had pivots 2, −8 and 1. So det K = 2 · (−8) · 1 = −16.

A bigger example: one row swap

A = 021110243 has 0 in the first pivot spot, so we must swap rows (lesson 2, slide 4). Each swap costs one minus sign.

Swap rows 1 and 2: 110021243
Row 3 − 2·row 1: 023.   Then row 3 − 1·row 2: 002
Pivots 1, 2, 2 and one swap:   det A = −(1 · 2 · 2) = −4
One swap, then two elimination steps. The pivots are 1, 2 and 2, and the single swap adds a minus sign: det A = −4.

A computer does exactly this for a 1000 by 1000 matrix: eliminate, count the swaps, multiply 1000 pivots.

Products: det AB = det A · det B

Doing B and then A (AB acts on x as A(Bx): B first) stretches areas by det B, then by det A. So det AB = det A · det B.

B = 2001 (det 2),   A = 1102 (det 2)
AB = 2102,   det AB = 2·2 − 1·0 = 4 = 2 · 2 ✓
First B doubles the width: area 2. Then A doubles the area again: area 4 = det A · det B.

From A⁻¹A = I we get det A⁻¹ · det A = 1, so det A⁻¹ = 1 / det A. For the A above, A⁻¹ = 1−½0½ and det A⁻¹ = 1 · ½ = ½ ✓.

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 row exchange

A = 0231: the first pivot position holds 0.

Show solutionHide solution
Swap the rows: 3102, already triangular, pivots 3 and 2
One swap: det A = −(3 · 2) = −6
Check: 0·1 − 2·3 = −6 ✓
Exercise Compute det A as the product of the pivots on the diagonal of U. Edit the code and press Run.
slide_5.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