Cramer’s rule is a formula-based method for solving small systems of linear equations using determinants. It works for square systems, where the number of equations equals the number of unknowns, and the determinant of the coefficient matrix is nonzero. This calculator focuses on the most practical cases: 2×2 and 3×3 systems.
Write a system of n equations in matrix form as:
Here, is the coefficient matrix, is the column vector of unknowns, and is the column vector of constants on the right-hand side.
If the determinant of , written , is not zero, Cramer’s rule gives each unknown as a ratio of determinants. For a 3×3 system with variables , the formulas are:
where is the determinant of the original coefficient matrix, and , , and are determinants of matrices where the corresponding column has been replaced by the constants vector .
The calculator expects your system in the following standard form:
a11 x + a12 y + a13 z = b1a21 x + a22 y + a23 z = b2a31 x + a32 y + a33 z = b3The entries a11, a12, etc., are the coefficients that multiply each variable; b1, b2, and b3 are the constants on the right-hand side. The solver:
aij values you enter.b1, b2, and b3 into the corresponding column.If the main determinant is exactly zero (or numerically extremely close to zero), the solver will report that there is no unique solution and Cramer’s rule does not apply.
For a 2×2 system with variables and , write your equations as:
a11 x + a12 y = b1a21 x + a22 y = b2In the form:
a11, a12, and b1 from the first equation.a21, a22, and b2 from the second equation.a13, a23, a31, a32, a33, and b3 as zero or blank. The solver will treat the missing third row and column appropriately for a 2-variable system.For a 2×2 system, Cramer’s rule simplifies to the familiar formulas:
The calculator handles these determinant computations for you automatically.
For three variables , arrange your equations as:
a11 x + a12 y + a13 z = b1a21 x + a22 y + a23 z = b2a31 x + a32 y + a33 z = b3Then map each coefficient directly into the corresponding field. All nine aij entries and the three bi entries may be nonzero for a fully 3-dimensional problem.
Consider the system:
3x + 4y = 72x − y = 1Map this into the form:
a11 = 3, a12 = 4, b1 = 7a21 = 2, a22 = -1, b2 = 1Leave the remaining fields blank or zero. The determinant of the coefficient matrix is:
det(A) = 3 ⋅ (-1) − 4 ⋅ 2 = -11.
Replacing the first column with b gives det(A_x) = -11, and replacing the second column gives det(A_y) = -11. So:
x = det(A_x) / det(A) = (-11)/(-11) = 1
y = det(A_y) / det(A) = (-11)/(-11) = 1
If you enter these numbers into the calculator, it will display the same solution.
Suppose three products share a common resource, and we model their relationships as:
2x + y + z = 4x + 3y - z = 33x - y + 2z = 7Enter the coefficients and constants as:
a11 = 2, a12 = 1, a13 = 1, b1 = 4a21 = 1, a22 = 3, a23 = -1, b2 = 3a31 = 3, a32 = -1, a33 = 2, b3 = 7The calculator builds the 3×3 matrix, computes its determinant and the three replacement determinants, then reports the unique solution for x, y, and z. You can change a single coefficient (for example, adjust a23) to see how sensitive the solution is to that entry.
The output gives the numerical values of the variables, along with information about the determinant:
In sensitive cases, consider rescaling your variables, using higher-precision arithmetic, or solving the system with a more numerically stable method such as Gaussian elimination.
| Method | Best for | Advantages | Limitations |
|---|---|---|---|
| Cramer’s rule (this solver) | 2×2 and 3×3 systems | Direct formulas; conceptually simple; good for hand calculations and teaching determinants. | Computationally expensive for large systems; unstable if the determinant is very small. |
| Gaussian elimination | Medium to large systems | Scales efficiently; foundation of many numerical solvers for linear equations. | More algorithmic; less transparent as a closed-form formula. |
| Matrix inversion | Repeatedly solving systems with the same matrix | Once is known, solving new right-hand sides is fast. | Computing the inverse can be expensive and is unnecessary if you only need a single solution. |
For larger systems or more advanced numerical work, consider using a general linear systems solver based on Gaussian elimination or an LU decomposition method, and a dedicated determinant calculator when you only need determinants.