Cramer's Rule Calculator

Solve systems of linear equations using Cramer's rule with detailed determinant calculations.

Select System Size & Enter Coefficients

Equation 1:
=
Equation 2:
=

Enter coefficients for: a1*x + a2*y = b

Result

Solution
x = 1, y = 2
Cramer's Rule
det(A)-5
det(Ax)-5
det(Ay)-10

Step-by-Step Solution

x = det(Ax)/det(A), y = det(Ay)/det(A)

Understanding Cramer's Rule

Cramer's Rule is a mathematical theorem that provides an explicit formula for the solution of a system of linear equations with as many equations as unknowns, provided the system has a unique solution. Named after Swiss mathematician Gabriel Cramer (1704-1752), this method uses determinants to find each unknown variable.

For a system of n linear equations in n unknowns, Cramer's Rule states that each unknown variable x_i can be found by dividing the determinant of a modified coefficient matrix by the determinant of the original coefficient matrix. The modified matrix is formed by replacing the i-th column with the constant terms.

Cramer's Rule Formulas

2x2 System

For two equations with two unknowns: a1*x + b1*y = c1 and a2*x + b2*y = c2

x = (c1*b2 - c2*b1) / (a1*b2 - a2*b1)

3x3 System

For three equations with three unknowns, each variable uses the ratio of two 3x3 determinants.

x_i = det(A_i) / det(A)

2x2 Determinant

The determinant of a 2x2 matrix [[a,b],[c,d]] is computed as:

det = a*d - b*c

3x3 Determinant

The determinant of a 3x3 matrix uses cofactor expansion along the first row.

det = a(ei-fh) - b(di-fg) + c(dh-eg)

Unique Solution

A unique solution exists if and only if the determinant of the coefficient matrix is non-zero.

det(A) != 0

No Solution / Infinite

If det(A) = 0, the system either has no solution or infinitely many solutions.

det(A) = 0 => check consistency

How Cramer's Rule Works

Consider a 2x2 system: a1*x + b1*y = c1 and a2*x + b2*y = c2. The coefficient matrix A has entries [[a1, b1], [a2, b2]]. To find x, replace the first column of A with the constants [c1, c2] to get matrix Ax. Then x = det(Ax) / det(A). Similarly, replace the second column to get Ay, and y = det(Ay) / det(A).

Step-by-Step Process

  1. Write the system in matrix form: A * X = B, where A is the coefficient matrix, X is the variable vector, and B is the constant vector.
  2. Calculate the determinant of the coefficient matrix, det(A). If det(A) = 0, the system cannot be solved by Cramer's Rule.
  3. For each variable x_i, form matrix A_i by replacing column i of A with the constant vector B.
  4. Calculate det(A_i) for each variable.
  5. Compute each variable: x_i = det(A_i) / det(A).

When to Use Cramer's Rule

Cramer's Rule is most practical for 2x2 and 3x3 systems. For larger systems, methods like Gaussian elimination or LU decomposition are more computationally efficient. However, Cramer's Rule has theoretical importance and provides a clean, closed-form solution formula.

Advantages and Limitations

  • Provides an explicit formula, useful for theoretical analysis and symbolic computation.
  • Works well for small systems (2x2 and 3x3) where manual computation is feasible.
  • Requires the coefficient matrix to have a non-zero determinant (the system must have a unique solution).
  • Computationally expensive for large systems: computing n+1 determinants of size n is O(n! * n).
  • Useful in proofs and when expressing solutions in terms of parameters.

Practical Applications

Cramer's Rule is used in engineering, physics, economics, and computer science whenever small systems of linear equations arise. Common applications include circuit analysis (Kirchhoff's laws), force equilibrium problems, interpolation, and finding intersection points of lines and planes.