Gaussian elimination
Reduce a system Ax = b to upper triangular form with row operations on the augmented matrix, read off the pivots, and finish by back substitution, including what happens when a pivot is zero.
It opens on
To solve x + y + z = 6, 2x + 3y + z = 11, x + 2y + 3z = 14 you could guess; what move on the equations always keeps the solution and makes the system easier?
Why it matters
Every solver for Ax = b, from a spreadsheet to numpy, runs this procedure; the pivots say how many solutions there are and the multipliers are what LU factorization will record.
Good to know first
- Row and column pictures: a system as lines or planes meeting in the solution, zero, one or infinitely many solutions
- Matrix-vector multiplication: each row of A times x gives one equation
Step by step
One row operation
Use the row operation "subtract a multiple of row 1 from row 2" to clear an entry, and finish by back substitution.
The system x − 2y = 1, 3x + 2y = 11 is the rows (1, −2 | 1) and (3, 2 | 11); the pivot is the leading entry 1 of row 1, and the multiplier is 3 / 1 = 3.
A common mix-up
A row operation changes the answer, since the equations change.
In fact: Each operation is reversible, so the solutions stay the same.
A 3 × 3 table
Reduce a 3 × 3 augmented matrix to upper triangular form in two stages, name the pivots and multipliers, and back-substitute.
Clear below the first pivot: row 2 − 2 · row 1 = (0, 1, −1 | −1), and row 3 − 1 · row 1 = (0, 1, 2 | 8); the multipliers are 2 and 1.
A common mix-up
The multiplier is always the pivot itself.
In fact: The multiplier is the entry to clear divided by the pivot (here 2 / 1 and 1 / 1).
When a pivot fails
Handle a zero in the pivot position by a row exchange and recognise the no-solution and many-solutions endings by the pivot count.
Swap the two rows: (1, 1 | 3) and (0, 1 | 2) is already upper triangular, so y = 2 and x = 1.
A common mix-up
A zero in a pivot position means there is no solution.
In fact: Often a row swap fixes it; no solution comes only from a row like (0, 0 | nonzero).
Try it
Solve x + y = 5, 3x + 2y = 12 by subtracting 3 times row 1 from row 2.Answer
y = 3 and x = 2
Hint: Row 2 becomes (0, −1 | −3)
Reduce (1, 2 | 5), (3, 5 | 13) and solve.Answer
y = 2 and x = 1
Hint: Row 2 − 3 · row 1 = (0, −1 | −2)
Reduce (1, 3 | 4), (2, 6 | 9). What does the last row say?Answer
(0, 0 | 1): 0 = 1, no solution
Hint: Row 2 − 2 · row 1
Solve the last row for y, then use row 1 for x.Answer
y = 1, then x − 2 = 1 so x = 3.
Which equation gives one unknown directly, and what is it?Answer
The last row, 3z = 9, so z = 3.
