Audited 29 Jul 2026·Last updated 28 Oct 2026·4 citations·Tier 2·0 uses

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

List a coefficient for every unknown, including the zeros.
One number per equation, separated by commas.
Solution
x1 = 2, x2 = 3, x3 = -1
The value of each unknown, x1, x2 and onward in the column order you entered, or a statement that there is no unique solution because D is zero.
Coefficient determinant D
-1
Replacement determinants D1, D2, ...
D1 = -2, D2 = -3, D3 = 1
Does Cramer's rule apply?
Unique solution — the coefficient determinant D = -1 is not zero, so the coefficient matrix has full rank and this system has exactly one solution.
Number of unknowns (n)
3
Substitution check
Substituted back into all 3 equations: every left-hand side matches its constant to 10 decimal places, so this solution satisfies the system exactly.

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.

  1. 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.
  2. 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.
  3. Enter the constants in the same order as the equations, separated by commas, exactly one per equation.
  4. 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.
  5. 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.

xₖ = Dₖ ⁄ D , D = det(A) ≠ 0

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.

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.

coefficients2, 1, -1 -3, -1, 2 -2, 1, 2
constants8, -11, -3

Frequently asked questions.

What does it mean if D is zero but one of the column-swapped determinants is not?
The system has no solution. Any solution would force every D_k to equal x_k × D, which is zero, so one non-zero D_k rules out every candidate. For x + 2y = 3 and 2x + 4y = 7, D = 0 but D1 = −2 and D2 = 1: the left sides are proportional while the right sides are not, so the two lines are parallel.
If D and every D_k are zero, does the system have infinitely many solutions?
Not necessarily. x + 2y = 3 with 2x + 4y = 6 does have infinitely many, but three copies of x + y + z with right-hand sides 1, 2 and 3 also give all zeros and has none. In that case row-reduce the augmented matrix: if its rank exceeds the coefficient matrix's rank, the system is inconsistent.
What is the quickest way to do a 3×3 system by hand?
You need four 3×3 determinants: D, then D1, D2 and D3. Compute D first, since if it is zero the rest is wasted effort. Expanding along a row or column that contains zeros saves work, and the diagonal shortcut known as Sarrus' rule works for 3×3 matrices only. Always replace a column, never a row.
Why is Cramer's rule not used to solve large systems?
Cost and accuracy. Gaussian elimination solves n equations in roughly two-thirds of n³ arithmetic operations, while Cramer's rule needs n + 1 separate determinants, each costing about as much as a full elimination when computed efficiently. When D is small relative to the coefficients, dividing by it also magnifies rounding error. That is why software solves linear systems by elimination and this tool stops at six unknowns.
Why does a solvable system with very small coefficients show no unique solution?
The zero test is applied to D as displayed, rounded to 10 decimal places, so a determinant smaller than 5 × 10⁻¹¹ reads as zero. The example system with every number scaled by 0.0001 has D = −10⁻¹² and is reported as singular. Multiply each equation, constants included, by a power of ten; the solution is unchanged.
How do I enter an equation that has fractions in it?
Clear the fractions first. x/3 + y/2 = 1 multiplied through by 6 becomes 2x + 3y = 6, which has exactly the same solutions. Whole-number coefficients keep every determinant an exact integer, whereas typing 0.3333 for one third introduces an error that the final division can enlarge.

How this page was produced

Published by
Quanta Calculator
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
Coming soon