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

Cramer's Rule Calculator

Solve a square system of linear equations by Cramer's rule, up to 6 unknowns. See D, every replacement determinant, and the solution 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 every unknown, in the order the columns appear in your coefficient matrix — or, when the coefficient determinant is zero, the reason Cramer's rule cannot be applied.
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 solves a square system of linear equations using nothing but determinants. Enter the coefficient matrix and the right-hand side, and this calculator returns the value of every unknown, along with the coefficient determinant D, every column-replacement determinant, and a substitution check that puts the answer back into your original equations to prove it works. It handles 1 to 6 unknowns.

Enter one equation per line in the coefficient box, listing a coefficient for every unknown including the zeros — a missing z in an equation must be written as 0, not omitted. Then enter the constants, one per equation, in the second box. Semicolons work as row separators, and bracketed forms such as [[2,1,-1],[-3,-1,2]] are accepted.

The rule itself is one line, and it is over 270 years old — Gabriel Cramer published it in 1750. Let D be the determinant of the coefficient matrix. For each unknown, build a new matrix by replacing that unknown's column with the column of constants, and call its determinant Dk. Then the k-th unknown equals Dk divided by D. The Encyclopedia of Mathematics states the condition precisely: if the determinant D of a square system does not vanish, the system has a unique solution, and that solution is given by those ratios.

Two limits matter and both belong right next to the answer rather than buried in a FAQ. First, the system must be square: exactly as many equations as unknowns. A rectangular system has no coefficient determinant at all, so there is nothing to divide by. Second, and more subtly, D must not be zero. When D is zero the coefficient matrix is singular, its rows are linearly dependent, and the system has either no solutions or infinitely many — but Cramer's rule cannot tell you which, and this calculator says so explicitly rather than guessing. In that case row-reduce the augmented matrix instead, since the echelon form distinguishes an inconsistent system from a dependent one immediately.

Under the hood, D and every Dk are evaluated by a Laplace expansion over column subsets that uses only addition and multiplication — no division anywhere. For an integer system every determinant is therefore exact, and the single division in the whole computation is the final Dk over D. Everything is carried at 80 significant digits and rounded once, at the end, to 10 decimal places.

A note on when to actually use this. Cramer's rule is a beautiful closed form and a poor algorithm. Computing n+1 determinants of size n costs far more than simply row-reducing once, and the method is numerically unstable when D is small relative to the coefficients, which is why no numerical library implements it. It earns its place for hand computation at 2 by 2 and 3 by 3, for symbolic work where you want a formula rather than a number, and for the theoretical result that the solution of a linear system is a ratio of polynomials in the entries. Beyond about 4 unknowns, reach for elimination.

The substitution check is there for exactly that reason. Rather than asserting that the answer is right, the calculator puts the solution back into every equation and reports the largest leftover difference. If that residual is not zero, your system is ill-conditioned and the warning appears with the result.

What is cramer's rule calculator?

Cramer's rule is a closed-form solution for a square system of linear equations Ax = b, where A is an n by n matrix of coefficients, x is the vector of unknowns and b is the vector of constants. Let D = det(A). For each k from 1 to n, let Dk be the determinant of the matrix formed by replacing the k-th column of A with b. If D is not zero, the system has exactly one solution and it is given by x_k = Dk / D. If D is zero, the coefficient matrix is singular, the rule does not apply, and the system has either no solution or infinitely many — the rule gives no way to distinguish those two cases. The rule follows directly from the adjugate formula for the inverse: since A inverse = adj(A)/det(A) and x = A inverse times b, the k-th component of adj(A) times b turns out to be exactly Dk, so dividing by det(A) reproduces the ratio. Cramer published it in 1750. It remains the standard hand method for 2 by 2 and 3 by 3 systems and the standard theoretical statement that a linear system's solution is a ratio of determinants, but it is not used computationally: evaluating n+1 determinants is far more expensive than a single Gaussian elimination, and the method is numerically unstable for small D.

How to use this calculator.

  1. Type your coefficient matrix into the first box, one equation per line. Write a coefficient for every unknown, using 0 where an unknown does not appear.
  2. Type the constants — the numbers on the right of the equals signs — into the second box, one per equation.
  3. The system must be square: the same number of equations as unknowns. If it is not, the calculator says so rather than guessing.
  4. Read the solution: x1 is the first unknown, x2 the second, and so on, in the same column order as your coefficient matrix.
  5. Check D, the coefficient determinant. If it is zero, Cramer's rule does not apply and you should row-reduce the augmented matrix instead.
  6. Read the replacement determinants D1, D2 and so on to see the working — each one is D with a single column swapped for the constants.
  7. Read the substitution check, which puts the solution back into every equation and reports the largest leftover difference.

The formula.

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

Write the system as Ax = b with A square. Set D = det(A). For each unknown k, form a new matrix by taking A and replacing its k-th column with the constants b, and let Dk be that matrix's determinant. Cramer's rule says x_k = Dk / D, valid whenever D is not zero. For the worked system — 2x + y - z = 8, -3x - y + 2z = -11, -2x + y + 2z = -3 — the coefficient matrix is [[2,1,-1],[-3,-1,2],[-2,1,2]] and expanding along its first row gives D = 2(-2-2) - 1(-6+4) + (-1)(-3-2) = -8 + 2 + 5 = -1. Replacing the first column with (8, -11, -3) and expanding gives D1 = 8(-4) - 1(-22+6) + (-1)(-11-3) = -32 + 16 + 14 = -2, so x = D1/D = -2/-1 = 2. Replacing the second column instead gives D2 = -3 and y = 3; replacing the third gives D3 = 1 and z = -1. Why it works: the adjugate formula says A inverse = adj(A)/det(A), so x = A inverse b = adj(A)b/det(A). Writing out the k-th component of adj(A)b and comparing it with the cofactor expansion of the column-replaced matrix shows the two are the same sum — the numerator IS Dk. That is also the cleanest way to check the answer by a genuinely different route, and doing so for this system reproduces (2, 3, -1) exactly. Every determinant here is evaluated by a division-free Laplace expansion over column subsets, so for an integer system D and all the Dk are exact integers; the only division performed is the final Dk over D. All arithmetic runs at 80 significant digits and is rounded once, at the end, to 10 decimal places. The singular / non-singular decision is made on D as displayed after that rounding, so the verdict beside the number can never contradict the number itself.

A worked example.

Example

Take the system 2x + y - z = 8, -3x - y + 2z = -11, and -2x + y + 2z = -3. The coefficient matrix is A = [[2, 1, -1], [-3, -1, 2], [-2, 1, 2]] and the constants are (8, -11, -3). Expanding A along its first row gives D = 2 times (-2 - 2) minus 1 times (-6 + 4) plus (-1) times (-3 - 2) = -8 + 2 + 5 = -1. Because D is not zero, Cramer's rule applies and there is exactly one solution. Now replace the first column of A with the constants and take the determinant: D1 = 8(-4) - 1(-22 + 6) + (-1)(-11 - 3) = -32 + 16 + 14 = -2. Replacing the second column instead gives D2 = 2(-22 + 6) - 8(-6 + 4) + (-1)(9 - 22) = -32 + 16 + 13 = -3, and replacing the third gives D3 = 2(3 + 11) - 1(9 - 22) + 8(-3 - 2) = 28 + 13 - 40 = 1. Dividing each by D = -1 gives the solution x1 = 2, x2 = 3 and x3 = -1. The substitution check confirms it: 2(2) + 1(3) + (-1)(-1) = 4 + 3 + 1 = 8, matching the first constant; -3(2) + (-1)(3) + 2(-1) = -6 - 3 - 2 = -11, matching the second; and -2(2) + 1(3) + 2(-1) = -4 + 3 - 2 = -3, matching the third. The largest leftover difference across all three equations is 0, so the solution satisfies the system exactly.

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

Frequently asked questions.

When can you not use Cramer's rule?
In two situations. First, if the system is not square — if you have more equations than unknowns or fewer — there is no coefficient determinant at all, so the rule has nothing to divide by. Second, if the coefficient determinant D is zero. In that case the coefficient matrix is singular, its rows are linearly dependent, and the system has either no solution or infinitely many. Cramer's rule cannot distinguish those two outcomes, which is why this calculator states the limitation rather than guessing; row-reducing the augmented matrix tells you immediately which case you are in.
What does it mean when D equals zero but the Dk are not zero?
It proves the system is inconsistent — no solution at all. That direction is a theorem, not a heuristic: if some x solved the system, multilinearity of the determinant would force every Dk to equal x_k times D, which is zero, so a single non-zero Dk rules every solution out. The page's verdict is driven by D alone, so it still shows the general D = 0 message — but the replacement determinants are reported precisely so you can apply this sharper test yourself. The reverse pattern proves nothing: when D and every Dk are all zero the system may be dependent with infinitely many solutions, yet it can also still be inconsistent — three copies of x + y + z on the left with three different right-hand sides gives all-zero determinants and no solution. In that all-zero case, row-reduce the augmented matrix and compare the rank of the coefficient matrix with the rank of the augmented matrix: if they differ the system is inconsistent; if they agree but are below the number of unknowns, there are infinitely many solutions.
How do you use Cramer's rule for a 3x3 system?
Compute four determinants. First D, the determinant of the coefficient matrix. Then, for each unknown in turn, swap that unknown's column of coefficients for the column of constants and take the determinant of the result, giving D1, D2 and D3. The unknowns are then D1/D, D2/D and D3/D. The most common mistake is replacing a row instead of a column — it is always the column belonging to the unknown you are solving for.
Is Cramer's rule actually used in practice?
Almost never for numerical work. Computing n+1 determinants costs far more than a single Gaussian elimination — the gap grows explosively with n — and the method is numerically unstable when D is small relative to the coefficients, so no serious linear-algebra library implements it. Where it does earn its place is in hand computation at 2 by 2 and 3 by 3, in symbolic work where you want a formula in the entries rather than a number, and in theory, where it establishes that the solution of a linear system is a ratio of polynomials in the coefficients.
Why does the calculator substitute the answer back in?
Because a division by a very small D can produce a plausible-looking answer that does not actually satisfy the equations, and asserting correctness is weaker than demonstrating it. The calculator puts the solution back into every equation, computes how far each left-hand side lands from its constant, and reports the largest of those differences. For a well-conditioned integer system it is exactly zero. If it is not, that is your signal the system is ill-conditioned and the answer needs care.
How is Cramer's rule related to the matrix inverse?
They are the same theorem written two ways. The adjugate formula gives A inverse = adj(A) divided by det(A), and multiplying that by b gives x = adj(A)b / det(A). Writing out the k-th component of adj(A)b and comparing it to the cofactor expansion of the column-replaced matrix shows the two sums are identical — the numerator is exactly Dk. So Cramer's rule is what you get when you expand the adjugate formula for a specific right-hand side instead of computing the whole inverse matrix.

In this category

Embed

Quanta Pro

Paid features are coming later.

  • All 977 calculators remain free
  • No billing is enabled
Coming soon