The problem: several equations, several unknowns
A system like this has three equations and three unknowns:
2x + y - z = 8
-3x - y + 2z = -11
-2x + y + 2z = -3
Gaussian elimination systematically transforms a system like this into a form where each equation has one fewer unknown than the one above it — an upper-triangular structure — which can then be solved from the bottom up by simple substitution.
The core operation: eliminating a variable using row operations
The elimination process repeatedly uses one equation to cancel a variable out of the equations below it, using three allowed operations that never change the system's actual solution: swapping two equations, multiplying an equation by a nonzero constant, and adding a multiple of one equation to another. Applying the right combination of these to the first equation cancels x from every equation below it; repeating with the second equation cancels y from everything below that, and so on — until the last equation has only one unknown left, solvable directly.
Why partial pivoting matters
A naive elimination just uses whichever equation is "next" as the pivot for each step — but if that equation's leading coefficient happens to be very small (or zero), dividing by it either fails outright or amplifies floating-point rounding error dramatically. Partial pivoting fixes this by, at each step, swapping in whichever remaining equation has the largest absolute coefficient in the current column before using it as the pivot — this keeps the arithmetic numerically stable and avoids the precision problems that come from dividing by a near-zero number.
Before pivoting: pivot element might be 0.0001 (bad — division amplifies error)
After pivoting: pivot element is the largest available value (stable)
What "singular" actually means
If, after accounting for row swaps, some column's pivot position can't be made nonzero no matter which remaining row you choose, the system is singular — meaning the equations aren't independent enough to pin down a single unique solution. This happens in two distinct scenarios:
- Dependent equations (infinitely many solutions) — one equation is a combination of the others, providing no new information.
- Contradictory equations (no solution) — the equations describe mutually incompatible constraints, like
x + y = 5andx + y = 7simultaneously.
A solver can detect that a system is singular (the pivot can't be made nonzero) but distinguishing "infinitely many solutions" from "no solution" requires additional analysis beyond basic elimination.
Common mistakes
- Skipping pivoting and dividing by a near-zero coefficient. This doesn't necessarily throw an error — it can silently produce wildly inaccurate results due to floating-point precision loss.
- Assuming a singular system always means "no solution." It could equally mean infinitely many solutions (dependent equations) — elimination alone doesn't distinguish between the two without extra checks.
- Applying row operations inconsistently across the augmented matrix. Any operation performed on the coefficient side must also be applied to the constants column — forgetting this corrupts the system silently.
FAQ
Why does Gaussian elimination sometimes give a wildly wrong answer without an obvious error?
Almost always a numerical stability issue — dividing by a very small pivot amplifies rounding error; partial pivoting (choosing the largest available pivot at each step) specifically prevents this.
What does it mean if my system of equations is "singular"?
The equations aren't independent enough to produce one unique solution — either they're dependent (infinitely many solutions) or contradictory (no solution); basic elimination flags this but doesn't automatically distinguish between the two cases.
Does the order I write my equations in matter for the final solution?
No — the solution itself is the same regardless of equation order, though partial pivoting may reorder rows internally during elimination purely for numerical stability, not because order changes the actual answer.
Solve systems of up to 5 linear equations with Gaussian elimination using the Linear System Solver — entirely client-side.