Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.Puzzles with hidden numbers
“Two numbers add up to 10, and one is 2 bigger than the other. What are they?” You can guess: 6 and 4. That’s a system of equations: several clues about the same hidden numbers.
At the shop. 3 apples and 2 bananas cost ₹35. 1 apple and 2 bananas cost ₹25. The first basket has 2 more apples and costs ₹10 more, so 2 apples cost ₹10, and one apple costs ₹5. Then 2 bananas cost ₹20, so one banana costs ₹10. You subtracted one clue from another to get rid of the bananas. That trick is the heart of Gaussian elimination.
Lines that cross
Each equation with two unknowns is a straight line on a graph. The answer is where the lines cross. Two lines usually cross at exactly one point. But parallel lines never cross (no answer), and the same line drawn twice “crosses” everywhere (endless answers).
- 1. Two numbers add to 10 and differ by 2. The larger is…
- 2. Two parallel roads never meet. How many crossing points?
- 3. In the shop puzzle, what does one apple cost?
Level 1: Beginner
★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.Writing a system as a matrix
Three allowed moves (row operations)
None of these changes the solutions:
- Swap two equations.
- Multiply an equation by a non-zero number.
- Add a multiple of one equation to another.
The method
Forward elimination: use these moves to make zeros below the diagonal, column by column. Back-substitution: then solve from the last equation upwards. Step through it:
| 1 | 1 | 1 | 6 |
| 0 | 2 | 5 | -4 |
| 2 | 5 | -1 | 27 |
For the example above, you’ll find .
Three possible outcomes
| Outcome | What elimination shows | Picture (2 unknowns) |
|---|---|---|
| One solution | a pivot in every column | lines cross once |
| No solution | a row reading with | parallel lines |
| Infinitely many | fewer pivots than unknowns, no contradiction | the same line |
- 1. Solve x + y = 5, x − y = 1. x = ?
- 2. Elimination produces the row [0 0 0 | 4]. The system has…
- 3. Which is NOT an allowed row operation?
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 40 minUndergraduate students and practising engineers.The rank test (Rouché–Capelli)
Compare the rank of with the rank of the augmented matrix :
- : no solution, because .
- equal ranks, : a unique solution.
- equal ranks, : infinitely many solutions, forming a -dimensional family (A2.1-6).
Partial pivoting: a must in practice
At each column, swap in the row with the largest absolute value in that column. Dividing by a tiny pivot multiplies rounding errors enormously. With pivot , the computed answer can be completely wrong, while the same system with pivoting is solved perfectly (Exercise 2). Every serious library pivots.
Cost
Forward elimination on an system costs about floating-point operations. Back-substitution costs only . Doubling makes elimination 8 times slower. A dense system takes under a second on a laptop. A million unknowns needs sparsity or iterative methods.
Where linear systems appear
| Field | System |
|---|---|
| Data science | least squares solves , a linear system (A2.4) |
| Robotics | inverse kinematics steps . Statics: cable tensions or joint torques that balance a load |
| Calibration | camera intrinsics and hand–eye calibration from many measurements |
| Simulation | each time step of an implicit integrator, or every finite-element solve |
| Optimization | each Newton step solves (A6) |
- 1. rank A = 2 and rank [A | b] = 3. Solutions?
- 2. Partial pivoting picks as pivot the entry with…
- 3. Elimination on a 300 × 300 system costs about how many flops?
Level 3: Advanced
★★★★☆ Advanced⏱ 45 minGraduate level, with full derivations and proofs.Row operations preserve the solution set
Each elementary row operation is multiplication by an invertible matrix . So and have exactly the same solutions.
Proof. A swap, a scaling by , or “add × row to row ” is with that operation applied, and each can be undone, so is invertible. If , then . Conversely, multiply by . ∎
Elimination is a factorization: A = LU
Record each multiplier used to clear entry . Then forward elimination says
With pivoting it’s . Once you have , every new right-hand side costs only : solve forwards, then backwards. Also . That’s how software computes determinants (A2.3).
Example. : the multiplier is , giving and .
Sensitivity: the condition number
If has a relative error , the solution can have a relative error up to , where . Even a perfect algorithm loses about digits. With float64 (about 16 digits) and , only about 4 digits survive. Backward stability (Wilkinson): Gaussian elimination with partial pivoting gives the exact solution of a slightly perturbed problem, which is the best any algorithm can promise in practice.
Exercise 3.1: Show that the elementary matrix for “R₂ ← R₂ − 3R₁” (2 × 2) is invertible, and find its inverse
and (“add the 3·R₁ back”). Notice that is exactly the of the LU example.
- 1. For A = [[2, 1], [6, 5]], what is U₂₂?
- 2. κ(A) = 1000 and b has relative error 10⁻⁶. The worst-case relative error in x is about…
- 3. After computing A = LU once, each new right-hand side costs…
Level 4: Expert
★★★★★ Expert⏱ 35 minResearchers: original papers and open problems.Pivoting: theory versus practice
Wilkinson (1961) showed that elimination with partial pivoting is backward stable, provided the growth factor, the largest entry that appears during elimination relative to the original, stays modest. In the worst case it can grow like , yet on real matrices it almost never does. Why this happens was a long-standing puzzle. Smoothed analysis (Sankar, Spielman and Teng, 2006) explained part of it: tiny random perturbations make bad cases vanish with high probability.
Beyond direct elimination
- Iterative solvers such as Jacobi, Gauss–Seidel and especially the conjugate gradient method (Hestenes and Stiefel, 1952) only need matrix–vector products. They are the tool of choice for huge sparse systems in simulation, graph problems and Gaussian processes (A2.4, A8).
- Sparse direct solvers factor matrices with millions of unknowns by choosing elimination orders that limit fill-in. They’re inside SLAM back-ends like GTSAM and g2o (T3).
- Mixed precision. Factor in fast low precision (fp16 or fp32) on GPUs, then recover full accuracy with a few rounds of iterative refinement in higher precision (Carson and Higham, 2018). The same mixed-precision idea is used for AI training.
References
- The Nine Chapters on the Mathematical Art (Chinese, c. 200 BC–100 AD), Chapter 8 “Fangcheng”: elimination on arrays of numbers.
- C. F. Gauss (1809). Theoria motus corporum coelestium. (Elimination for least-squares orbit determination.)
- M. Hestenes and E. Stiefel (1952). “Methods of conjugate gradients for solving linear systems.” Journal of Research of the National Bureau of Standards, 49(6).
- J. H. Wilkinson (1961). “Error analysis of direct methods of matrix inversion.” Journal of the ACM, 8(3).
- A. Sankar, D. Spielman, S.-H. Teng (2006). “Smoothed analysis of the condition numbers and growth factors of matrices.” SIAM Journal on Matrix Analysis and Applications, 28(2).
- E. Carson and N. Higham (2018). “Accelerating the solution of linear systems by iterative refinement in three precisions.” SIAM Journal on Scientific Computing, 40(2).
- L. Trefethen and D. Bau (1997). Numerical Linear Algebra. SIAM. Lectures 20–23.