| The three row operations | |
|---|---|
| Exactly one solution when |
Lesson
The theory — Gaussian Elimination253 words
Elimination turns a system into an equivalent triangular one, which can then be read off from the bottom up. Its importance is not that it works — several methods work — but what it costs, because that is what decides which method a machine actually runs.
What each symbol means
n- the number of unknowns, and the only thing the cost depends on.
pivot- the coefficient a row is divided by. The order the algorithm fixes is what makes the procedure decision-free; which number lands there is what makes it survivable in floating point.
- Assumes
- A dense system with no exploitable structure. Sparse, banded or symmetric systems are cheaper, and choosing the right specialised method is most of numerical linear algebra.
- Breaks when
- The cost is cubic, and cubic is a wall. Elimination on n unknowns takes about
n³/3multiplications and as many additions — counted directly on a real elimination, 333,300 multiplications atn = 100against the estimate’s 333,333. What that exponent costs you is a fixed penalty for growth: doubling the unknowns multiplies the work by exactly 8, so 100 unknowns take 333,300 multiplications and 200 take 2,666,600. A machine that clears a thousand unknowns in a second therefore needs eight seconds for two thousand and about two and a quarter hours for twenty thousand. That is the shape of the wall, and it is why the interesting question in numerical linear algebra is almost never how to solve a dense system but how to avoid having one.
Problems solved in full
-
Solving 2x + y − z = 8 and the cost in accuracy 7 steps
Solve 2x + y − z = 8, −3x − y + 2z = −11, −2x + y + 2z = −3 — and then work out what the elimination cost you in accuracy.
-
Write it as an augmented matrix. The letters are doing no work, so drop them and keep the columns.
-
Pivot on the largest first-column entry, which is −3 in row two, and swap it up. Every row swap flips the sign of the determinant, so keep count.
-
Clear the rest of the first column by subtracting multiples of the pivot row.
-
Repeat on the second column, then read the bottom row: it holds one unknown and its value.
-
Back-substitute upwards. The last row gives z, the middle row then gives y, and the top gives x.
-
Multiply the pivots and apply the sign for two swaps to get the determinant, and check the answer by substituting into the original equations rather than the reduced ones.
-
The residual comes out at about 10⁻¹⁶, which is not zero. It is the size of the rounding a computer cannot avoid, and it is the honest thing to report — an answer that claims to be exact is either from integer arithmetic or is not looking. Change the leading coefficient to 10⁻¹⁷ with pivoting off and the same residual becomes 1, which is the same warning shouting.
Answer
x = 2, y = 3, z = −1, determinant −1. The residual of about 10⁻¹⁶ is the arithmetic being as exact as floating point allows. Turn pivoting off on a badly scaled system and that number is the one that tells you the answer is wrong.
-
-
A determinant of 0, twice, meaning two different things 7 steps
The Contradictory preset has no solution and One equation three times has infinitely many, and both print a determinant of 0. Work out what actually separates them, and decide what changing the right-hand side could ever buy you.
Show solution
-
Partial pivoting looks down the first column for the largest coefficient. It finds 3 in the bottom row, so the first move is a swap.
-
Clear the column: subtract ⅔ of the new first row from the second, and ⅓ of it from the third.
-
In the second column 4/3 already sits above 2/3, so nothing needs swapping. Subtract half of row 2 from row 3.
-
Row 3 is now empty on the left with −½ on the right, which reads 0 = −½. Only two pivots were laid down, 3 and 4/3, where three unknowns need three, and a missing pivot makes the product zero.
-
Rank is what the determinant is hiding. The coefficient matrix has two independent rows. The augmented matrix has three, because that leftover −½ is a row nothing can cancel. Rank 2 against rank 3 is what "no solution" means.
-
The One equation three times preset does the same arithmetic and says something else. Every row is a multiple of the first, so both ranks are 1 and the determinant is 0 again. The solution set has 3 − 1 = 2 free directions: the whole plane x + y + z = 3. The tool says "infinitely many" without saying in how many directions.
-
Change one number and see which quantity moves. Put 6 where the 7 is on the right of row 2. The coefficient matrix is untouched, so the determinant does not stir, but the augmented rank drops to 2 and the answer becomes a line of solutions instead of none.
Answer
The determinant only reports whether the coefficient matrix has a full set of pivots. It never looks at the right-hand side, which is why it cannot separate the two presets, and the two ranks can: no solution when they disagree, and a solution set of dimension 3 − rank when they agree. Once the determinant is 0, no right-hand side will buy you a single answer — you get none or a whole family, and the choice between those two is all that b decides. The residual card goes dark for the same reason it exists: a residual needs a solution to put back into the equations.
-
-
Three equations by hand 5 steps
Solve x + y + z = 6, 2x − y + z = 3, x + 2y − z = 2.
Show solution
-
Clear x from the second row: take away twice the first row.
-
Clear x from the third row: take away the first row.
-
Clear y from the third row with a third of the new second row. Only z is left.
-
Back-substitute: z into the second row gives y, then y and z into the first give x.
-
Check in the two equations not used last.
Answer
x = 1, y = 2, z = 3. The determinant is 7, so this is the only solution.
-
-
Infinitely many, written with a parameter 4 steps
Solve x + y + z = 3, x − y + z = 1, 2x + 2z = 4.
Show solution
-
Take the first row from the second: y = 1.
-
Take twice the first row from the third: the same equation again, so the third row adds nothing.
-
Two independent rows for three unknowns, and no contradiction: one unknown is free.
-
Let z = t, any number. The first row then gives x.
Answer
(x, y, z) = (2 − t, 1, t) for every t. t = 0 gives (2, 1, 0) and t = 2 gives (0, 1, 2); both check in all three equations.
-
Supplementary problems, answers only
-
Solve x + y + z = 2, y + z = 1, z = −1.
Show answer
z = −1, y = 2, x = 1. The system is already triangular, so back-substitution is all it needs.
-
Solve x + 2y + z = 4, 2x + y − z = −1, x − y + 2z = 7.
Show answer
x = 1, y = 0, z = 3.
-
Show that x + y + z = 1, x + 2y + 3z = 2, 2x + 3y + 4z = 5 has no solution.
Show answer
R₃ − R₁ − R₂ turns the left side into 0 and the right side into 2, and 0 = 2 is impossible.
Learning path
Solving for x, from the minus sign upward
References (1)
- Two centuries of the method being reinvented and misattributed, including how Gauss's name came to be on it: J. F. Grcar, "How ordinary elimination became Gaussian elimination." Historia Mathematica 38:2 (2011), 163–218.