Cramer's Rule Calculator
Test cases replayed : 4 of 4 match · Methodology · No outside source listed
Enter the coefficients of two linear equations in x and y, written as ax + by = c.
Result
x = Dx ÷ D
y = Dy ÷ D
- D = a₁b₂ − b₁a₂
- Dx = c₁b₂ − b₁c₂
- Dy = a₁c₂ − c₁a₂
- Solution type
Estimate for planning only, not tax, legal, financial or medical advice. This calculator uses the method explained on this page.
This browser did not allow copying. The sentence is in the box below, already selected: copy it with your keyboard or the menu.
How to use this calculator
Fill in the fields in this order; each step takes you to its field.
- Equation 1: coefficient of x (a₁): enter a number.
- Equation 1: coefficient of y (b₁): enter a number.
- Equation 1: right-hand side (c₁): enter a number.
- Equation 2: coefficient of x (a₂): enter a number.
- Equation 2: coefficient of y (b₂): enter a number.
- Equation 2: right-hand side (c₂): enter a number.
- Read the result: x = Dx ÷ D; the panel also shows D = a₁b₂ − b₁a₂, Dx = c₁b₂ − b₁c₂, Dy = a₁c₂ − c₁a₂, Solution type and y = Dy ÷ D.
How this calculator works
Cramer's rule (Gabriel Cramer, 1750): for a₁x + b₁y = c₁ and a₂x + b₂y = c₂, let D = a₁b₂ − b₁a₂ be the determinant of the coefficients. Replace the x column by the constants to get Dx = c₁b₂ − b₁c₂, and the y column to get Dy = a₁c₂ − c₁a₂. Then x = Dx ÷ D and y = Dy ÷ D.
The rule works only when D ≠ 0. When D = 0 and Dx or Dy is not 0, the system has no solution; when all three are 0 in a 2×2 system with non-zero rows, the two equations describe the same line. The elimination and substitution methods give the same x and y.
The formula
| Symbol | Meaning |
|---|---|
| Equation 1: coefficient of x (a₁) | |
| Equation 1: coefficient of y (b₁) | |
| Equation 1: right-hand side (c₁) | |
| Equation 2: coefficient of x (a₂) | |
| Equation 2: coefficient of y (b₂) | |
| Equation 2: right-hand side (c₂) | |
| D = a₁b₂ − b₁a₂ | |
| Dx = c₁b₂ − b₁c₂ | |
| x = Dx ÷ D |
Worked example
| Equation 1: coefficient of x (a₁) | 4 |
|---|---|
| Equation 1: coefficient of y (b₁) | -2 |
| Equation 1: right-hand side (c₁) | 6 |
| Equation 2: coefficient of x (a₂) | 1 |
| Equation 2: coefficient of y (b₂) | 3 |
| Equation 2: right-hand side (c₂) | 5 |
| D = a₁b₂ − b₁a₂ | 14 |
|---|---|
| Dx = c₁b₂ − b₁c₂ | 28 |
| Dy = a₁c₂ − c₁a₂ | 14 |
| Solution type | One solution |
| y = Dy ÷ D | 1 |
x = Dx ÷ D 2
Each step uses the unrounded value of the step before it; figures on this page are rounded for display.
Frequently asked questions
How do you solve 4x − 2y = 6 and x + 3y = 5 with Cramer's rule?
D = 4 × 3 − (−2) × 1 = 14, Dx = 6 × 3 − (−2) × 5 = 28, Dy = 4 × 5 − 6 × 1 = 14, so x = 2 and y = 1.
What if D = 0?
The lines are parallel or the same line, so there is no single solution; for 3x + 2y = 7 and 6x + 4y = 14, D, Dx and Dy are all 0 (same line).