Cramer's Rule Calculator
Solve a square system of up to six linear equations with Cramer's rule: get D, every column-swapped determinant and the answer checked by substitution.
Cramer's Rule Calculator
Background.
Cramer's rule turns a system of linear equations into fractions that all share one denominator. The denominator is D, the determinant of the coefficient matrix. Each numerator is the determinant of that same matrix with one column swapped for the right-hand-side constants: swap the x column to get the numerator for x, the y column for y, and so on. For two equations, ax + by = e and cx + dy = f, the whole method is x = (ed − bf)/(ad − bc) and y = (af − ce)/(ad − bc).
Enter the coefficients and constants of a square system with up to six unknowns and you get every unknown, the coefficient determinant, each column-swapped determinant and a check that substitutes the answer back into your equations. The determinants are expanded using nothing but multiplication and addition, so integer coefficients give exact integer determinants and the only division is the final one.
There is one precondition, and it is easy to forget: D must not be zero. A zero determinant means the equations are not independent, with at least one row a combination of the others, and the system then has either no solution or infinitely many. Cramer's rule alone cannot say which. Row reduction of the augmented matrix can, and the column-swapped determinants often settle it too.
Gabriel Cramer published the rule in 1750, and it is still the standard way to write the solution of a linear system as a formula. As a way of grinding out numbers it is poor: n unknowns need n + 1 determinants of size n, far more work than a single pass of Gaussian elimination, and a tiny D magnifies any rounding in the coefficients. For two or three unknowns worked by hand, for symbolic answers, and for checking a result found another way, it is the right tool.
What is cramer's rule calculator?
Cramer's rule is a closed-form solution of a square linear system Ax = b, where A is the n × n matrix of coefficients, x the column of unknowns and b the column of constants. Writing D = det(A) and D_k for the determinant of A with its k-th column replaced by b, the rule states that whenever D ≠ 0 the system has exactly one solution, x_k = D_k ÷ D for each k from 1 to n. When D = 0 the rule is silent.
How to use this calculator.
- Line your equations up so the unknowns appear in the same order in each and the constant sits on the right: 2x + y − z = 8 becomes the row 2, 1, -1 with constant 8.
- Type one row per line in the coefficient box, writing 0 wherever an unknown is absent. Semicolons between rows, or bracketed rows such as [[2,1],[3,4]], work too.
- Enter the constants in the same order as the equations, separated by commas, exactly one per equation.
- Use decimals or scientific notation (0.5, 2e3) rather than fractions. Better still, multiply any equation with fractions through by its common denominator so every coefficient is a whole number.
- Read D first. If it is 0 there is no unique solution, and the list D1, D2… tells you whether the system is certainly inconsistent.
The formula.
Let a_1, …, a_n be the columns of A. If x solves the system, then b = x_1a_1 + x_2a_2 + … + x_na_n. Put that expression in place of column k and expand, using the fact that a determinant is linear in each column: every term except one contains some column twice and therefore vanishes, and the survivor is x_k times det(A). So D_k = x_k·D for every k, and dividing by a non-zero D gives x_k = D_k ÷ D. The same identity explains the zero case: if D = 0 and any D_k is not zero, no x can exist. Written another way, x = A⁻¹b = adj(A)·b ÷ det(A), and the k-th entry of adj(A)·b is exactly D_k, so Cramer's rule is the inverse-matrix formula applied to one right-hand side. Determinants here are computed by cofactor expansion, which uses only products and sums, then each D_k is divided by D and the results are shown to 10 decimal places. The decision about whether D is zero is made on that displayed value: any |D| below 5 × 10⁻¹¹ counts as zero.
A worked example.
The example system is 2x + y − z = 8, −3x − y + 2z = −11 and −2x + y + 2z = −3. Expanding the coefficient matrix along its top row: D = 2[(−1)(2) − (2)(1)] − 1[(−3)(2) − (2)(−2)] + (−1)[(−3)(1) − (−1)(−2)] = 2(−4) − 1(−2) − 1(−5) = −8 + 2 + 5 = −1. Swapping the constants into the first column and expanding the same way gives D1 = 8(−4) − 1(−16) − 1(−14) = −32 + 16 + 14 = −2. The second column gives D2 = 2(−16) − 8(−2) − 1(−13) = −3, and the third gives D3 = 2(14) − 1(−13) + 8(−5) = 1. With D = −1, each division just flips the sign of its numerator: x1 = 2, x2 = 3, x3 = −1. Putting those back into the first equation gives 4 + 3 + 1 = 8, the second −6 − 3 − 2 = −11 and the third −4 + 3 − 2 = −3, so every equation balances with nothing left over.
Frequently asked questions.
What does it mean if D is zero but one of the column-swapped determinants is not?
If D and every D_k are zero, does the system have infinitely many solutions?
What is the quickest way to do a 3×3 system by hand?
Why is Cramer's rule not used to solve large systems?
Why does a solvable system with very small coefficients show no unique solution?
How do I enter an equation that has fractions in it?
References& sources.
- [1]Encyclopedia of Mathematics (EMS Press), 'Cramer rule'. States that 'if the determinant D of a square system of linear equations does not vanish, then the system has a unique solution', given by x_k = D_k / D where D_k replaces the k-th column with the column of constant terms. Attributed to G. Cramer, 1750. Retrieved 2026-07-29.
- [2]Encyclopedia of Mathematics (EMS Press), 'Determinant'. Source for the Laplace expansion used to evaluate D and every replacement determinant, and for the criterion that a square matrix is invertible if and only if its determinant is not zero. Retrieved 2026-07-29.
- [3]LAPACK Users' Guide, 3rd ed. (SIAM, 1999), section 2.3. Provides the full-rank vocabulary — rank(A) = min(m,n) is full rank — that makes 'exactly one solution' precise for a square system. Retrieved 2026-07-29.
- [4]Golub, G. H. & Van Loan, C. F. (2013). Matrix Computations, 4th ed., Johns Hopkins University Press, chapter 3. Establishes Gaussian elimination as the practical route for solving linear systems and the standing position that Cramer's rule is a closed form rather than a usable algorithm. Print reference; publisher page linked.
How this page was produced
- Published by
- Quanta Calculator
- Overseen by
- Daniel, Quanta Calculator Researcher
- Primary sources
- 4 cited below
- Method
- xₖ = Dₖ ⁄ D , D = det(A) ≠ 0
- Published
- Last verified
Built with AI assistance and verified by automated tests against the cited sources — every worked example on this page is computed by the same code that runs the calculator. How we build and check calculators.
In this category
Embed
Quanta Pro
Paid features are coming later.
- All 1560 calculators remain free
- No billing is enabled