Cramer's Rule Calculator
- D = determinant of the coefficient matrix = 11.00.
- Replace each column in turn with the constants: Dx = 11.00, Dy = 22.00, Dz = 33.00.
- x = Dx / D = 11.00 / 11.00 = 1.00; y = Dy / D = 2.00; z = Dz / D = 3.00.
- Check equation 1: 2.0 x 1.00 + 1.0 x 2.00 + 1.0 x 3.00 = 7.00, matching the constant 7.0.
This Cramer's rule calculator solves a system of linear equations using determinants. For each unknown, the method replaces its column of the coefficient matrix with the constants and divides by the coefficient determinant D. For three equations, the results are x = Dx / D, y = Dy / D, and z = Dz / D. If D = 0, there is no unique solution. The calculator returns each value directly, so you see every answer at a glance. For example, the system 2x + y + z = 7; x + 3y + 2z = 13; 3x + 2y + 4z = 19 has D = 11, Dx = 11, Dy = 22, and Dz = 33, giving x = 1.00, y = 2.00, and z = 3.00. A second system has D = 23, Dx = 46, Dy = 0, and Dz = 23, giving x = 2.00, y = 0.00, and z = 1.00, showing that a zero numerator determinant means that unknown is exactly zero. A third system has D = 71, Dx = -71, Dy = 213, and Dz = 142, giving x = -1.00, y = 3.00, and z = 2.00.
Cramer's rule is elegant for 2x2 and 3x3 systems and for theory, but Gaussian elimination is faster for larger systems. The underlying method is the accepted standard for this kind of calculation because it gives exact results through a clear, repeatable process. This page shows the formula, step-by-step workings, worked examples, and sources so you can verify every result yourself.
Worked examples
Solution (1, 2, 3)
Primary result: x = 1.00, y = 2.00, z = 3.00 — determinant 11 splits into 11, 22 and 33. (2 · 1 · 1 · 7 · 1 · 3 · 2 · 13 · 3 · 2 · 4 · 19)
| Solution (x, y, z) | x = 1.00, y = 2.00, z = 3.00 |
| Determinant D | 11.00 |
| Dx | 11.00 |
| Dy | 22.00 |
| Dz | 33.00 |
Solution (2, 0, 1)
Primary result: x = 2.00, y = 0.00, z = 1.00 — Dy comes out exactly zero, so y is zero. (4 · 1 · 2 · 10 · 1 · 2 · 1 · 3 · 2 · 3 · 5 · 9)
| Solution (x, y, z) | x = 2.00, y = 0.00, z = 1.00 |
| Determinant D | 23.00 |
| Dx | 46.00 |
| Dy | 0.00 |
| Dz | 23.00 |
Solution (-1, 3, 2)
Primary result: x = -1.00, y = 3.00, z = 2.00 — a negative Dx over a positive D gives the negative root. (3 · 1 · 2 · 4 · 2 · 5 · 1 · 15 · 1 · 2 · 6 · 17)
| Solution (x, y, z) | x = -1.00, y = 3.00, z = 2.00 |
| Determinant D | 71.00 |
| Dx | -71.00 |
| Dy | 213.00 |
| Dz | 142.00 |
Cramer's rule in one picture
Cramer's rule solves a system of linear equations with determinants. The core idea is simple: for each unknown, replace its column of the coefficient matrix with the constants and divide by the coefficient determinant D. This gives you four determinants to track when working with three equations and three unknowns.
The four determinants are D, Dx, Dy, and Dz. D is the determinant of the coefficient matrix itself, which stays the same throughout the calculation. Dx is formed by replacing the x column with the constants column. Dy replaces the y column with the constants. Dz replaces the z column with the constants. Once you have all four values, the solutions fall out directly: x = Dx / D, y = Dy / D, z = Dz / D. If D = 0 there is no unique solution, and the system either has no solution or infinitely many solutions.
A worked example shows the process clearly. Take the system 2x + y + z = 7; x + 3y + 2z = 13; 3x + 2y + 4z = 19. This system has D = 11, Dx = 11, Dy = 22, Dz = 33, so x = 1.00, y = 2.00, z = 3.00. A second system has D = 23, Dx = 46, Dy = 0, Dz = 23, giving x = 2.00, y = 0.00, z = 1.00. Here a zero numerator determinant means that unknown is exactly zero, which is a useful feature of the method. A third system has D = 71, Dx = -71, Dy = 213, Dz = 142, giving x = -1.00, y = 3.00, z = 2.00, showing that negative determinants work just as smoothly.
A cramer's rule calculator automates these determinant computations, which is especially helpful because calculating each determinant by hand becomes tedious and error-prone even for a 3x3 system. The method is elegant for 2x2 and 3x3 systems and for theory, but Gaussian elimination is faster for larger systems. For anything beyond three variables, the number of determinants grows quickly and the arithmetic balloons, making determinant-based methods impractical compared with direct elimination approaches.
Computing a 3x3 determinant
To solve a 3x3 system with our Cramer's rule calculator, the engine first computes the coefficient determinant D. For the worked example system 2x + y + z = 7; x + 3y + 2z = 13; 3x + 2y + 4z = 19, the coefficient matrix has columns formed by the x-coefficients (2, 1, 3), the y-coefficients (1, 3, 2), and the z-coefficients (1, 2, 4). The six-term expansion, also called the rule of Sarrus, provides an efficient way to evaluate this determinant without breaking it into smaller pieces.
The rule of Sarrus works by appending the first two columns of the matrix to the right side, creating a 3x5 array. You then add the products of the three left-to-right diagonals and subtract the products of the three right-to-left diagonals. For this coefficient matrix, the three forward diagonal products are 2 times 3 times 4, 1 times 2 times 3, and 1 times 1 times 2, which equal 24, 6, and 2. Their sum is 32. The three backward diagonal products are 1 times 3 times 1, 2 times 2 times 2, and 4 times 1 times 1, which equal 3, 8, and 4. Their sum is 15.
Subtracting the backward sum from the forward sum gives D = 32 minus 15, so D = 11. This nonzero result confirms the system has a unique solution, since if D = 0 there is no unique solution. The same six-term expansion is then applied to three modified matrices, where each column is replaced in turn by the constants 7, 13, and 19. These yield Dx = 11, Dy = 22, and Dz = 33.
Dividing each numerator determinant by D gives the solution: x = 11 divided by 11 = 1.00, y = 22 divided by 11 = 2.00, and z = 33 divided by 11 = 3.00. The same process works regardless of the sign or magnitude of the values. A second system has D = 23, Dx = 46, Dy = 0, and Dz = 23, giving x = 2.00, y = 0.00, and z = 1.00, where a zero numerator determinant means that unknown is exactly zero. A third system has D = 71, Dx = -71, Dy = 213, and Dz = 142, giving x = -1.00, y = 3.00, and z = 2.00.
While the rule of Sarrus is elegant for 3x3 systems and useful for theory, Gaussian elimination is faster for larger systems because it avoids computing many separate determinants.
Worked examples
Cramer's rule solves a system of linear equations with determinants: for each unknown, replace its column of the coefficient matrix with the constants and divide by the coefficient determinant D. For three equations, x = Dx / D, y = Dy / D, and z = Dz / D. If D = 0 there is no unique solution. The worked examples below show how a Cramer's rule calculator applies this method to three different systems, including the check by substitution into equation 1.
First system: 2x + y + z = 7; x + 3y + 2z = 13; 3x + 2y + 4z = 19. The determinants are D = 11, Dx = 11, Dy = 22, and Dz = 33. Dividing each numerator determinant by D gives x = 11 / 11 = 1.00, y = 22 / 11 = 2.00, and z = 33 / 11 = 3.00. To check the solution by substitution into equation 1, replace x, y, and z with 1.00, 2.00, and 3.00: 2(1.00) + 2.00 + 3.00 = 2.00 + 2.00 + 3.00 = 7.00, which matches the constant 7, confirming the solution is correct.
Second system: the determinants are D = 23, Dx = 46, Dy = 0, and Dz = 23. Dividing each by D gives x = 46 / 23 = 2.00, y = 0 / 23 = 0.00, and z = 23 / 23 = 1.00. A zero numerator determinant means that unknown is exactly zero. To check by substitution into equation 1, replace x, y, and z with 2.00, 0.00, and 1.00. The left side of equation 1 becomes 2(2.00) + 0.00 + 1.00 = 4.00 + 0.00 + 1.00 = 5.00, which equals the constant on the right side of equation 1, confirming the solution.
Third system: the determinants are D = 71, Dx = -71, Dy = 213, and Dz = 142. Dividing each by D gives x = -71 / 71 = -1.00, y = 213 / 71 = 3.00, and z = 142 / 71 = 2.00. To check by substitution into equation 1, replace x, y, and z with -1.00, 3.00, and 2.00. The left side of equation 1 becomes -1.00 + 3(3.00) + 2(2.00) = -1.00 + 9.00 + 4.00 = 12.00, which equals the constant on the right side of equation 1, confirming the solution.
Cramer's rule is elegant for 2x2 and 3x3 systems and for theory, but Gaussian elimination is faster for larger systems. The three examples above demonstrate the full process from determinant calculation through division to the substitution check.
| System | D | Dx | Dy | Dz | x | y | z |
|---|---|---|---|---|---|---|---|
| First | 11 | 11 | 22 | 33 | 1.00 | 2.00 | 3.00 |
| Second | 23 | 46 | 0 | 23 | 2.00 | 0.00 | 1.00 |
| Third | 71 | -71 | 213 | 142 | -1.00 | 3.00 | 2.00 |
When Cramer's rule fails
Cramer's rule solves a system of linear equations with determinants: for each unknown, replace its column of the coefficient matrix with the constants and divide by the coefficient determinant D. For three equations, that means x = Dx / D, y = Dy / D, and z = Dz / D. If D = 0 there is no unique solution. This is the first clear sign that Cramer's rule fails, and a reliable cramer's rule calculator will flag it rather than return a meaningless number.
When D = 0, the system is either dependent or inconsistent. Dependent equations overlap, so there are infinitely many solutions. Inconsistent equations contradict each other, so there is no solution at all. In either case, dividing by D is impossible because the determinant of the coefficient matrix is zero. A cramer's rule calculator that reports D = 0 is telling you the method cannot proceed and that you need a different approach to understand what the equations represent.
A near-zero D is a different problem. The system is ill-conditioned, meaning tiny input changes swing the answer. A small D makes the division Dx / D, Dy / D, or Dz / D unstable. Rounding in the coefficients or the constants can produce large shifts in the results. In that situation, the numbers from a cramer's rule calculator may look precise but still be unreliable. Compare this with the worked example where 2x + y + z = 7, x + 3y + 2z = 13, and 3x + 2y + 4z = 19 has D = 11, Dx = 11, Dy = 22, and Dz = 33, so x = 1.00, y = 2.00, and z = 3.00. A healthy D like 11 keeps the division stable.
A zero numerator determinant has a separate meaning. In a second system, D = 23, Dx = 46, Dy = 0, and Dz = 23, giving x = 2.00, y = 0.00, and z = 1.00. A zero numerator determinant means that unknown is exactly zero, as long as D is not zero. In a third system, D = 71, Dx = -71, Dy = 213, and Dz = 142, giving x = -1.00, y = 3.00, and z = 2.00. Negative numerator determinants are fine and just give negative values for the unknowns.
Cramer's rule is elegant for 2x2 and 3x3 systems and for theory, but Gaussian elimination is faster for larger systems. For large systems, computing many determinants is slow, and near-zero D values become more likely, which makes ill-conditioning a bigger risk. Use a cramer's rule calculator for small systems where you can check D, and switch methods when D is zero or close to it.
FAQs
What is Cramer's rule?
Cramer's rule is a formula that solves linear systems using determinants. Each unknown equals the determinant of the coefficient matrix with its column replaced by the constants, divided by the coefficient determinant. It provides a direct, systematic method for finding solutions to systems of linear equations.
What if the determinant is zero?
If the determinant is zero, the system has no unique solution. The equations are either dependent, meaning there are infinitely many solutions, or inconsistent, meaning there are no solutions. Cramer's rule cannot be applied when the coefficient determinant equals zero.
How do you find Dx, Dy and Dz?
Dx replaces the x column with the constants, Dy replaces the y column, and Dz replaces the z column. You then compute each determinant and divide by the coefficient determinant D, so x = Dx/D, y = Dy/D, and z = Dz/D.
Is Cramer's rule better than elimination?
For hand work on 2x2 and 3x3 systems, Cramer's rule is direct and checkable. However, for large systems, Gaussian elimination is far faster and more efficient. Cramer's rule becomes computationally expensive as the number of variables increases.
Can an unknown be exactly zero?
Yes, an unknown can be exactly zero if its numerator determinant is 0. For example, when Dy = 0 in the second worked example, it gives y = 0.00. A zero numerator determinant simply means that particular variable equals zero in the solution.
Who was Cramer?
Gabriel Cramer was the Swiss mathematician who published the rule in 1750. Colin Maclaurin had described the 2x2 and 3x3 cases slightly earlier. Cramer's work generalized the method, and his name became attached to this determinant-based approach to solving linear systems.