Solving systems of linear equations with Gaussian elimination
A system of linear equations is solved by turning it, one row operation at a time, into a triangle that can be read from the bottom up. That is Gaussian elimination, the method behind almost every linear algebra course and every numerical solver.
Row operations
Three operations never change the solution: swapping two rows, multiplying a row by a nonzero number, and adding a multiple of one row to another. Apply them to the augmented matrix [A | b], the coefficients and the right-hand side together.
The goal is an upper triangular form, with zeros below the diagonal. Then back substitution finishes the job: the last row gives z, the one above gives y, and the top row gives x.
One, none, or infinitely many
If det A ≠ 0, there is exactly one solution. If det A = 0, elimination ends with a row of zeros on the left. If the right-hand side of that row is also zero, there are infinitely many solutions and one variable is free. If it is not, the row reads 0 = c and there is no solution at all.
Pivoting
Dividing by a very small pivot magnifies rounding errors, and a zero pivot stops the method. The fix is partial pivoting: before eliminating each column, swap in the row with the largest entry in that column. The calculator below does this.
Worked example
Solve x + y + z = 6, 2y + 5z = −4, 2x + 5y − z = 27. Subtract twice the first row from the third: 3y − 3z = 15, so y − z = 5.
Put y = z + 5 into 2y + 5z = −4: 7z + 10 = −4, so z = −2, then y = 3 and x = 6 − 3 + 2 = 5. The determinant is −21, not zero, so this is the only solution. These are the calculator’s default inputs.
3×3 system solver
a11·x + a12·y + a13·z = b1 (rows 1 to 3)
Common mistakes
- Applying a row operation to the coefficients but not to the right-hand side.
- Stopping at a zero pivot instead of swapping rows.
- Concluding “no solution” as soon as det A = 0, without checking whether the system is consistent.