CipherMatrix

System of Linear Equations Solver

Enter the augmented matrix [A | b] of your system and get the solution by Gauss–Jordan elimination, with each row operation shown and the answer checked in the original equations.

How to enter a system

A system of linear equations such as 2x + y = 5 and x − y = 1 is stored as an augmented matrix. Each row is one equation: the coefficients of the unknowns come first and the constant on the right-hand side goes in the last column. For the example the rows are (2, 1 | 5) and (1, −1 | 1). Choose the number of equations and unknowns with the size buttons (the last column is the constants), and use integers, decimals or fractions.

The Gauss–Jordan method

Gauss–Jordan elimination applies row operations to [A | b] until it reaches reduced row echelon form. The three allowed operations are swapping two rows, multiplying a row by a non-zero number and adding a multiple of one row to another. None of them changes the solution set. At the end each pivot is 1 and is the only non-zero entry in its column, so the solution can be read straight off the matrix.

The calculator uses exact fractions, so answers such as x = 7/3 are exact rather than rounded, and a coefficient that should be zero is never a tiny floating-point leftover.

Three possible outcomes

By the Rouché–Capelli theorem the number of solutions depends on the ranks of the coefficient matrix A and the augmented matrix [A | b].

  • Exactly one solution when rank(A) = rank([A | b]) = number of unknowns. The lines or planes meet in a single point.
  • Infinitely many solutions when the two ranks are equal but smaller than the number of unknowns. The unknowns without a pivot are free variables and the solution is written with parameters t₁, t₂, …
  • No solution when rank(A) < rank([A | b]). A row of the form 0 = c with c not zero appears, which is a contradiction.

Checking your work

After solving, the tool substitutes the answer into every original equation, using exact arithmetic, and shows that both sides agree. For infinite families it checks the particular solution and each direction vector. If your hand calculation differs, compare it with the row operations step by step to find where the arithmetic diverged.

Worked examples

These examples are computed by the same engine as the calculator above, so you can compare each step with your own working.

3×3, unique solution

  • Augmented matrix: [[2, 1, -1, 8], [-3, -1, 2, -11], [-2, 1, 2, -3]]
x₁
2
x₂
3
x₃
−1

Step-by-step solution

Formula used
Gauss–Jordan elimination: reduce [A | b] to RREF
Unique solution ⇔ rank(A) = rank([A | b]) = n; none ⇔ rank(A) < rank([A | b]); infinite otherwise
  1. NoteThe system of 3 equations in 3 unknowns
    2x₁ + x₂ − x₃ = 8
    −3x₁ − x₂ + 2x₃ = −11
    −2x₁ + x₂ + 2x₃ = −3
    The last column of the matrix holds the constants: this is the augmented matrix [A | b].
  2. StartStart with the augmented matrix [A | b]
    A is 3×4. Work column by column from left to right. The current pivot row is called r (starting at row 1).
    Allowed row operations (they never change the rank): swap two rows, multiply a row by a nonzero number, add a multiple of one row to another.
    21−18−3−12−11−212−3
  3. PivotPivot selection (column 1)
    pivot = a₁₁ = 2
    Scan column 1 from row 1 downward: the first nonzero entry is a₁₁ = 2 (row 1). It already sits in the pivot position (1, 1).
    21−18−3−12−11−212−3
  4. Row multiplyRow multiplication
    R₁ ← (1/2)·R₁
    Divide row 1 by the pivot 2 (multiply by 1/2 = 1/2) so the pivot becomes 1.
    new R₁ = [2, 1, -1, 8] · (1/2) = [1, 1/2, -1/2, 4]
    112−124−3−12−11−212−3
  5. Row additionElimination below the pivot (column 1)
    R₂ ← R₂ + 3·R₁
    Goal: turn a₂₁ = -3 into 0 using the pivot row R₁. (R₂ ← R₂ - (-3)·R₁)
    new R₂ = [-3, -1, 2, -11] - (-3)·[1, 1/2, -1/2, 4] = [0, 1/2, 1/2, 1]
    112−124012121−212−3
  6. Row additionElimination below the pivot (column 1)
    R₃ ← R₃ + 2·R₁
    Goal: turn a₃₁ = -2 into 0 using the pivot row R₁. (R₃ ← R₃ - (-2)·R₁)
    new R₃ = [-2, 1, 2, -3] - (-2)·[1, 1/2, -1/2, 4] = [0, 2, 1, 5]
    112−1240121210215
  7. PivotPivot selection (column 2)
    pivot = a₂₂ = 1/2
    Scan column 2 from row 2 downward: the first nonzero entry is a₂₂ = 1/2 (row 2). It already sits in the pivot position (2, 2).
    112−1240121210215
  8. Row multiplyRow multiplication
    R₂ ← (2)·R₂
    Divide row 2 by the pivot 1/2 (multiply by 1/1/2 = 2) so the pivot becomes 1.
    new R₂ = [0, 1/2, 1/2, 1] · (2) = [0, 1, 1, 2]
    112−12401120215
  9. Row additionElimination below the pivot (column 2)
    R₃ ← R₃ - 2·R₂
    Goal: turn a₃₂ = 2 into 0 using the pivot row R₂. (R₃ ← R₃ - (2)·R₂)
    new R₃ = [0, 2, 1, 5] - (2)·[0, 1, 1, 2] = [0, 0, -1, 1]
    112−124011200−11
  10. PivotPivot selection (column 3)
    pivot = a₃₃ = -1
    Scan column 3 from row 3 downward: the first nonzero entry is a₃₃ = -1 (row 3). It already sits in the pivot position (3, 3).
    112−124011200−11
  11. Row multiplyRow multiplication
    R₃ ← (-1)·R₃
    Divide row 3 by the pivot -1 (multiply by 1/(-1) = -1) so the pivot becomes 1.
    new R₃ = [0, 0, -1, 1] · (-1) = [0, 0, 1, -1]
    112−1240112001−1
  12. ResultRow echelon form (REF) reached
    Each pivot is 1, each pivot lies to the right of the pivot above it, and everything below a pivot is 0.
    Number of pivots = 3.
    112−1240112001−1
  13. Row additionEliminate above the pivot (column 3)
    R₁ ← R₁ + 1/2·R₃
    Goal: turn a₁₃ = -1/2 into 0 using the pivot row R₃. (R₁ ← R₁ - (-1/2)·R₃)
    new R₁ = [1, 1/2, -1/2, 4] - (-1/2)·[0, 0, 1, -1] = [1, 1/2, 0, 7/2]
    1120720112001−1
  14. Row additionEliminate above the pivot (column 3)
    R₂ ← R₂ - R₃
    Goal: turn a₂₃ = 1 into 0 using the pivot row R₃. (R₂ ← R₂ - (1)·R₃)
    new R₂ = [0, 1, 1, 2] - (1)·[0, 0, 1, -1] = [0, 1, 0, 3]
    1120720103001−1
  15. Row additionEliminate above the pivot (column 2)
    R₁ ← R₁ - 1/2·R₂
    Goal: turn a₁₂ = 1/2 into 0 using the pivot row R₂. (R₁ ← R₁ - (1/2)·R₂)
    new R₁ = [1, 1/2, 0, 7/2] - (1/2)·[0, 1, 0, 3] = [1, 0, 0, 2]
    10020103001−1
  16. ResultReduced row echelon form (RREF) reached
    Every pivot is 1 and is the only nonzero entry in its column. The RREF of a matrix is unique.
    10020103001−1
  17. NoteCompare the ranks
    rank(A) = 3
    rank([A | b]) = 3
    Number of unknowns n = 3
    rank(A) = rank([A | b]) = n: exactly one solution.
  18. ResultRead the unique solution from the RREF
    x₁ = 2
    x₂ = 3
    x₃ = −1
  19. CheckSubstitute into the original equations
    Equation 1: 8 = 8 ✓
    Equation 2: −11 = −11 ✓
    Equation 3: −3 = −3 ✓

2×2: 2x + y = 5, x − y = 1

  • Augmented matrix: [[2, 1, 5], [1, -1, 1]]
x₁
2
x₂
1

Step-by-step solution

Formula used
Gauss–Jordan elimination: reduce [A | b] to RREF
Unique solution ⇔ rank(A) = rank([A | b]) = n; none ⇔ rank(A) < rank([A | b]); infinite otherwise
  1. NoteThe system of 2 equations in 2 unknowns
    2x₁ + x₂ = 5
    x₁ − x₂ = 1
    The last column of the matrix holds the constants: this is the augmented matrix [A | b].
  2. StartStart with the augmented matrix [A | b]
    A is 2×3. Work column by column from left to right. The current pivot row is called r (starting at row 1).
    Allowed row operations (they never change the rank): swap two rows, multiply a row by a nonzero number, add a multiple of one row to another.
    2151−11
  3. PivotPivot selection (column 1)
    pivot = a₁₁ = 2
    Scan column 1 from row 1 downward: the first nonzero entry is a₁₁ = 2 (row 1). It already sits in the pivot position (1, 1).
    2151−11
  4. Row multiplyRow multiplication
    R₁ ← (1/2)·R₁
    Divide row 1 by the pivot 2 (multiply by 1/2 = 1/2) so the pivot becomes 1.
    new R₁ = [2, 1, 5] · (1/2) = [1, 1/2, 5/2]
    112521−11
  5. Row additionElimination below the pivot (column 1)
    R₂ ← R₂ - R₁
    Goal: turn a₂₁ = 1 into 0 using the pivot row R₁. (R₂ ← R₂ - (1)·R₁)
    new R₂ = [1, -1, 1] - (1)·[1, 1/2, 5/2] = [0, -3/2, -3/2]
    112520−32−32
  6. PivotPivot selection (column 2)
    pivot = a₂₂ = -3/2
    Scan column 2 from row 2 downward: the first nonzero entry is a₂₂ = -3/2 (row 2). It already sits in the pivot position (2, 2).
    112520−32−32
  7. Row multiplyRow multiplication
    R₂ ← (-2/3)·R₂
    Divide row 2 by the pivot -3/2 (multiply by 1/(-3/2) = -2/3) so the pivot becomes 1.
    new R₂ = [0, -3/2, -3/2] · (-2/3) = [0, 1, 1]
    11252011
  8. ResultRow echelon form (REF) reached
    Each pivot is 1, each pivot lies to the right of the pivot above it, and everything below a pivot is 0.
    Number of pivots = 2.
    11252011
  9. Row additionEliminate above the pivot (column 2)
    R₁ ← R₁ - 1/2·R₂
    Goal: turn a₁₂ = 1/2 into 0 using the pivot row R₂. (R₁ ← R₁ - (1/2)·R₂)
    new R₁ = [1, 1/2, 5/2] - (1/2)·[0, 1, 1] = [1, 0, 2]
    102011
  10. ResultReduced row echelon form (RREF) reached
    Every pivot is 1 and is the only nonzero entry in its column. The RREF of a matrix is unique.
    102011
  11. NoteCompare the ranks
    rank(A) = 2
    rank([A | b]) = 2
    Number of unknowns n = 2
    rank(A) = rank([A | b]) = n: exactly one solution.
  12. ResultRead the unique solution from the RREF
    x₁ = 2
    x₂ = 1
  13. CheckSubstitute into the original equations
    Equation 1: 5 = 5 ✓
    Equation 2: 1 = 1 ✓

Infinitely many solutions

  • Augmented matrix: [[1, 2, 3, 4], [2, 4, 6, 8], [1, 0, 1, 2]]
General solution
x₁ = 2 − t₁, x₂ = 1 − t₁, x₃ = t₁
1 free parameter
Infinitely many solutions: choose any real values for t₁. Dimension of the solution set = n − rank = 1.

Step-by-step solution

Formula used
Gauss–Jordan elimination: reduce [A | b] to RREF
Unique solution ⇔ rank(A) = rank([A | b]) = n; none ⇔ rank(A) < rank([A | b]); infinite otherwise
  1. NoteThe system of 3 equations in 3 unknowns
    x₁ + 2x₂ + 3x₃ = 4
    2x₁ + 4x₂ + 6x₃ = 8
    x₁ + x₃ = 2
    The last column of the matrix holds the constants: this is the augmented matrix [A | b].
  2. StartStart with the augmented matrix [A | b]
    A is 3×4. Work column by column from left to right. The current pivot row is called r (starting at row 1).
    Allowed row operations (they never change the rank): swap two rows, multiply a row by a nonzero number, add a multiple of one row to another.
    123424681012
  3. PivotPivot selection (column 1)
    pivot = a₁₁ = 1
    Scan column 1 from row 1 downward: the first nonzero entry is a₁₁ = 1 (row 1). It already sits in the pivot position (1, 1).
    123424681012
  4. Row additionElimination below the pivot (column 1)
    R₂ ← R₂ - 2·R₁
    Goal: turn a₂₁ = 2 into 0 using the pivot row R₁. (R₂ ← R₂ - (2)·R₁)
    new R₂ = [2, 4, 6, 8] - (2)·[1, 2, 3, 4] = [0, 0, 0, 0]
    123400001012
  5. Row additionElimination below the pivot (column 1)
    R₃ ← R₃ - R₁
    Goal: turn a₃₁ = 1 into 0 using the pivot row R₁. (R₃ ← R₃ - (1)·R₁)
    new R₃ = [1, 0, 1, 2] - (1)·[1, 2, 3, 4] = [0, -2, -2, -2]
    123400000−2−2−2
  6. PivotPivot selection (column 2)
    pivot = a₃₂ = -2
    Scan column 2 from row 2 downward: the first nonzero entry is a₃₂ = -2 (row 3). It must be moved up to the pivot position (2, 2).
    123400000−2−2−2
  7. Row swapRow swap
    R₂ ↔ R₃
    Exchange row 2 and row 3 so the nonzero pivot lands at (2, 2). Swapping rows does not change the rank.
    12340−2−2−20000
  8. Row multiplyRow multiplication
    R₂ ← (-1/2)·R₂
    Divide row 2 by the pivot -2 (multiply by 1/(-2) = -1/2) so the pivot becomes 1.
    new R₂ = [0, -2, -2, -2] · (-1/2) = [0, 1, 1, 1]
    123401110000
  9. NoteNothing to eliminate
    All entries below the pivot in column 2 are already 0.
    123401110000
  10. No pivotColumn 3: no pivot
    Every entry of column 3 from row 3 downward is 0, so this column has no pivot. Move one column to the right (the pivot row stays at R₃).
    123401110000
  11. No pivotColumn 4: no pivot
    Every entry of column 4 from row 3 downward is 0, so this column has no pivot. Move one column to the right (the pivot row stays at R₃).
    123401110000
  12. ResultRow echelon form (REF) reached
    Each pivot is 1, each pivot lies to the right of the pivot above it, and everything below a pivot is 0.
    Number of pivots = 2; the last 1 row(s) are all zeros.
    123401110000
  13. Row additionEliminate above the pivot (column 2)
    R₁ ← R₁ - 2·R₂
    Goal: turn a₁₂ = 2 into 0 using the pivot row R₂. (R₁ ← R₁ - (2)·R₂)
    new R₁ = [1, 2, 3, 4] - (2)·[0, 1, 1, 1] = [1, 0, 1, 2]
    101201110000
  14. ResultReduced row echelon form (RREF) reached
    Every pivot is 1 and is the only nonzero entry in its column. The RREF of a matrix is unique.
    101201110000
  15. NoteCompare the ranks
    rank(A) = 2
    rank([A | b]) = 2
    Number of unknowns n = 3
    rank(A) = rank([A | b]) = 2 < n = 3: infinitely many solutions with 1 free variable.
  16. ResultExpress the pivot variables in terms of the free variables
    Free variables: x₃ = t₁ (any real numbers).
    x₁ = 2 − t₁
    x₂ = 1 − t₁
    x₃ = t₁
  17. CalculateVector form
    x = (2, 1, 0) + t₁·(−1, −1, 1)
  18. CheckVerify exactly
    Particular solution (all t = 0): every original equation holds ✓
    Each direction vector satisfies the homogeneous system A·d = 0 ✓

No solution

  • Augmented matrix: [[1, 1, 2], [1, 1, 3]]
Solution
No solution
the system is inconsistent
Geometrically, the equations describe lines or planes that have no common point.

Step-by-step solution

Formula used
Rouché–Capelli: solvable ⇔ rank(A) = rank([A | b])
  1. NoteThe system of 2 equations in 2 unknowns
    x₁ + x₂ = 2
    x₁ + x₂ = 3
    The last column of the matrix holds the constants: this is the augmented matrix [A | b].
  2. StartStart with the augmented matrix [A | b]
    A is 2×3. Work column by column from left to right. The current pivot row is called r (starting at row 1).
    Allowed row operations (they never change the rank): swap two rows, multiply a row by a nonzero number, add a multiple of one row to another.
    112113
  3. PivotPivot selection (column 1)
    pivot = a₁₁ = 1
    Scan column 1 from row 1 downward: the first nonzero entry is a₁₁ = 1 (row 1). It already sits in the pivot position (1, 1).
    112113
  4. Row additionElimination below the pivot (column 1)
    R₂ ← R₂ - R₁
    Goal: turn a₂₁ = 1 into 0 using the pivot row R₁. (R₂ ← R₂ - (1)·R₁)
    new R₂ = [1, 1, 3] - (1)·[1, 1, 2] = [0, 0, 1]
    112001
  5. No pivotColumn 2: no pivot
    Every entry of column 2 from row 2 downward is 0, so this column has no pivot. Move one column to the right (the pivot row stays at R₂).
    112001
  6. PivotPivot selection (column 3)
    pivot = a₂₃ = 1
    Scan column 3 from row 2 downward: the first nonzero entry is a₂₃ = 1 (row 2). It already sits in the pivot position (2, 3).
    112001
  7. ResultRow echelon form (REF) reached
    Each pivot is 1, each pivot lies to the right of the pivot above it, and everything below a pivot is 0.
    Number of pivots = 2.
    112001
  8. Row additionEliminate above the pivot (column 3)
    R₁ ← R₁ - 2·R₂
    Goal: turn a₁₃ = 2 into 0 using the pivot row R₂. (R₁ ← R₁ - (2)·R₂)
    new R₁ = [1, 1, 2] - (2)·[0, 0, 1] = [1, 1, 0]
    110001
  9. ResultReduced row echelon form (RREF) reached
    Every pivot is 1 and is the only nonzero entry in its column. The RREF of a matrix is unique.
    110001
  10. NoteCompare the ranks
    rank(A) = 1
    rank([A | b]) = 2
    Number of unknowns n = 2
    rank(A) < rank([A | b]): the system is inconsistent.
  11. ResultNo solution
    Row 2 of the RREF reads 0 = 1, which is impossible.
    The equations contradict each other, so no values of the unknowns satisfy all of them.

Fractions

  • Augmented matrix: [[1/2, 1/3, 1], [1/4, -1, 2]]
x₁
20/7
≈ 2.8571429
x₂
−9/7
≈ -1.2857143

Step-by-step solution

Formula used
Gauss–Jordan elimination: reduce [A | b] to RREF
Unique solution ⇔ rank(A) = rank([A | b]) = n; none ⇔ rank(A) < rank([A | b]); infinite otherwise
  1. NoteThe system of 2 equations in 2 unknowns
    (1/2)x₁ + (1/3)x₂ = 1
    (1/4)x₁ − x₂ = 2
    The last column of the matrix holds the constants: this is the augmented matrix [A | b].
  2. StartStart with the augmented matrix [A | b]
    A is 2×3. Work column by column from left to right. The current pivot row is called r (starting at row 1).
    Allowed row operations (they never change the rank): swap two rows, multiply a row by a nonzero number, add a multiple of one row to another.
    1213114−12
  3. PivotPivot selection (column 1)
    pivot = a₁₁ = 1/2
    Scan column 1 from row 1 downward: the first nonzero entry is a₁₁ = 1/2 (row 1). It already sits in the pivot position (1, 1).
    1213114−12
  4. Row multiplyRow multiplication
    R₁ ← (2)·R₁
    Divide row 1 by the pivot 1/2 (multiply by 1/1/2 = 2) so the pivot becomes 1.
    new R₁ = [1/2, 1/3, 1] · (2) = [1, 2/3, 2]
    123214−12
  5. Row additionElimination below the pivot (column 1)
    R₂ ← R₂ - 1/4·R₁
    Goal: turn a₂₁ = 1/4 into 0 using the pivot row R₁. (R₂ ← R₂ - (1/4)·R₁)
    new R₂ = [1/4, -1, 2] - (1/4)·[1, 2/3, 2] = [0, -7/6, 3/2]
    12320−7632
  6. PivotPivot selection (column 2)
    pivot = a₂₂ = -7/6
    Scan column 2 from row 2 downward: the first nonzero entry is a₂₂ = -7/6 (row 2). It already sits in the pivot position (2, 2).
    12320−7632
  7. Row multiplyRow multiplication
    R₂ ← (-6/7)·R₂
    Divide row 2 by the pivot -7/6 (multiply by 1/(-7/6) = -6/7) so the pivot becomes 1.
    new R₂ = [0, -7/6, 3/2] · (-6/7) = [0, 1, -9/7]
    123201−97
  8. ResultRow echelon form (REF) reached
    Each pivot is 1, each pivot lies to the right of the pivot above it, and everything below a pivot is 0.
    Number of pivots = 2.
    123201−97
  9. Row additionEliminate above the pivot (column 2)
    R₁ ← R₁ - 2/3·R₂
    Goal: turn a₁₂ = 2/3 into 0 using the pivot row R₂. (R₁ ← R₁ - (2/3)·R₂)
    new R₁ = [1, 2/3, 2] - (2/3)·[0, 1, -9/7] = [1, 0, 20/7]
    1020701−97
  10. ResultReduced row echelon form (RREF) reached
    Every pivot is 1 and is the only nonzero entry in its column. The RREF of a matrix is unique.
    1020701−97
  11. NoteCompare the ranks
    rank(A) = 2
    rank([A | b]) = 2
    Number of unknowns n = 2
    rank(A) = rank([A | b]) = n: exactly one solution.
  12. ResultRead the unique solution from the RREF
    x₁ = 20/7
    x₂ = −9/7
  13. CheckSubstitute into the original equations
    Equation 1: 1 = 1 ✓
    Equation 2: 2 = 2 ✓

Frequently asked questions

What is the difference between Gaussian and Gauss–Jordan elimination?

Gaussian elimination stops at a row echelon form and then uses back-substitution. Gauss–Jordan continues to the reduced row echelon form so that the solution can be read directly.

Can the solver handle more equations than unknowns?

Yes. Such an overdetermined system has a solution only if the extra equations are consistent with the others. Otherwise the calculator reports that there is no solution.

How are infinitely many solutions written?

With free parameters. For example x₁ = 2 − t, x₂ = t means every point (2 − t, t) on a line is a solution. The tool also gives the vector form.

Can I use fractions and decimals?

Yes. Enter values like 1/3 or 0.25. They are converted to exact fractions before solving.

Related calculators