Cramer's Rule Calculator

Solving Linear Systems With Pure Determinants

Cramer's rule is an 18th-century method that solves a system of linear equations without ever isolating a variable by hand — it replaces one column of the coefficient matrix at a time with the constants, takes the determinant of each version, and divides. When the main determinant isn't zero, the system has exactly one solution and this method finds it directly.

The Formula

D = det(coefficient matrix)
x = Dx / D, y = Dy / D (Dx, Dy: D with that column replaced by the constants)

Worked Example

Solving the system 2x + 3y = 8 and x − 2y = −3:

Cramer's rule, 2x2 system
DeterminantCalculationValue
D(2×−2) − (3×1)−7
Dx(8×−2) − (3×−3)−7
Dy(2×−3) − (8×1)−14
x, y−7/−7, −14/−7x = 1, y = 2

Where This Matters

  • Circuit analysis — solving simultaneous equations from Kirchhoff's laws for unknown currents or voltages.
  • Mixture and allocation problems — finding quantities of two or three ingredients or resources that satisfy multiple constraints at once.
  • Structural statics — resolving unknown forces or reactions from a small system of equilibrium equations.
Note: If D = 0, the system has no unique solution — either no solution exists or there are infinitely many.

How to Use This Calculator

  1. Choose the system size: 2 Equations, 2 Unknowns or 3 Equations, 3 Unknowns.
  2. Enter each equation's coefficients (a11, a12, etc.) and constant (b1, b2, etc.).
  3. Select Calculate to get the solved values for each variable.

Related Calculations

Prefer a step-by-step elimination approach? Try the Gaussian Elimination Calculator, or check a matrix's determinant directly with the Matrix Determinant Calculator.

Principles of Cramer's Rule in Systems of Linear Equations

Formulated in 1750 by Swiss mathematician Gabriel Cramer, Cramer's Rule is an explicit closed-form algebraic theorem for solving a system of n linear equations with n unknown variables using matrix determinants.

For a linear system represented in matrix equation form as A × x = b (where A is an n×n coefficient matrix, x is the n×1 vector of unknowns, and b is the n×1 column vector of constants):

xi = det(Ai) / det(A)

Where det(A) is the determinant of the coefficient matrix, and Ai is the modified matrix formed by replacing the i-th column of matrix A with the constant column vector b.

Solvability Conditions: The Non-Zero Determinant Requirement

  • Unique Single Solution (det(A) ≠ 0): The coefficient matrix A is non-singular and invertible; Cramer's Rule yields the exact unique solution vector.
  • No Unique Solution (det(A) = 0): Cramer's Rule cannot be applied (division by zero):
    • Inconsistent System (No Solutions): If det(A) = 0 and at least one numerator det(Ai) ≠ 0 (parallel geometric hyperplanes).
    • Dependent System (Infinite Solutions): If det(A) = 0 and all det(Ai) = 0 (coincident hyperplanes).

Step-by-Step Worked Calculation Example

Example: Solving an Electrical Mesh-Current Circuit System (2x2)

Problem: Solve the following system of 2 linear mesh-current equations for unknown loop currents I1 and I2:

Equation 1: 5 × I1 - 2 × I2 = 18

Equation 2: -2 × I1 + 6 × I2 = 8

Step 1: Construct coefficient matrix A and constant vector b:

Matrix A = [ [5, -2], [-2, 6] ]  |  Vector b = [ [18], [8] ]

Step 2: Calculate main determinant det(A):

det(A) = (5 × 6) - (-2 × -2) = 30 - 4 = 26

Step 3: Construct matrix A1 and compute det(A1):

A1 = [ [18, -2], [8, 6] ]

det(A1) = (18 × 6) - (-2 × 8) = 108 - (-16) = 108 + 16 = 124

Step 4: Construct matrix A2 and compute det(A2):

A2 = [ [5, 18], [-2, 8] ]

det(A2) = (5 × 8) - (18 × -2) = 40 - (-36) = 40 + 36 = 76

Step 5: Solve for variables I1 and I2:

I1 = det(A1) / det(A) = 124 / 26 = 62 / 13 = 4.769 Amperes

I2 = det(A2) / det(A) = 76 / 26 = 38 / 13 = 2.923 Amperes

Conclusion: The mesh currents are I1 = 4.77 A and I2 = 2.92 A.

Computational Complexity: Cramer's Rule vs. Gaussian Elimination

While Cramer's Rule provides elegant theoretical closed-form expressions for small 2×2 and 3×3 systems, its computational cost scales factorially (O((n+1)!)), making it computationally impractical for large systems (e.g., 100×100 matrices), where Gaussian elimination (O(n³)) is vastly superior.

Mathematical Proof of Cramer's Rule via Matrix Inverses

The formal mathematical proof of Cramer's Rule derives directly from the adjugate formulation of the matrix inverse. For an invertible linear system A × x = b:

x = A-1 × b = [ 1 / det(A) ] × adj(A) × b = [ 1 / det(A) ] × CT × b

Evaluating the i-th component of vector x yields:

xi = [ 1 / det(A) ] × ∑j=1n ( bj × Cji )

Because ∑ bj × Cji represents the exact Laplace cofactor expansion of matrix Ai along its i-th column, the numerator identically equals det(Ai), proving xi = det(Ai) / det(A).

Comparative Statics in General Equilibrium Microeconomics

In mathematical economics, economists use Cramer's Rule to derive analytical partial derivatives in multi-market equilibrium models (such as IS-LM macroeconomic systems). By differentiating system equilibrium identities with respect to policy variables (such as tax rates or money supply), Cramer's Rule produces closed-form algebraic multipliers without requiring numerical simulation.

Geometric Hyper-Volume Ratio Interpretation of Cramer's Rule

In multi-dimensional analytic geometry, Cramer's Rule possesses a profound geometric interpretation. Consider the linear system A × x = b, where matrix A = [ a1, a2, …, an ] represents n column vectors spanning an n-dimensional parallelotope with hyper-volume |det(A)|.

Expressing constant vector b as a linear combination (b = x1a1 + … + xnan), the modified matrix Ai replaces column ai with b. Because all other components xjaj lie within the subspace spanned by the remaining columns, they contribute zero volume. Therefore:

det(Ai) = det [ a1, …, (xiai), …, an ] = xi × det(A)

Dividing both sides by det(A) yields xi = det(Ai) / det(A), proving that unknown variable xi is the exact ratio of the altered parallelotope hyper-volume to the original coefficient hyper-volume.

Wronskian Determinants in Differential Equations

In ordinary differential equations, solving non-homogeneous linear equations via the Method of Variation of Parameters uses a continuous formulation of Cramer's Rule. The unknown parameter derivative functions u'i(x) are solved as ratios of Wronskian Determinants W(y1, y2, …, yn):

u'i(x) = Wi(x) / W(x)

This continuous Cramer's rule formulation provides closed-form particular solutions for forced harmonic mechanical vibrations and resonant electrical RLC circuits.

Symbolic Circuit Analysis in SPICE Engines

Electronic design automation (EDA) software uses symbolic Cramer's rule routines to generate closed-form transfer functions H(s) = Vout(s) / Vin(s) for linear analog operational amplifier circuits, enabling frequency-domain Bode plot stability analysis.

Geometric Line-Line Intersection in 2D Graphics

In 2D computer graphics and computational geometry engines, finding the exact intersection point (x, y) of two non-parallel line segments uses a 2×2 Cramer's rule determinant solution, preventing floating-point slope division-by-zero exceptions on vertical lines.