gizmobench

System of Equations Calculator

Type your equations, or fill the augmented matrix, and this solver runs Gaussian elimination in front of you: the largest coefficient leads each column, every row operation is printed with the reason for it, and back-substitution finishes from the bottom row up. The page opens on 2x + y - z = 8, -3x - y + 2z = -11 and -2x + y + 2z = -3, which comes out at x = 2, y = 3, z = -1, and the answer is substituted back into the equations as typed so the residual beside it is one you can check. Every coefficient is held as one whole number over another rather than as a decimal, which is what makes the three possible answers reliable: a unique solution, no solution at all, or infinitely many, with the free variables named and the whole family written out. A term that is not first degree is refused by name rather than quietly dropped.

3 variables, 3 equationsAugmented matrixAnswer first
 2x +  y -  z =    8
-3x -  y + 2z =  -11
-2x +  y + 2z =   -3

elimination         3 row operations, 2 row swaps, pivoting on the largest coefficient
back-substitution   3 steps

x = 2        y = 3        z = -1

residual            0   0   0        unique solution
Enter as
Variables
Equations
Working
x
2
y
3
z
-1
Case
Unique

The augmented matrix

One row per equation, one column per variable, and the constant after the equals sign. A cell takes a whole number, a decimal like 0.5 or a fraction like 1/3, and a blank cell counts as 0.

xyzconstant

The check

  • 2x + y - z = 8, residual 0
  • -3x - y + 2z = -11, residual 0
  • -2x + y + 2z = -3, residual 0

Each value is substituted back into the equations as you typed them: every residual is exactly zero, because the arithmetic is done in fractions rather than decimals.

The working

Forward elimination first, largest coefficient leading each column, then back-substitution from the bottom row up. Every multiplier is an exact fraction.

  1. R1 <-> R2 pivot on -3, the largest coefficient left in column x
  2. R2 -> R2 + (2/3)R1 clears x from row 2
  3. R3 -> R3 - (2/3)R1 clears x from row 3
  4. R2 <-> R3 pivot on 5/3, the largest coefficient left in column y
  5. R3 -> R3 - (1/5)R2 clears y from row 3

Back-substitution

  • From row 3: (1/5)z = -1/5, so z = -1.
  • From row 2: (5/3)y + (2/3)z = 13/3 with z = -1, so y = 3.
  • From row 1: -3x - y + 2z = -11 with y = 3 and z = -1, so x = 2.

The three answers a linear system can have

Load any of them to see which one you are looking at and why.

  • x + y = 3, x - y = 1two lines that cross once
    x = 2, y = 1
  • x + y = 1, 2x + 2y = 3same line, different constant
    No solution: the equations contradict each other
  • x + y = 3, x + y = 3one equation repeated, rank below the variable count
    x = 3 - y, with y free
Three answers, and the rank tells you which. Count the rows left with a leading coefficient after elimination: that is the rank. Rank equal to the number of unknowns gives one solution. A row that reduces to 0 = something other than zero is a contradiction, so there is no solution at all. Rank below the number of unknowns leaves free variables, and every value of them is a solution, which is why the answer comes back as a formula rather than a number. Telling those apart needs zero to mean zero, so every coefficient here is held as a fraction of two whole numbers and nothing is rounded on the way.

Common questions

How do I solve a system of equations on this page?
Two ways, and they give the same answer. Leave it on Augmented matrix and type the coefficients into the grid, one row per equation, with the constant after the equals sign: a blank cell counts as 0. Or switch to Equations and write them out, one per line, as in x + y = 3 and x - y = 1, which gives x = 2, y = 1. Either way the stage above prints the system back as equations, then the elimination, then the answer, and the cells under it hold one value per variable with the case beside them. Nothing is gated, there is no sign-up, and the answer changes on the keystroke.
What does it mean when a system has no solution?
That the equations contradict each other, so no set of values can satisfy them all. Enter x + y = 1 with 2x + 2y = 3 and the elimination ends with row 2 reduced to 0 = -1/2, which nothing can satisfy: the page reports No solution and names that row rather than handing back a number. Geometrically the two lines are parallel and never meet. An overdetermined system is the usual way to meet this case, and it is why the page checks the rank of the coefficients against the rank of the whole augmented matrix rather than assuming an answer exists.
What if there are infinitely many solutions?
Then the rank is below the number of unknowns, at least one variable is free, and the page says so in words. Enter x + y = 3 twice and the answer comes back as x = 3 - y with y free, and the family is written out as (x, y) = (3, 0) + y(-1, 1): one point on the solution set, plus a direction you can travel in without breaking either equation. The same happens with the singular matrix [1 2 3; 4 5 6; 7 8 9] against a zero column, where the answer is x = z, y = -2z and z is free. That last one is the case exact arithmetic is here for: in double precision the final pivot of that elimination comes out at 1.1102230246251565e-16 rather than 0, which reads as full rank, so a decimal solver reports one solution of all zeros and never mentions the free variable.
Does it show the steps, and is this Gaussian elimination or Gauss-Jordan?
It is Gaussian elimination with partial pivoting: the row holding the largest coefficient in the working column moves to the top of that column, the rows below it are cleared one at a time, and back-substitution then works up from the last row. Every operation is printed in the form R2 -> R2 + (2/3)R1 with the reason beside it, and switching Working to Every step prints the whole augmented matrix after each one. Gauss-Jordan carries on to reduced row echelon form; this page stops at echelon form and substitutes back, which is fewer operations for the same answer, and it is how the free-variable case is parameterised here.
How many equations and unknowns can it take?
2 to 6 equations in 2 to 6 unknowns, and they do not have to match. More equations than unknowns is fine: x + y = 3, x - y = 1 and 2x + y = 5 all hold at x = 2, y = 1, and if one of them did not, the page would report the contradiction instead. Fewer equations than unknowns leaves free variables, so x + y + z = 6 with x - y + z = 2 gives x = 4 - z, y = 2 with z free. Past six of either, the page says which limit you passed and stops, rather than truncating what you typed.
Why are the answers fractions rather than decimals?
Because the arithmetic is exact, and the answer to a system with whole-number coefficients usually is a fraction. Decimals you type are read exactly on the way in as well, so 0.1 becomes one tenth rather than the nearest binary double: 0.1x + 0.2y = 0.3 with 0.2x + 0.1y = 0.3 gives x = 1, y = 1 here, where the same elimination in floating point returns 0.9999999999999998 for y. The gap widens as the numbers get more awkward. The Hilbert system with rows 1, 1/2, 1/3 and 1/2, 1/3, 1/4 and 1/3, 1/4, 1/5, each equal to 1, comes out at x = 3, y = -24, z = 30 on this page and at 3.0000000000000195, -24.000000000000092 and 30.00000000000008 in double precision.
What kinds of equation does it refuse?
Anything that is not first degree, and it says which term and why. x^2 + y = 3 is refused as not linear, xy is refused because it multiplies two variables together, 1/x is refused because a variable sits in a denominator, and sin(x) is refused as a function. Parentheses are not expanded for you: multiply them out, or write a fractional coefficient as x/2 or 0.5x. What is allowed is more than it sounds. Variables may sit on both sides and are collected for you, so 2x + 1 = x + 4 becomes x = 3, terms that cancel are cancelled exactly, and a variable may be a letter with a subscript, such as x1.

Gaussian elimination that pivots on the largest available coefficient for numerical stability, with every row operation printed so you can follow it. The solution is substituted back into the equations you typed and the residual is shown, so you can see the arithmetic close. A nonlinear term is refused by name rather than quietly linearised.