Cramer's Rule Calculator
Solve a square system of linear equations using Cramer's Rule, a determinant-based method for finding individual variable values. The method gives a unique solution when the coefficient matrix has a non-zero determinant.
A
\( \vec{b} \)
Learn About Cramer's Rule
Definition and the Determinant Quotient Formula
Cramer's Rule is an explicit algebraic formula for solving a system of $n$ linear equations with $n$ variables:
where $\mathbf{A} \in \mathbb{R}^{n \times n}$ is the square coefficient matrix, $\mathbf{x} = [x_1, x_2, \dots, x_n]^T$ is the column vector of unknowns, and $\mathbf{b} \in \mathbb{R}^n$ is the right-hand side constant vector.
If the determinant of the coefficient matrix is non-zero ($\det(\mathbf{A}) \ne 0$), the system has a unique solution given by the quotient of two determinants for each variable $x_i$:
where $\mathbf{A}_i$ is the replacement matrix obtained by replacing the $i$-th column of $\mathbf{A}$ with the constant column vector $\mathbf{b}$:
Strict Applicability Conditions
Cramer's Rule applies if and only if both conditions hold:
- Square System ($m = n$): The number of equations must equal the number of unknowns.
- Nonzero Main Determinant ($\det(\mathbf{A}) \ne 0$): The coefficient matrix must be nonsingular (invertible).
Behavior When the Determinant is Zero ($\det(\mathbf{A}) = 0$)
When $\det(\mathbf{A}) = 0$, division by zero renders Cramer's Rule invalid:
- Inconsistent System (No Solution): If $\det(\mathbf{A}) = 0$ and at least one numerator determinant $\det(\mathbf{A}_i) \ne 0$, the system has no solution (parallel planes/lines).
- Dependent System (Infinite Solutions or Inconsistent): If $\det(\mathbf{A}) = 0$ and all numerator determinants $\det(\mathbf{A}_i) = 0$, the system may possess infinitely many solutions or remain inconsistent. In such cases, one must use Gauss-Jordan elimination (RREF) to determine the solution set.
Computational Complexity Comparison
To solve an $n \times n$ system, Cramer's Rule must evaluate $n + 1$ separate determinants:
- Using cofactor expansion: requires $(n+1) \cdot O(n!) = O((n+1)!)$ operations (astronomical for $n > 4$).
- Using Gaussian elimination per determinant: requires $(n+1) \cdot O(n^3) = O(n^4)$ operations.
- In contrast, standard Gaussian elimination / LU decomposition solves the system directly in $O(n^3)$ operations.
Consequently, Cramer's Rule is computationally impractical for large numerical systems, but remains invaluable for small systems ($2 \times 2$ and $3 \times 3$) and theoretical/symbolic mathematics.
Worked Numerical Example
Solve the $2 \times 2$ system using Cramer's Rule:
- Calculate the Coefficient Determinant $\det(\mathbf{A})$:
Since $\det(\mathbf{A}) = -14 \ne 0$, a unique solution exists.
- Form and Evaluate $\mathbf{A}_1$ (Replace Column 1 with $\mathbf{b} = \begin{bmatrix} 8 \\ 2 \end{bmatrix}$):
- Form and Evaluate $\mathbf{A}_2$ (Replace Column 2 with $\mathbf{b}$):
- Compute the Solution Quotients:
The unique solution is $(x_1, x_2) = (1, 2)$.
1. Why can't Cramer's Rule solve rectangular systems?
Cramer's Rule is based on evaluating matrix determinants. Because determinants are defined strictly for square ($n \times n$) matrices, the coefficient matrix $\mathbf{A}$ and its replacement matrices $\mathbf{A}_i$ must be square. Rectangular systems with more variables than equations ($m < n$) or more equations than variables ($m > n$) must be solved using Gaussian elimination (RREF) or least-squares pseudoinverse methods.
2. Can Cramer's Rule solve for just one variable without computing the rest?
Yes! This is one of Cramer's Rule's greatest practical advantages. If an engineer or economist only needs the value of variable $x_3$ in a large symbolic system, they can evaluate $x_3 = \frac{\det(\mathbf{A}_3)}{\det(\mathbf{A})}$ directly, without calculating $x_1, x_2, \dots$ or performing full Gaussian elimination.
3. What is the geometric meaning of Cramer's Rule?
By multilinearity of determinants, the volume of the parallelotope spanned by the column vectors with $\mathbf{a}_i$ replaced by $\mathbf{b} = \sum x_j \mathbf{a}_j$ simplifies to $x_i \det(\mathbf{A})$. Dividing by the base volume $\det(\mathbf{A})$ isolates the scale factor $x_i$. Cramer's Rule is literally a ratio of oriented geometric volumes.
1. Gabriel Cramer and Colin Maclaurin
While published by Swiss mathematician Gabriel Cramer in his 1750 treatise Introduction Γ l'analyse des lignes courbes algΓ©briques, the rule had actually been discovered two years earlier by Scottish mathematician Colin Maclaurin in 1748 (and possibly as early as 1729), but Maclaurin's work was published posthumously.
2. Analytical Sensitivity and Symbolic Derivatives
In mathematical economics and dynamical systems, Cramer's Rule is used to compute parametric sensitivities:
Because determinants are polynomials of matrix entries, Cramer's Rule allows exact symbolic differentiation of solution variables with respect to physical system parameters without re-solving the system numerically.