Cramer's Rule Calculator - Solve 2x2 and 3x3 Systems
Enter the coefficients of your linear system and this calculator applies Cramer's rule to find x, y and z. It computes the main determinant and each variable's determinant, then shows each step of the working so you can follow the arithmetic. Supports 2x2 and 3x3 systems and flags when the determinant is zero (no unique solution).
What is Cramer's rule?
Cramer's rule is an explicit formula for solving a system of n linear equations with n unknowns, provided the coefficient matrix is square and its determinant is not zero. Each unknown is found as a ratio of two determinants: the denominator is always the determinant of the full coefficient matrix (called D), and the numerator is the determinant obtained by replacing the column corresponding to that unknown with the column of constants on the right-hand side. For a 2x2 system ax + by = e and cx + dy = f, the solutions are x = (ed - bf) / (ad - bc) and y = (af - ce) / (ad - bc). For a 3x3 system the same idea extends to three determinants D_x, D_y and D_z, each a 3x3 matrix.
How to use this calculator
Select whether you have a 2-variable or 3-variable system. Then enter the coefficients from each equation: the numbers multiplying x, y and z, followed by the constant on the right-hand side. The calculator computes the main determinant D and the determinants D_x, D_y (and D_z for 3x3 systems), divides each by D to get the solution, and displays every step of the working. If D equals zero the calculator tells you whether the system has no solution (inconsistent) or infinitely many solutions (dependent).
Step-by-step: the 3x3 case
Given the system a1*x + b1*y + c1*z = d1, a2*x + b2*y + c2*z = d2, a3*x + b3*y + c3*z = d3, you first compute D as the determinant of the 3x3 coefficient matrix [a1 b1 c1 / a2 b2 c2 / a3 b3 c3]. Then D_x replaces the first column with [d1 d2 d3], D_y replaces the second column, and D_z replaces the third column. The solution is x = D_x/D, y = D_y/D, z = D_z/D. The 3x3 determinant is expanded along the first row: det = a1*(b2*c3 - c2*b3) - b1*(a2*c3 - c2*a3) + c1*(a2*b3 - b2*a3).
When Cramer's rule does not apply
If the main determinant D is zero, the system is either inconsistent (no solution at all) or dependent (infinitely many solutions). You can tell which case you are in by checking the variable determinants: if D_x, D_y and D_z are all also zero, the equations are linearly dependent and there are infinitely many solutions; if any variable determinant is non-zero, the equations contradict each other and there is no solution. In either case you need Gaussian elimination or another method to fully characterise the solution set. Cramer's rule also becomes computationally expensive for large systems: it is most practical for 2x2 and 3x3 systems, which is why this calculator covers those two sizes.
Cramer's Rule solution types
| Main determinant D | Variable determinants | Solution type | Geometric meaning |
|---|---|---|---|
| D not 0 | Any value | Unique solution | Lines / planes intersect at one point |
| D = 0 | All also 0 | Infinitely many solutions | Lines / planes coincide or overlap |
| D = 0 | At least one not 0 | No solution | Lines / planes are parallel, never meet |
Determined by the value of the main determinant D and the variable determinants.
Frequently asked questions
What is Cramer's rule used for?
Cramer's rule solves a square system of linear equations by expressing each unknown as a ratio of determinants. It is particularly useful when you need an explicit closed-form formula for one specific variable without solving the entire system, or when studying how the solution changes as the constants on the right-hand side change. In practice, it is most efficient for 2x2 and 3x3 systems.
What happens when the determinant D equals zero?
A zero determinant means the coefficient matrix is singular, so the system does not have a unique solution. If all the variable determinants (D_x, D_y, D_z) are also zero, the equations are dependent and there are infinitely many solutions. If at least one variable determinant is non-zero, the system is inconsistent and has no solution. In both cases, Gaussian elimination is the recommended next step.
How do I set up the matrix for Cramer's rule?
Write your system in standard form: all variable terms on the left and constants on the right. The coefficient matrix has the coefficients of x in the first column, y in the second, and z in the third (for a 3x3 system). The constant vector is the right-hand side. Enter those numbers into this calculator and it handles the rest.
Can Cramer's rule solve systems larger than 3x3?
Yes, mathematically Cramer's rule works for any n-variable system, but the number of determinant calculations grows factorially with n. A 4x4 system requires five 4x4 determinants, each involving 24 multiplications. For systems of four or more equations, Gaussian elimination or LU decomposition are far more efficient and are preferred in practice.
How do I verify my answer?
Substitute x, y and z back into each original equation and check that the left-hand side equals the right-hand side. For example, if your first equation is 2x + y - z = 8 and you got x = 2, y = 3, z = -1, check: 2(2) + 3 - (-1) = 4 + 3 + 1 = 8. This is the most reliable way to confirm a correct solution.