3×3 Linear System Solver
Solve Ax = b for a 3×3 system using Gauss-Jordan elimination.
Overview
The 3x3 Linear System Solver finds the unique solution to three equations in three unknowns by running Gauss-Jordan elimination on the augmented matrix [A | b]. Enter the nine coefficients and three right-hand-side values and you get back (x, y, z) plus a determinant for sanity.
It is built for engineering and physics students working through textbook problems, circuit designers solving Kirchhoff loops and game developers fitting parabolas through three points. When the matrix is singular the solver tells you so rather than returning garbage.
How it works
Given A * x = b, the solver constructs the augmented matrix and applies partial-pivoting row reduction. At each pivot column it swaps in the row with the largest absolute entry to minimise floating-point error, then scales the pivot row and eliminates above and below.
If during reduction a pivot is effectively zero the system is reported as singular — either no solution exists or infinitely many do. Otherwise the final matrix is [I | x] and the right column is the answer. The determinant is tracked through row swaps and scaling for an honest singularity check.
Examples
x + y + z = 6
2y + 5z = -4
2x + 5y - z = 27
→ x = 5, y = 3, z = -2
x + 2y + 3z = 6
2x + 3y + 4z = 9
3x + 4y + 5z = 12
→ singular (det = 0)
3x + 2y - z = 1
2x - 2y + 4z = -2
-x + 0.5y - z = 0
→ x = 1, y = -2, z = -2
FAQ
What does singular mean?
The coefficient matrix has determinant zero, so it is not invertible. The system has no solution or infinitely many; either way no single (x, y, z) is returned.
Why partial pivoting?
It avoids dividing by tiny numbers that magnify floating-point error. Without it, mildly ill-conditioned systems can return wildly wrong answers.
Is the answer exact for integer inputs?
Computation is in double precision, so small integer answers come back exactly. Very large or non-integer answers can differ in the last few digits.
Can it solve over-determined systems?
No — for least-squares fits with more equations than unknowns, see the Linear Regression or Polynomial Curve Fit tools.
Does it return the inverse matrix?
Not directly. For that, expand the right-hand side to the 3x3 identity and run elimination on [A | I].