Mathematics & Statistics

Simultaneous Equations Solver

Solve 2×2 or 3×3 linear systems for x, y, z, or find out that there is no solution or infinitely many.

Inputs

Calculate from
Two straight lines on x and y axes crossing at one point, the solution (1, 2).xy2x + 3y = 8x − y = −1(1, 2)
Each equation is a straight line. The solution (x, y) is where the lines cross: here 2x + 3y = 8 and x − y = −1 meet at (1, 2). Parallel lines never meet (no solution); identical lines meet everywhere (infinitely many). Diagram not to scale.

Result

Solution
x = 1, y = 2
x
1
y
2
Determinant of the coefficients
-5
System solved
2x + 3y = 8 x − y = −1
Check (left side − right side)
Equation 1: 0 · Equation 2: 0

The solution is x = 1, y = 2; substituting back gives zero error up to rounding.

Educational estimate — check the assumptions below.

About this calculator

Simultaneous linear equations appear whenever several conditions must hold at once — forces at a joint, currents in a circuit (Kirchhoff’s laws), mixing problems. Enter the coefficients of 2 equations in x and y, or 3 equations in x, y and z. The calculator finds the unique solution if there is one; otherwise it tells you whether there is no solution (contradictory equations) or infinitely many (dependent equations).

Formula

2 equations (x, y)

a₁x + b₁y = d₁    a₂x + b₂y = d₂

det = a₁b₂ − a₂b₁    x = (d₁b₂ − d₂b₁) ÷ det    y = (a₁d₂ − a₂d₁) ÷ det

(Cramer’s rule.) The calculator itself uses Gaussian elimination with partial pivoting, which gives the same answer and is more robust.

3 equations (x, y, z)

A x = d,   A = 3 × 3 coefficient matrix

Gaussian elimination with partial pivoting reduces the equations step by step; a unique solution exists exactly when det(A) ≠ 0. If det(A) = 0, comparing the rank of A with the rank of [A | d] decides between no solution and infinitely many.

Worked example

  • 2x + 3y = 8 and x − y = −1: det = 2 × (−1) − 1 × 3 = −5; x = (8 × (−1) − (−1) × 3) ÷ (−5) = 1, y = (2 × (−1) − 1 × 8) ÷ (−5) = 2.
  • x + y + z = 6, 2x − y + 3z = 9, −x + 4y − z = 4 → x = 1, y = 2, z = 3 (det = −5).
  • x + y = 2 and 2x + 2y = 5 → no solution (parallel lines).

Assumptions and limitations

  • Linear equations with real coefficients.
  • A pivot smaller than 10⁻¹² × n × (largest coefficient) is treated as zero, so a system that is singular only because of rounding is reported as having no unique solution.
  • The check substitutes the solution back into each equation; values near 10⁻¹⁵ are normal floating-point rounding.

References

  • Golub, G. H. & Van Loan, C. F. Matrix Computations — Gaussian elimination with partial pivoting.
  • Kreyszig, E. Advanced Engineering Mathematics — linear systems, rank and Cramer’s rule.