Linear System Solver
Solves a system of linear equations Ax = b using Gaussian elimination with partial pivoting, for 2 to 5 unknowns. Partial pivoting (swapping to the largest available pivot in each column) keeps the elimination numerically stable, avoiding division by very small numbers.
If the system has no unique solution (a singular matrix — dependent or contradictory equations), the tool reports this instead of a misleading result.
What the three outcomes mean
A linear system has exactly one of three answers, and the geometry explains each. With two unknowns each equation is a line: they cross at one point (one solution), they are parallel (no solution), or they are the same line (infinitely many). With three unknowns the same logic runs on planes.
A unique solution is the case people expect. "No solution" means the constraints contradict each other — often a sign the model, not the arithmetic, is wrong. "Infinitely many" means an equation adds no information beyond the others, which is what the solver reports as a singular matrix.
Why the solver swaps rows
Gaussian elimination divides by the pivot in each column. If that pivot is zero the division is impossible, and if it is merely small the division amplifies rounding error through every subsequent step, so a system with a perfectly good answer returns numerical rubbish.
Partial pivoting fixes this by swapping in the largest available value in the column before dividing. It changes the row order but not the solution, and it is why the working shown may not match the order in which you entered the equations.
Near-singular systems
Between "solvable" and "singular" lies the case worth worrying about: an ill-conditioned system, where the equations are nearly but not quite redundant. These return an answer, and that answer can move enormously under a tiny change in the inputs. If your coefficients came from measurements, a near-singular system means the result is not trustworthy to more precision than the measurements themselves.
A practical test: change a coefficient in the last decimal place you trust and re-solve. If the answer barely moves, it is sound. If it swings wildly, the system is ill-conditioned and needs better data rather than more arithmetic.