Algebra • Linear Systems Flagship

Cramer's Rule Calculator

Solve $2\times 2$ and $3\times 3$ systems of linear equations using matrix determinants. Calculate exact fractional coordinates $(x, y, z)$, inspect step-by-step column substitutions, analyze singular cases ($D = 0$), and visualize geometric line intersections on the Cartesian plane.

|
Last Updated: September 2026
|
Verified Mathematical Solution & Proofs

Cramer's Rule System Solver

Solve linear equations via determinants with exact rational fractions, matrix expansions, and geometric intersection plots.

Example Archetype Presets:
System of 2 Equations: a₁x + b₁y = c₁  |  a₂x + b₂y = c₂
Equation 1 (L₁)
x +
y =
Equation 2 (L₂)
x +
y =
Unique Solution Found (Consistent & Independent)

Cramer Determinants Summary

Numerator & Denominator Determinants
Step-by-Step Determinant Expansions & Quotients Cramer's Determinant Rule

Geometric Linear Intersection Plot

Interactive Cartesian Plane
Line 1 (L₁)
Line 2 (L₂)
Intersection (x, y)
Direct Answer & Overview
Verified Educational Guide

How to Solve Linear Equations with Cramer's Rule

Cramer's Rule solves a system of n linear equations with n unknowns (AX = B) by computing determinants. If the main coefficient determinant D = det(A) is not zero, each variable is found via the ratio x_i = det(A_i) / D, where A_i is matrix A with its i-th column replaced by constant column B. If D = 0, the system has either infinitely many solutions (dependent) or no solution (inconsistent).

Primary Mathematical Formula Standard Mathematical Model
Standard Equation
ƒ(x)
Q.E.D.
x_i = det(A_i) / det(A) = D_i / D (for D != 0) | 2x2: x = D_x/D, y = D_y/D | 3x3: x = D_x/D, y = D_y/D, z = D_z/D
Evaluated with exact mathematical formulation • Rigorously verified
Exact Formula
Input Parameters
Required
1
2x2 System: Coefficients a₁, b₁, c₁ (Eq 1) and a₂, b₂, c₂ (Eq 2)
2
3x3 System: Coefficients aᵢ, bᵢ, cᵢ and constants dᵢ for i = 1, 2, 3
Expected Outputs
Calculated
Main Determinant D = det(A): Quantifies system independence and area/volume scaling
Variable Numerator Determinants (D_x, D_y, D_z): Column-substituted matrix determinants
Exact Fraction Solutions: Fully reduced rational fractions and decimal equivalents
Geometric Cartesian Visualizer: Real-time SVG plot showing the exact (x, y) intersection
Worked Numerical Example
Instant Verification
Solve 2x + 3y = 8 and 5x - y = 3
→ D = 2(-1) - 3(5) = -17. D_x = 8(-1) - 3(3) = -17. D_y = 2(3) - 8(5) = -34. x = -17/-17 = 1, y = -34/-17 = 2.
Unique Solution: (x, y) = (1.000, 2.000)

What is Cramer's Rule?

Cramer's Rule is an explicit closed-form algebraic theorem in linear algebra used to compute the unique solution of a square system of linear equations ($n$ equations in $n$ variables). Formulated by the mathematician Gabriel Cramer in 1750, it provides individual variable solutions directly without requiring row reductions or matrix inversions.

For any system written in compact matrix-vector notation $A\mathbf{x} = \mathbf{b}$, where $A$ is an $n \times n$ square coefficient matrix, $\mathbf{x}$ is the column vector of unknowns, and $\mathbf{b}$ is the vector of constants:

x_i = \frac{\det(A_i)}{\det(A)} = \frac{D_i}{D} \quad \text{for } i = 1, 2, \dots, n \quad (\det(A) \neq 0)

Here, $A_i$ represents the matrix generated by substituting the $i$-th column of $A$ with the constant vector $\mathbf{b}$.

2×2 System Formula and Step-by-Step Derivation

Consider the general system of two linear equations with two unknown variables $x$ and $y$:

Linear Equations
a₁x + b₁y = c₁
a₂x + b₂y = c₂

Two straight lines in the 2D Cartesian plane.

Matrix Formulation
[ [a₁, b₁], [a₂, b₂] ] · [x; y] = [c₁; c₂]

Coefficient matrix A and constant vector b.

To solve using determinants, evaluate the three $2\times 2$ cross-multiplications:

  • Main Determinant ($D$): Formed by the coefficients of $x$ and $y$: $D = a_1 b_2 - b_1 a_2$
  • $x$-Numerator Determinant ($D_x$): Replace the first column with constant terms $c_1, c_2$: $D_x = c_1 b_2 - b_1 c_2$
  • $y$-Numerator Determinant ($D_y$): Replace the second column with constant terms $c_1, c_2$: $D_y = a_1 c_2 - c_1 a_2$
  • Exact Solutions: $x = \frac{D_x}{D}$ and $y = \frac{D_y}{D}$

3×3 System Expansion: Sarrus' Rule vs Laplace Cofactor Method

For a $3\times 3$ linear system with variables $x, y, z$:

\begin{cases} a_1 x + b_1 y + c_1 z = d_1 \\ a_2 x + b_2 y + c_2 z = d_2 \\ a_3 x + b_3 y + c_3 z = d_3 \end{cases}

The main determinant $D = \det(A)$ is computed by Laplace expansion along the first row:

D = a_1(b_2 c_3 - c_2 b_3) - b_1(a_2 c_3 - c_2 a_3) + c_1(a_2 b_3 - b_2 a_3)
D_x \det([d, b, c])
x = D_x / D
D_y \det([a, d, c])
y = D_y / D
D_z \det([a, b, d])
z = D_z / D

Geometric Interpretation: Area, Volume, and Intersection of Lines/Planes

In analytic geometry, determinants represent spatial scale factors:

  • 2D Linear Systems: Each equation $a_i x + b_i y = c_i$ defines a straight line. If $D \neq 0$, the normal vectors are linearly independent, and the two lines intersect at precisely one coordinate point $(x, y)$. The determinant $D$ is the signed area of the parallelogram spanned by the normal vectors.
  • 3D Linear Systems: Each equation represents an infinite flat plane in 3D Euclidean space. When $D \neq 0$, the three planes are not parallel or co-planar along a single axis, intersecting at a unique spatial vertex $(x, y, z)$. Here, $D$ corresponds to the scalar triple product $\mathbf{a} \cdot (\mathbf{b} \times \mathbf{c})$, which represents the signed volume of the parallelepiped.

Singular Systems: Inconsistent vs Dependent Cases ($D = 0$)

When the determinant of the coefficient matrix equals zero ($D = 0$), the matrix is non-invertible (singular). Under Cramer's Rule, division by zero occurs, indicating one of two structural geometric relationships:

Case 1: Infinitely Many Solutions
D = 0 AND D_x = D_y = D_z = 0

Every numerator determinant is also zero. In 2D, both equations represent the exact same line (coincident lines). In 3D, the three planes coincide or intersect along a continuous common line.

Case 2: No Solution
D = 0 AND At least one D_i ≠ 0

At least one numerator determinant is non-zero. In 2D, the lines are parallel and separated by a non-zero distance. In 3D, the planes form a triangular prism or parallel sheets that share zero common intersection points.

Step-by-Step Worked Examples

Worked Example 1: 2x2 Linear System
2x + 3y = 8
5x - y = 3
  • D = (2)(-1) - (3)(5) = -2 - 15 = -17
  • D_x = (8)(-1) - (3)(3) = -8 - 9 = -17
  • D_y = (2)(3) - (8)(5) = 6 - 40 = -34
  • x = D_x / D = -17 / -17 = 1
  • y = D_y / D = -34 / -17 = 2
Exact Solution: (x, y) = (1, 2)
Worked Example 2: 3x3 Electric Mesh System
x + 2y + 3z = 9
2x - y + z = 8
3x + y - z = 3
  • D = 1((-1)(-1) - (1)(1)) - 2((2)(-1) - (1)(3)) + 3((2)(1) - (-1)(3)) = 1(0) - 2(-5) + 3(5) = 25
  • D_x = 9(0) - 2(-11) + 3(11) = 0 + 22 + 33 = 50 → x = 50 / 25 = 2
  • D_y = 1(-11) - 9(-5) + 3(-18) = -11 + 45 - 54 = -25 → y = -25 / 25 = -1
  • D_z = 1(11) - 2(-18) + 9(5) = 11 + 36 + 45 = 75 → z = 75 / 25 = 3
Exact Solution: (x, y, z) = (2, -1, 3)

Comparison: Cramer's Rule vs Other Linear Solvers

Solving Method Time Complexity Primary Strengths Key Limitations
Cramer's Rule O((n+1)!) Direct formulas, exact fractions, ideal for 2x2 & 3x3 systems Cannot solve singular (D = 0) or non-square systems; slow for n ≥ 4
Gaussian Elimination O(n³) Scales to massive systems, handles rectangular matrices Intermediate row divisions cause floating-point roundoff errors
Matrix Inverse (A⁻¹b) O(n³) Efficient when solving multiple right-hand sides for same A High matrix inversion calculation cost compared to direct elimination
Substitution / Elimination O(n³) Intuitive manual pencil-and-paper solving for small systems Sign and algebra errors multiply rapidly for 3 or more variables
Fact-Checked & Verified • Computational Accuracy Standards
Updated July 2026 • Editorial Policy
Authored By
Sanjay Samanta

Lead Developer & Founder of Basic Math Tools. Specializes in browser-native computational algorithms and applied mathematics.

Reviewed & Verified By
Academic Review Board

Mathematics & curriculum specialists. Audited against standard algebraic and arithmetic principles.

Found an error or have an improvement suggestion? Report a calculation issue

Frequently Asked Questions

What is Cramer's Rule and how does it work?
Cramer's Rule is an explicit algebraic formula used to solve a system of n linear equations with n variables using matrix determinants. For a system AX = B with a non-zero determinant det(A) = D, the value of each variable x_i is given by the ratio x_i = det(A_i) / D, where A_i is the matrix formed by replacing the i-th column of A with the constant vector B.
What happens when the main determinant D = 0?
When D = det(A) = 0, Cramer's Rule cannot provide a unique solution because division by zero is undefined. If all modified determinants (D_x, D_y, D_z) are also 0, the system has infinitely many solutions (dependent / coincident lines or planes). If at least one modified determinant is non-zero, the system has no solution (inconsistent / parallel lines or planes).
How do you calculate the determinant of a 2x2 matrix?
For a 2x2 matrix with rows [a, b] and [c, d], the determinant is computed by cross-multiplication: det(A) = ad - bc. In a 2x2 linear system, D = a1*b2 - b1*a2, Dx = c1*b2 - b1*c2, and Dy = a1*c2 - c1*a2.
How do you find 3x3 determinants using Sarrus' Rule or Laplace Expansion?
For a 3x3 matrix, the determinant can be expanded along the first row: D = a1(b2*c3 - c2*b3) - b1(a2*c3 - c2*a3) + c1(a2*b3 - b2*a3). Alternatively, Sarrus' Rule sums the products of the three diagonal top-left to bottom-right lines and subtracts the three bottom-left to top-right diagonal lines.
When should I use Cramer's Rule versus Gaussian Elimination?
Cramer's Rule is ideal for 2x2 and 3x3 systems where exact symbolic, closed-form algebraic expressions and exact fractional answers are desired. For systems larger than 3x3 (4x4, 5x5, etc.), Cramer's Rule has factorial time complexity O((n+1)!), making Gaussian Elimination or LU decomposition (O(n^3)) vastly more computationally efficient.
Can Cramer's Rule be used for non-square systems (e.g., 3 equations with 2 variables)?
No, Cramer's Rule strictly requires a square coefficient matrix where the number of equations equals the number of variables (n equations, n unknowns). Overdetermined or underdetermined systems must be solved using Gaussian elimination, matrix pseudo-inverses, or least-squares regression.