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
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.
- 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.
- Type the constants — the numbers on the right of the equals signs — into the second box, one per equation.
- The system must be square: the same number of equations as unknowns. If it is not, the calculator says so rather than guessing.
- Read the solution: x1 is the first unknown, x2 the second, and so on, in the same column order as your coefficient matrix.
- Check D, the coefficient determinant. If it is zero, Cramer's rule does not apply and you should row-reduce the augmented matrix instead.
- 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.
- Read the substitution check, which puts the solution back into every equation and reports the largest leftover difference.
The formula.
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.
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.
Frequently asked questions.
When can you not use Cramer's rule?
What does it mean when D equals zero but the Dk are not zero?
How do you use Cramer's rule for a 3x3 system?
Is Cramer's rule actually used in practice?
Why does the calculator substitute the answer back in?
How is Cramer's rule related to the matrix inverse?
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.
In this category
Embed
Quanta Pro
Paid features are coming later.
- All 977 calculators remain free
- No billing is enabled