Cramer's Rule Solver

JJ Ben-Joseph headshot JJ Ben-Joseph

Introduction: Cramer’s rule for small linear systems

This Cramer's rule calculator solves small square linear systems by turning each equation into determinant ratios. It is most useful when you want a transparent answer for a 2×2 or 3×3 system and you can write the equations in standard linear form.

For Cramer’s rule, write a system of n equations in matrix form as:

Formula: A · x = b

A·x=b

In this Cramer's rule setup, A is the coefficient matrix, x is the column vector of unknowns, and b is the column vector of constants on the right-hand side.

If the determinant of A, written det(A), is not zero, Cramer’s rule gives each unknown as a ratio of determinants. For a 3×3 system with variables x,y,z, the formulas are:

Formula: x = D_x / D, y = D_y / D, z = D_z / D

x = Dx D , y = Dy D , z = Dz D

where D is the determinant of the original coefficient matrix, and Dx, Dy, and Dz are determinants of matrices where the corresponding column has been replaced by the constants vector b.

How this Cramer’s rule solver works

This Cramer's rule solver reads the coefficients you enter, builds the coefficient matrix, and checks whether the determinant is nonzero before it tries to divide.

The 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:

  1. Builds the coefficient matrix A from the aij values you enter.
  2. Computes the determinant det(A).
  3. Constructs the replacement matrices for each variable by swapping in the constants b1, b2, and b3 into the corresponding column.
  4. Computes the determinants of those replacement matrices.
  5. Divides each replacement determinant by the main determinant to produce the solution.

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.

How to use: Solving a 2×2 system with Cramer’s rule

For a 2×2 Cramer's rule problem with variables x and y, write your equations as:

In this 2×2 form:

For a 2×2 system, Cramer’s rule simplifies to the familiar formulas:

D = a11*a22 - a12*a21

x = (b1*a22 - a12*b2) / D

y = (a11*b2 - b1*a21) / D

The calculator handles these determinant computations for you automatically.

Using the solver for 3×3 linear systems

For a 3×3 Cramer's rule system, arrange the coefficients for x,y,z across the three rows before entering them into the solver.

Then 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.

Worked 2×2 Cramer’s rule example

Here is a simple 2×2 Cramer's rule system you can mirror in the calculator:

Map this into the form:

Leave 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.

Worked 3×3 Cramer’s rule example (applied)

This 3×3 Cramer's rule example shows how the solver behaves when all three variables interact through the same set of coefficients.

Enter the coefficients and constants as:

The 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.

Interpreting the Cramer's rule results

After you solve a Cramer's rule system, the output shows both the variable values and the main determinant that controls whether those values are valid:

In sensitive Cramer's rule cases, check that the equations were entered with the correct signs and row order, and consider rescaling the coefficients or switching to a more numerically stable linear algebra method if the determinant is nearly zero.

Comparison with other methods

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 A-1 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.

Cramer’s rule assumptions and limitations

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.

Formula: how the Cramer’s rule solution is assembled

For this Cramer's rule solver, the reported x, y, and z values come from determinant ratios rather than a generic black-box formula. Enter each coefficient into the matching aij field and each constant into the matching bi field, keeping the rows in the same order as the equations. The calculator decides whether it is solving a 2×2 or 3×3 system by looking at whether the third row and third column are left blank or set to zero.

Enter the Cramer's rule coefficients and constants for a 2×2 or 3×3 system.

Arcade Mini-Game: Cramer's Rule Coefficient Check

Use this quick arcade run to practice matching coefficients to the right equation row and avoiding sign mistakes before you solve a system.

Score: 0 Timer: 30s Best: 0

Start the game, then use your pointer or arrow keys to catch coefficient entries that belong in the matrix and avoid misleading shortcuts.