Cramer's Rule Calculator
Solve 2 or 3 linear equations with Cramer’s rule. Enter coefficients and constants to get x, y, and z when a unique solution exists.
Enter the Details
a₁x + b₁y = c₁
a₂x + b₂y = c₂
First equation
Second equation
Result will appear here...
What this calculator does
Cramer's rule is a slick way to solve a system of equations using nothing but determinants, one determinant for each unknown. Its neatest feature is that you can find a single variable directly, without solving for the others first. This applies it to systems of 2 or 3 equations.
Enter the equations and it returns the values of the unknowns. It runs right here in the browser.
Using the calculator
- Choose 2 or 3 equations.
- Enter each equation's coefficients and its constant term.
- Press Calculate.
It returns the solution, the value of each variable. Reset clears everything.
What Cramer's rule is
The idea rests entirely on the determinant. Write the system as a coefficient matrix with a column of constants on the side. Cramer's rule says each variable is a ratio of two determinants: on the bottom, the determinant of the plain coefficient matrix; on top, the same determinant but with that variable's column swapped out for the column of constants.
So to find x, you replace the x column with the constants and take the determinant, then divide by the determinant of the original coefficients. To find y, you swap the y column instead. Each unknown gets its own determinant on top, all sharing the same one on the bottom.
The formula, for two equations
For the system a1x + b1y = c1 and a2x + b2y = c2, call the main coefficient determinant D. Then:
D = a1·b2 − b1·a2
x = (c1·b2 − b1·c2) ÷ D y = (a1·c2 − c1·a2) ÷ D
The top of the x fraction is D with the first column replaced by the constants c, and the top of the y fraction is D with the second column replaced. The three-equation case works exactly the same way, just with 3 by 3 determinants.
The one condition it needs
Look at those fractions and the catch is plain: everything is divided by D, so D must not be zero. If the main determinant comes out as zero, Cramer's rule cannot give an answer, and that is not a failure of the method, it is telling you something true about the system. A zero determinant means the equations are not independent: either they describe the same or parallel lines, giving no single solution, so the system has either infinitely many solutions or none at all. A nonzero determinant guarantees exactly one solution, which is when Cramer's rule shines.
A worked example
Solve x + y = 5 and x − y = 1.
- Main determinant: D = (1)(-1) − (1)(1) = -1 − 1 = -2. Not zero, so there is a unique solution.
- For x, replace the first column with the constants (5, 1): (5)(-1) − (1)(1) = -6. So x = -6 ÷ -2 = 3.
- For y, replace the second column with the constants: (1)(1) − (5)(1) = -4. So y = -4 ÷ -2 = 2.
The solution is x = 3, y = 2. That is the very same answer the row reduction method reaches for this system, by a completely different path, which is a nice reassurance that both methods are sound.
When to use it, and when not to
Cramer's rule is elegant and, for two or three equations, genuinely handy, especially when you only need one of the variables and would rather not solve the whole system. Its weakness shows up as systems get bigger. Solving n equations needs n plus one determinants of size n, and that work grows fast. By four or five equations, row reduction or the matrix inverse is far quicker. So think of Cramer's rule as the sharp tool for small systems, not the workhorse for large ones.
Questions people ask
What is Cramer's rule?
A method for solving a system of linear equations using determinants, where each unknown is a ratio of two determinants of the coefficient matrix.
What is the formula?
Each variable equals the determinant of the coefficient matrix with that variable's column replaced by the constants, divided by the plain coefficient determinant.
What if the determinant is zero?
Then Cramer's rule cannot be used. A zero determinant means the system has no unique solution, either none or infinitely many.
Can I solve for just one variable?
Yes, that is a real strength of it. Each variable has its own determinant formula, so you can find one without touching the others.
Is it efficient for large systems?
No. It needs a determinant for each unknown, which becomes slow beyond three equations. Row reduction or the matrix inverse is better for larger systems.
References
A note on where this comes from. Cramer's rule expresses the unique solution of a square system as ratios of determinants. It is named after the Swiss mathematician Gabriel Cramer, who published it for any number of unknowns in 1750 in his Introduction à l'Analyse des lignes Courbes algébriques, though Colin Maclaurin had shown special cases a little earlier. For further reading, see Cramer's rule.
- Gabriel Cramer, Introduction à l'Analyse des lignes Courbes algébriques (1750), which published the rule for any number of unknowns.
- Colin Maclaurin, who published special cases of the rule around 1748.
Okan Atalay is a results driven senior operations manager and a graduate of Industrial Engineering from Bilkent University. With over 22 years of experience in textile manufacturing and integrated operations, he has led large scale business process improvements and strategic planning initiatives. Currently, he serves as a top mathematics expert for a global ed tech platform, where he applies his analytical expertise to solve complex mathematical problems. At Eon Tools, he reviews converter and maths tools.