Understanding the 2 × 2 system of equations solver — concept and principle
A system of two linear equations in two unknowns, a₁x + b₁y = c₁ and a₂x + b₂y = c₂, asks for the pair (x, y) that satisfies both equations at the same time. Geometrically each equation is a straight line, and the solution is the point where the lines cross. Such systems come up in mixture and pricing problems, break-even comparisons, supply and demand, and any situation with two unknown amounts linked by two conditions.
How it is calculated
The solver uses Cramer's rule:
- Determinant D = a₁b₂ − b₁a₂.
- x = (c₁b₂ − b₁c₂) ÷ D.
- y = (a₁c₂ − c₁a₂) ÷ D.
If D = 0 the calculator reports "no unique solution". The numerators are themselves determinants: replace the x-column (for x) or the y-column (for y) of the coefficient matrix with the right-hand sides c₁, c₂.
The principle
Eliminate y: multiply the first equation by b₂ and the second by b₁ and subtract. The y terms cancel and you get (a₁b₂ − b₁a₂)x = c₁b₂ − b₁c₂, which is exactly Cramer's formula for x; eliminating x in the same way gives y. The determinant D measures whether the two lines have different slopes. If D ≠ 0 they cross at exactly one point. If D = 0 the lines are parallel (no solution) or identical (infinitely many solutions). Geometrically, |D| is the area of the parallelogram spanned by the coefficient columns, and a zero area means the columns point in the same direction.
Worked example
- Inputs: 2x + 3y = 8 and x − y = −1 (a₁ = 2, b₁ = 3, c₁ = 8, a₂ = 1, b₂ = −1, c₂ = −1).
- D = 2 × (−1) − 3 × 1 = −2 − 3 = −5.
- x numerator = 8 × (−1) − 3 × (−1) = −8 + 3 = −5, so x = −5 ÷ −5 = 1.
- y numerator = 2 × (−1) − 8 × 1 = −2 − 8 = −10, so y = −10 ÷ −5 = 2.
- Result: x = 1, y = 2. Check: 2 + 6 = 8 and 1 − 2 = −1.
How to read the result
Substitute the pair into both original equations; both must hold. The sign of D has no meaning for the solution itself, but its size does: when |D| is very small compared with the coefficients, the lines are nearly parallel and the solution is very sensitive to small changes or rounding in the inputs (an ill-conditioned system).
Common mistakes
- Not writing both equations in the same order (x term, y term, constant on the right) before reading coefficients.
- Losing a sign when a term is subtracted, such as entering b₂ = 1 for x − y.
- Swapping the order in the numerators; c₁b₂ − b₁c₂ is not the same as b₁c₂ − c₁b₂.
Frequently asked questions
How do I know whether there is no solution or infinitely many when D = 0?
If the right-hand sides scale the same way as the coefficients (for example x + y = 2 and 2x + 2y = 4), the lines coincide and there are infinitely many solutions; otherwise there is none.
Is Cramer's rule better than substitution?
For 2 × 2 systems it is quick and gives a formula. For larger systems, elimination (Gauss-Jordan) is far more efficient.
Can I use it for three unknowns?
Yes, with 3 × 3 determinants, but a general n × n solver is more practical.
Sources: G. Cramer, Introduction à l'analyse des lignes courbes algébriques, Geneva, 1750 · G. Strang, Introduction to Linear Algebra, Wellesley-Cambridge Press