Linear Equation Solver
Solve a system of two linear equations with two unknowns using substitution or Cramer's rule.
Did this tool work for you?
How to use this calculator
x = (c₁b₂ − c₂b₁) / D; y = (a₁c₂ − a₂c₁) / D, where D = a₁b₂ − a₂b₁ (determinant).
- 1
Write your two equations in the form ax + by = c.
- 2
Enter the coefficients a and b, and the constant c for each equation.
- 3
The solver uses Cramer's rule to find x and y.
- 4
Verification rows confirm the solution satisfies both equations.
Frequently asked questions
What form must my equations be in?
Each equation must be written as ax + by = c, with the x and y terms on the left and one constant on the right. Rewrite 2x = 5 − 3y as 2x + 3y = 5 before entering it. If an equation has no y term, enter 0 for its y coefficient. The solver handles exactly two equations in two unknowns, not three or more.
What does the determinant D tell me?
D = a₁b₂ − a₂b₁. When D is not zero there is exactly one solution, found by Cramer’s rule. When D is zero the two lines have the same slope, so they are either the same line (infinitely many solutions) or parallel (none). For the default system 2x + 3y = 8 and 5x − y = 3, D is −17 and the solution is x = 1, y = 2.
How does it tell “no solution” from “infinite solutions”?
When D is zero it compares the constants as well. 1x + 2y = 3 with 2x + 4y = 6 is the same line twice, so the result is infinite solutions. 1x + 2y = 3 with 2x + 4y = 7 has the same slope but a different offset, so there is no solution. A system such as x = 1 and 2x = 3 (y coefficients both 0) is correctly reported as having no solution, and an equation like 0x + 0y = 5 is also reported as impossible.
Can it handle decimal coefficients?
Yes. Whether a system is degenerate is judged with a very small relative tolerance, so 0.1x + 0.2y = 0.3 with 0.3x + 0.6y = 0.9 is recognised as the same line instead of being thrown off by binary rounding. Solutions are rounded to 8 decimal places, and the verification lines are rounded to 6.
What do the verification rows mean?
They substitute the computed x and y back into each original equation and show the left-hand side next to your constant. For x = 2.8 and y = 1.8 in 3x + 2y = 12 and x − y = 1, they show 12 = 12 and 1 = 1. A mismatch beyond the sixth decimal would signal numerical trouble, which is most likely when D is tiny compared with the coefficients.
Why does a nearly parallel system give odd-looking answers?
If D is very small but not zero, the lines meet very far away and tiny changes in the coefficients move the solution a great deal. The answer is still correct for the numbers entered; the issue is that the problem itself is sensitive.
Does it show the working step by step?
No. It reports the determinant, x, y and the two checks, but not elimination or substitution steps. The formulas used are x = (c₁b₂ − c₂b₁) ÷ D and y = (a₁c₂ − a₂c₁) ÷ D, so you can reproduce any result by hand.
Linear equation solver — two equations, two unknowns by Cramer’s rule
How the system is solved
Enter a₁, b₁, c₁ for the first equation and a₂, b₂, c₂ for the second, each in the form ax + by = c. The solver computes the determinant D = a₁b₂ − a₂b₁. If D is not zero, x = (c₁b₂ − c₂b₁) ÷ D and y = (a₁c₂ − a₂c₁) ÷ D. If D is zero it inspects the constants to decide between no solution and infinitely many.
| Situation | Geometry | Example input | Result |
|---|---|---|---|
| D ≠ 0 | Lines cross once | 2x + 3y = 8; 5x − y = 3 | x = 1, y = 2 |
| D = 0, constants proportional | Same line | 1x + 2y = 3; 2x + 4y = 6 | Infinite solutions |
| D = 0, constants not proportional | Parallel lines | 1x + 2y = 3; 2x + 4y = 7 | No solution |
Worked example with whole numbers
Two numbers add to 10 and differ by 2. As equations: x + y = 10 and x − y = 2. Entering 1, 1, 10 and 1, −1, 2 gives D = −2, x = 6 and y = 4. The verification lines read 10 = 10 and 2 = 2, confirming that both original statements hold.
Worked example with fractions in the answer
Solve 3x + 2y = 12 and x − y = 1. The calculator returns D = −5, x = 2.8 and y = 1.8. Those are the decimal forms of 14/5 and 9/5. Substituting gives 3(2.8) + 2(1.8) = 12 and 2.8 − 1.8 = 1, which the verification rows display. Results are not converted to fractions, so convert them yourself if you need an exact rational form.
Turning word problems into equations
Pick two unknowns, then write one equation per fact. Ticket sales are a typical case: if adult tickets cost 8 and child tickets cost 5, and 20 tickets raised 130, then a + c = 20 and 8a + 5c = 130. Enter 1, 1, 20 and 8, 5, 130. Always check the answer makes sense in context; a negative or fractional count of tickets means the setup is wrong.
Edge cases handled
An equation with no y term is entered with b = 0, and the solver still works as long as the other equation involves y. Two equations that both lack y, such as x = 1 and 2x = 3, are reported as having no solution because they contradict each other. An equation of the form 0x + 0y = c with c ≠ 0 is impossible, and the solver says so rather than returning a misleading answer.
Learn more from an authoritative source:
WikipediaModulo Calculator
Calculate the remainder of division (modulo operation). Supports positive and negative numbers and shows the full division breakdown.
Rectangle Calculator
Calculate area, perimeter, diagonal, and aspect ratio of a rectangle or square.
Mean, Median & Mode Calculator
Calculate mean, median, mode, range, and variance for a set of numbers. Enter up to 20 values.
Number Sequence Calculator
Identify and continue arithmetic and geometric sequences. Find the nth term and sum of the first n terms.
Roman Numerals Converter
Convert between Roman numerals and Arabic (standard) numbers. Handles values from 1 to 3,999.
Percentage Change Calculator
Calculate percentage increase or decrease between two values. Also computes percentage difference and what value X% of a number is.
Results are estimates for informational purposes only and do not constitute professional financial, medical, legal, or technical advice. Read full disclaimer →