HomeMath › System of Linear Equations Solver

System of Linear Equations Solver

Solves a system of 2 or 3 linear equations with as many unknowns from its coefficient matrix and constants using Cramer's rule, reports the determinants involved, and uses Gaussian elimination to tell a system with no solution from one with infinitely many.

When to use

You have 2 or 3 linear equations in 2 or 3 unknowns (x, y, z) with numeric coefficients and need the unique solution or a diagnosis of why there is none.

Do not use when: The system has more than 3 unknowns, is non-linear, or you only need the line through two points (use slope) or a determinant on its own (use matrix-determinant).

Formula

D = det(A); D_i = det(A with column i replaced by the constants b); x_i = D_i / D (Cramer's rule). D = 0: rank(A) < rank([A|b]) → no solution, rank(A) = rank([A|b]) < n → infinitely many solutions

Inputs

ParameterTypeUnitRequiredDescription
coefficientsnumber_listyesCoefficients of x, y (and z) equation by equation, 4 values for a 2×2 system or 9 for a 3×3 system. For 2x + y − z = 8 the first row is 2, 1, −1.
constantsnumber_listyesThe constant term of each equation, in the same order.
sizeintegerno2 or 3. Optional: inferred from the number of constants when omitted. Range: ≥ 2, ≤ 3

Outputs

OutputTypeUnitDescription
xnumberValue of the first unknown, D_x / D.
ynumberValue of the second unknown, D_y / D.
znumberValue of the third unknown, D_z / D (3×3 systems only).
solutionnumber_list[x, y] or [x, y, z].
solution_textstringThe solution written as 'x = …, y = …, z = …'.
determinantnumberDeterminant of the coefficient matrix; non-zero for a unique solution.
cramer_determinantsnumber_list[D_x, D_y, (D_z)]: determinants with the respective column replaced by the constants.

Example

2x + y − z = 8, −3x − y + 2z = −11, −2x + y + 2z = −3: {"coefficients":[2,1,-1,-3,-1,2,-2,1,2],"constants":[8,-11,-3],"size":3}{"x":2,"y":3,"z":-1,"solution":[2,3,-1],"solution_text":"x = 2, y = 3, z = -1","determinant":-1,"cramer_determinants":[-2,-3,1]}

x + y = 10, x − y = 2: {"coefficients":[1,1,1,-1],"constants":[10,2]}{"x":6,"y":4,"solution":[6,4],"solution_text":"x = 6, y = 4","determinant":-2,"cramer_determinants":[-12,-8]}

GET https://tttkmbb.com/api/v1/calculate/linear-system?coefficients=2%2C1%2C-1%2C-3%2C-1%2C2%2C-2%2C1%2C2&constants=8%2C-11%2C-3&size=3

Machine access

Sources

FAQ

How do I enter the equations?

Write each equation as ax + by (+ cz) = k with every unknown present (use 0 for a missing one) and list the coefficients row by row, then the k values in the same order.

What does 'no unique solution' mean?

The determinant is 0, so the equations are dependent or contradictory; the error message says whether the system has no solution (inconsistent) or infinitely many.

Related calculators