Skip to main content
Home
Calculating...
Home Linear Systems Cramers_Rule

Cramer's Rule Calculator: Solve Systems Using Determinants

Solve linear systems of equations using Cramer's Rule: to \(x_i = \frac{\det(A_i)}{\det(A)}\). This method works for square systems where the coefficient matrix is invertible (det ≠ 0).

Calculator

Enter your matrix below and click "Calculate" to see the step-by-step solution.

n =
Maximum size: 4×4 (determinant calculation limit)

A Coefficient Matrix A (n × n)

b Constant Vector b (n × 1)

Value
Computing determinants and solving...

Enter a square coefficient matrix A and constant vector b, then click "Apply Cramer's Rule".

Cramer's Rule shows each determinant calculation step by step.

Learn About Cramers_Rule

Understanding the concepts behind the calculations.


What is Cramer's Rule?

Cramer's Rule is an explicit formula for solving a system of linear equations with the same number of equations as unknowns. Named after Swiss mathematician Gabriel Cramer (1704-1752), this rule expresses the solution in terms of determinants of the coefficient matrix.

Key Insight: For a system Ax = b with a square invertible matrix A, each variable equals the ratio of two determinants: the determinant of a modified matrix divided by the determinant of A.

$$ \boxed{x_i = \frac{\det(A_i)}{\det(A)}} $$

Where:

  • A is the n×n coefficient matrix
  • b is the constant vector (right-hand side)
  • A_i is the matrix formed by replacing the i-th column of A with b
  • det(A) ≠ 0 (matrix must be invertible)

When to Use Cramer's Rule

✅ Ideal For:

  • 2×2 and 3×3 systems (quick calculations)
  • When you need only one variable
  • Learning the relationship between determinants and solutions
  • Theoretical proofs and derivations

❌ Not Ideal For:

  • Large systems (n > 3) - computationally expensive (O(n!))
  • When det(A) = 0 (system is singular)
  • Numerical computation with floating-point errors
  • Systems with many variables (use Gaussian elimination instead)

💡 Tip: For 2×2 and 3×3 systems, Cramer's Rule is excellent for learning. For larger systems, Gaussian elimination or LU decomposition is faster and more stable.


The Formula

For a 2×2 System

Given:

$$ \begin{cases} a_{11}x + a_{12}y = b_1 \\\\ a_{21}x + a_{22}y = b_2 \end{cases} $$

The solution is:

$$ x = \frac{\det(A_x)}{\det(A)} = \frac{\begin{vmatrix} b_1 & a_{12} \\ b_2 & a_{22} \end{vmatrix}}{\begin{vmatrix} a_{11} & a_{12} \\ a_{21} & a_{22} \end{vmatrix}}, \quad y = \frac{\det(A_y)}{\det(A)} = \frac{\begin{vmatrix} a_{11} & b_1 \\ a_{21} & b_2 \end{vmatrix}}{\begin{vmatrix} a_{11} & a_{12} \\ a_{21} & a_{22} \end{vmatrix}} $$

For a 3×3 System

Given:

$$ \begin{cases} a_{11}x + a_{12}y + a_{13}z = b_1 \\\\ a_{21}x + a_{22}y + a_{23}z = b_2 \\\\ a_{31}x + a_{32}y + a_{33}z = b_3 \end{cases} $$

The solution is:

$$ x = \frac{\det(A_x)}{\det(A)},\quad y = \frac{\det(A_y)}{\det(A)},\quad z = \frac{\det(A_z)}{\det(A)} $$

Where:

  • A_x replaces column 1 with [b₁, b₂, b₃]ᵀ
  • A_y replaces column 2 with [b₁, b₂, b₃]ᵀ
  • A_z replaces column 3 with [b₁, b₂, b₃]ᵀ

Step-by-Step Guide

Step 1: Verify the System is Square

Cramer's Rule only works when the number of equations equals the number of unknowns.

Step 2: Compute det(A)

If det(A) = 0, the system either has no solution or infinite solutions. Cramer's Rule cannot be applied.

Step 3: For Each Variable xᵢ

  1. Create matrix Aᵢ by replacing column i with the constant vector b
  2. Compute det(Aᵢ)
  3. Calculate xᵢ = det(Aᵢ) / det(A)

Step 4: Verify Your Solution

Substitute the values back into the original equations to check correctness.


Complete Examples

Example 1: 2×2 System

Problem: Solve for x and y:

$$ \begin{cases} 2x + 3y = 8 \\\\ 4x - y = 2 \end{cases} $$

Step 1: Compute det(A)

$$ \det(A) = \begin{vmatrix} 2 & 3 \\ 4 & -1 \end{vmatrix} = (2)(-1) - (3)(4) = -2 - 12 = -14 $$

Step 2: Compute det(Aₓ) (replace column 1 with constants)

$$ \det(A_x) = \begin{vmatrix} 8 & 3 \\ 2 & -1 \end{vmatrix} = (8)(-1) - (3)(2) = -8 - 6 = -14 $$

Step 3: Compute det(Aᵧ) (replace column 2 with constants)

$$ \det(A_y) = \begin{vmatrix} 2 & 8 \\ 4 & 2 \end{vmatrix} = (2)(2) - (8)(4) = 4 - 32 = -28 $$

Step 4: Calculate variables

$$ x = \frac{\det(A_x)}{\det(A)} = \frac{-14}{-14} = 1, \qquad y = \frac{\det(A_y)}{\det(A)} = \frac{-28}{-14} = 2 $$

Solution: x = 1, y = 2

Check: 2(1) + 3(2) = 8 ✓ and 4(1) - 2 = 2 ✓

Example 2: 3×3 System

Problem: Solve for x, y, and z:

$$ \begin{cases} x + y + z = 6 \\\\ 2x - y + z = 3 \\\\ x + 2y - z = 3 \end{cases} $$

Step 1: Compute det(A)

$$ \det(A) = \begin{vmatrix} 1 & 1 & 1 \\ 2 & -1 & 1 \\ 1 & 2 & -1 \end{vmatrix} $$
$$ \begin{aligned} \det(A) &= 1\cdot\begin{vmatrix}-1 & 1 \\ 2 & -1\end{vmatrix} - 1\cdot\begin{vmatrix}2 & 1 \\ 1 & -1\end{vmatrix} + 1\cdot\begin{vmatrix}2 & -1 \\ 1 & 2\end{vmatrix} \\\\ &= 1\cdot[(-1)(-1) - (1)(2)] - 1\cdot[(2)(-1) - (1)(1)] + 1\cdot[(2)(2) - (-1)(1)] \\\\ &= 1\cdot[1 - 2] - 1\cdot[-2 - 1] + 1\cdot[4 + 1] \\\\ &= 1\cdot(-1) - 1\cdot(-3) + 1\cdot(5) = -1 + 3 + 5 = 7 \end{aligned} $$

Step 2: Compute det(Aₓ) (replace column 1)

$$ \det(A_x) = \begin{vmatrix} 6 & 1 & 1 \\ 3 & -1 & 1 \\ 3 & 2 & -1 \end{vmatrix} = -7 $$

Step 3: Compute det(Aᵧ) (replace column 2)

$$ \det(A_y) = \begin{vmatrix} 1 & 6 & 1 \\ 2 & 3 & 1 \\ 1 & 3 & -1 \end{vmatrix} = -15 $$

Step 4: Compute det(A₂) (replace column 3)

$$ \det(A_z) = \begin{vmatrix} 1 & 1 & 6 \\ 2 & -1 & 3 \\ 1 & 2 & 3 \end{vmatrix} = -18 $$

Step 5: Calculate variables

$$ x = \frac{\det(A_x)}{\det(A)} = \frac{-7}{7} = -1, \qquad y = \frac{\det(A_y)}{\det(A)} = \frac{-15}{7} = -\frac{15}{7}, \qquad z = \frac{\det(A_z)}{\det(A)} = \frac{-18}{7} = -\frac{18}{7} $$

Solution: x = -1, y = -15/7, z = -18/7

Example 3: When Cramer's Rule Fails

System:

$$ \begin{cases} x + 2y = 3 \\\\ 2x + 4y = 6 \end{cases} $$

Compute det(A):

$$ \det(A) = \begin{vmatrix} 1 & 2 \\ 2 & 4 \end{vmatrix} = (1)(4) - (2)(2) = 4 - 4 = 0 $$

Conclusion: Since det(A) = 0, Cramer's Rule cannot be applied. This system has infinite solutions (the second equation is 2 times the first). Use Gaussian elimination instead.


Advantages & Disadvantages

✅ Advantages

  • Exact formula - No iterative approximations
  • Direct computation - Each variable independent
  • Great for 2×2 and 3×3 - Simple mental calculations
  • Theoretical value - Proves existence/uniqueness
  • Single variable - Compute one variable without others

❌ Disadvantages

  • Computationally expensive - O(n!) operations vs O(n³) for elimination
  • Numerically unstable - Division by small determinants
  • Requires square systems - Equal equations and unknowns
  • Fails when det(A)=0 - Singular matrices
  • Impractical for n>3 - Too many determinant calculations

📊 Comparison: For a 10×10 system, Cramer's Rule requires ~10! ≈ 3.6 million operations, while Gaussian elimination needs ~670 operations. That's why we only recommend Cramer's Rule for small systems!


Frequently Asked Questions

Q: Does Cramer's Rule work for all square systems?

A: No! It only works when det(A) ≠ 0 (matrix is invertible). If det(A) = 0, the system either has no solution or infinite solutions.

Q: Can I use Cramer's Rule for 4×4 or larger systems?

A: Technically yes, but it's computationally expensive. For 4×4, you need to compute 5 determinants of 4×4 matrices. Gaussian elimination is much faster and more stable.

Q: Why is Cramer's Rule taught if it's inefficient?

A: It provides a beautiful theoretical connection between determinants and solutions. Plus, it's excellent for 2×2 and 3×3 systems by hand.

Q: What if I only need one variable?

A: Cramer's Rule is perfect for this! You only need to compute det(A) and det(Aᵢ) for that one variable, ignoring the others.

Q: How do I compute determinants quickly?

A: For 2×2: ad - bc. For 3×3: Use the Rule of Sarrus or cofactor expansion. Our calculator does it automatically!


Practice Problems

Beginner

  1. Solve using Cramer's Rule:

    $$ \begin{cases} 3x + 2y = 7 \\\\ x - y = -1 \end{cases} $$
  2. Solve using Cramer's Rule:

    $$ \begin{cases} 2x + 5y = 11 \\\\ 3x - 2y = 7 \end{cases} $$

Intermediate

  1. Solve the 3×3 system:

    $$ \begin{cases} 2x - y + z = 4 \\\\ x + 2y - z = 1 \\\\ 3x + y + 2z = 9 \end{cases} $$
  2. Determine if Cramer's Rule can be applied:

    $$ \begin{cases} x + 2y = 5 \\\\ 2x + 4y = 10 \end{cases} $$

Advanced

  1. For what value of k does Cramer's Rule fail for this system?

    $$ \begin{cases} 2x + ky = 4 \\\\ 3x + 6y = 12 \end{cases} $$
Click to reveal solutions

1. x = 1, y = 2

2. x = 3, y = 1

3. x = 1, y = 2, z = 1

4. No - det(A) = 0 (infinite solutions)

5. k = 4 (makes det(A) = 0)



Summary

Key Takeaways

  • Cramer's Rule: xᵢ = det(Aᵢ) / det(A)
  • Requires: Square system + det(A) ≠ 0
  • Best for: 2×2 and 3×3 systems, or finding single variables
  • Not for: Large systems or when det(A) = 0
  • Alternatives: Gaussian elimination, inverse method

💡 Pro Tip: Use our calculator above to check your work! Enter your coefficients and constants, and watch Cramer's Rule in action with step-by-step determinant calculations.


Try It Yourself!

Use the calculator above to solve systems using Cramer's Rule:

  1. Enter your coefficients in the matrix A
  2. Enter your constants in vector b
  3. Click "Calculate" to see:
    • det(A) computation
    • Each det(Aᵢ) calculation
    • Final values for each variable
    • Step-by-step verification

📐 Try these examples:

  • 2×2 System: 2x + 3y = 8, 4x - y = 2
  • 3×3 System: x + y + z = 6, 2x - y + z = 3, x + 2y - z = 3
  • Singular System: x + 2y = 3, 2x + 4y = 6 (see what happens when det(A) = 0!)

💡 Pro Tip: Cramer's Rule is great for 2×2 and 3×3 systems. For larger systems, try Gaussian Elimination instead—it's much faster!

Summary

Key Takeaways

  • Cramer's Rule: xᵢ = det(Aᵢ) / det(A)
  • Requires: Square system + det(A) ≠ 0
  • Best for: 2×2 and 3×3 systems, or finding single variables
  • Not for: Large systems (n > 3) or when det(A) = 0
  • Alternatives: Gaussian Elimination, Inverse Method

💬 Still have questions? Check out our FAQ section or try the Gaussian Elimination calculator for a different approach.