Home › Math › 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
| Parameter | Type | Unit | Required | Description |
|---|---|---|---|---|
coefficients | number_list | yes | Coefficients 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. | |
constants | number_list | yes | The constant term of each equation, in the same order. | |
size | integer | no | 2 or 3. Optional: inferred from the number of constants when omitted. Range: ≥ 2, ≤ 3 |
Outputs
| Output | Type | Unit | Description |
|---|---|---|---|
x | number | Value of the first unknown, D_x / D. | |
y | number | Value of the second unknown, D_y / D. | |
z | number | Value of the third unknown, D_z / D (3×3 systems only). | |
solution | number_list | [x, y] or [x, y, z]. | |
solution_text | string | The solution written as 'x = …, y = …, z = …'. | |
determinant | number | Determinant of the coefficient matrix; non-zero for a unique solution. | |
cramer_determinants | number_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
- API:
GET https://tttkmbb.com/api/v1/calculate/linear-system(query parameters) orPOSTwith a JSON body{"inputs": {...}} - Schema: https://tttkmbb.com/api/v1/calculators/linear-system · Markdown: https://tttkmbb.com/math/linear-system.md · JSON definition: https://tttkmbb.com/math/linear-system.json
- MCP: server
https://tttkmbb.com/mcp, toolrun_calculator with calculator_id="linear-system" - OpenAPI operationId:
solve_linear_system - Freshness:
static. Authentication: none. Rate limit: fair use (see rate limits).
Sources
- Wikipedia – Cramer's rule (reference)
- Wikipedia – Gaussian elimination (reference)
- Wolfram MathWorld – Cramer's Rule (reference)
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
- Matrix Determinant Calculator — The determinant that decides whether the solution is unique.
- Matrix Inverse Calculator — Solve A·x = b as x = A⁻¹·b.
- Slope Calculator — A single linear equation through two points.