How do you solve a system of linear equations?
Solve two or three linear equations together and see where the lines cross.
What you enter stays on your device while you use this tool. Opening a shared link sends the settings in its address to HowToolbox to prepare the page.
Solution
x = 2, y = 1
The lines 2x + y = 5 and x − y = 1 cross at (2, 1), the one point on both.
Key values as a table
| Line | Equation | Slope |
|---|---|---|
| (1) | 2x + y = 5 | −2 |
| (2) | x − y = 1 | 1 |
- Determinant
- D = −3
- Rank
- 2 (with right-hand side 2)
Formula
Cramer's rule: x = −6 / −3, y = −3 / −3
Solve two or three linear equations together and see where the lines cross.
How to use
- Choose two unknowns (x and y) or three (x, y and z).
- Type each equation as its numbers: for 2x + y = 5 enter 2 under x, 1 under y and 5 after the equals sign. A missing variable is 0.
- Read the solution, or why there is none. With two unknowns, drag a line's handle to slide it and watch the crossing point move.
How it works
A system of linear equations asks for values that make every equation true at once. With two unknowns, each equation is a straight line, and the solution is where the lines cross. Two lines either cross once, run parallel and never meet (no solution), or lie on top of each other (infinitely many solutions). With three unknowns, each equation is a flat plane in space.
The determinant D of the numbers in front of the variables decides which case you have: if D is not 0 there is exactly one solution, and Cramer's rule gives it as x = Dₓ / D, y = D_y / D, where Dₓ is D with the x column replaced by the right-hand sides. For 2x + y = 5 and x − y = 1: D = 2·(−1) − 1·1 = −3, Dₓ = 5·(−1) − 1·1 = −6 and D_y = 2·1 − 5·1 = −3, so x = 2 and y = 1.
When D = 0, the ranks of the matrix with and without the right-hand sides tell the rest: different ranks mean the equations contradict each other, equal ranks mean they repeat each other. Results are rounded to six significant digits. Sources: OpenStax College Algebra 2e, sections 7.1, 7.2 and 7.8.
Worked example
Solve 2x + 1y = 5 and 1x − 1y = 1.
- Determinant: D = 2 × (−1) − 1 × 1 = −3.
- Dₓ = −6 and D_y = −3, from Cramer's rule.
- x = Dₓ ÷ D = 2 and y = D_y ÷ D = 1.
x = 2, y = 1.
Frequently asked questions
How do I enter an equation with variables on both sides?
Move all variable terms to the left and the constant terms to the right first. Enter a coefficient of zero for any variable that is absent.
Which method should I use by hand: substitution, elimination or Cramer's rule?
All give the same answer. Substitution is quick when one variable has the coefficient 1, elimination works well for any system, and Cramer's rule is a neat formula for two or three unknowns.
How can I check the solution?
Substitute the reported values into every original equation. Each left-hand side should equal its right-hand side, allowing for rounding in the displayed solution.
Can I solve more than three equations here?
No, this solver handles two or three unknowns. Larger systems follow the same rules and are solved by Gaussian elimination.
Can I enter fractions as coefficients?
Convert them to decimals, or multiply the whole equation by a common denominator first. Multiply the right-hand side too so that the equation stays equivalent.
Next you might need
More in Math & numbers
- Percentage calculator, private, runs on your device
- Area of shapes, private, runs on your device
- Complex number calculator, private, runs on your device
- Confidence interval calculator, private, runs on your device
- Correlation and regression calculator, private, runs on your device
- Descriptive statistics calculator, private, runs on your device





