Cramer's Rule

Suppose you are handed a square linear system with numerical coefficients. You are asked only for the value of the third unknown. You do not need the entire solution vector. Gaussian elimination will get you there. But it computes far more than you asked for. It also obscures how each individual unknown depends on the data. Cramer's Rule answers the narrower question directly. It expresses each coordinate of the solution as a single ratio of two determinants. One determinant is built from the original coefficient matrix. The other comes from a matrix with a column replaced by the constants. This is not merely a computational trick. It is a precise statement about how solutions of linear systems depend algebraically on their data. The result matters because it turns an abstract existence-and-uniqueness statement into an explicit formula. That statement is: "a nonsingular system has a unique solution." Cramer's Rule reveals that each solution coordinate is a rational function. It is a function of the entries of the coefficient matrix and the constant vector. This fact has consequences well beyond hand computation. It touches perturbation theory, algebraic geometry, and the theory of linear ODEs with parameters. It also gives a clean, symbolic way to isolate one variable of interest. This can be done without back-substitution. The big picture connects three ideas already in hand. First, the determinant as a test for invertibility. Second, the Adjugate and Cofactor Matrix as an explicit formula for the inverse. Third, the interpretation of a linear system Ax=bA\mathbf{x} = \mathbf{b}. This system asks for coordinates of b\mathbf{b} in the basis given by the columns of AA. Cramer's Rule is the determinant-theoretic shadow of matrix inversion. Instead of computing A−1A^{-1} and multiplying, you compute a ratio of two determinants for each unknown. This article states the rule with all hypotheses spelled out. It proves the rule rigorously using the adjugate formula for the inverse. It works two nontrivial numerical examples. It shows exactly what breaks when nonsingularity fails. Finally, it situates the result historically and practically.

Key takeaways
  • Cramer's Rule solves Ax=bA\mathbf{x}=\mathbf{b} for a square, invertible matrix AA by ratios of determinants.
  • Each unknown xi=det⁡(Ai)/det⁡(A)x_i = \det(A_i)/\det(A), where AiA_i replaces column ii of AA with b\mathbf{b}.
  • It requires det⁡(A)≠0\det(A)\neq 0; the rule gives the unique solution, guaranteed by Determinant and Invertibility.
  • The proof follows in one line once you know A−1=1det⁡A adj(A)A^{-1} = \frac{1}{\det A}\,\mathrm{adj}(A), from The Adjugate and Cofactor Matrix.
  • It is computationally inefficient for large nn (exponential-time determinants) but theoretically indispensable.
  • Key idea: solving a linear system is, structurally, just applying the adjugate formula for A−1A^{-1} one column of b\mathbf b's worth at a time — and reading off the answer as a determinant ratio.

Where this lives today

Cramer's Rule is rarely the algorithm of choice for large numerical linear systems — Gaussian elimination and LU decomposition dominate there because their cost grows polynomially (O(n3)O(n^3)) rather than through repeated full determinant evaluations. But the rule's real modern life is elsewhere:

  • Symbolic and parametric computation. When coefficients are symbols (e.g. physical constants, design parameters) rather than numbers, Cramer's Rule gives closed-form rational-function expressions for each unknown, essential in computer algebra systems and in sensitivity analysis.
  • Control theory and circuit analysis. Solving small linear systems (node/mesh equations in circuits, state-space equations) symbolically in terms of a parameter such as frequency, where an explicit formula for one output variable is more useful than a full numeric solve.
  • Differential geometry and the inverse function theorem. The proof that a C1C^1 map with invertible Jacobian is locally invertible often uses the adjugate/determinant structure underlying Cramer's Rule to control how the inverse map depends smoothly on parameters.
  • Algebraic geometry. Cramer's original use — passing curves through prescribed points and eliminating unknown coefficients — is the ancestor of resultant and elimination theory used in solving systems of polynomial equations.
  • Cryptography and coding theory. Determinant ratios appear in decoding algorithms (e.g. Reed–Solomon-related computations) and in secret-sharing schemes built on solving small linear systems over finite fields exactly.
  • Numerical stability analysis. Even though it is not used computationally at scale, Cramer's Rule underlies theoretical perturbation bounds: it shows explicitly how a small change in b\mathbf b or AA changes each xix_i, foreshadowing condition-number analysis in numerical linear algebra.

Ask the tutor: Can you show me how Cramer's Rule and Gaussian elimination give the same answer, step by step, on one shared example?

DefinitionCramer's Rule

Let A∈Mn×n(F)A \in M_{n\times n}(F) be a square matrix over a field FF with det⁡(A)≠0\det(A) \neq 0, and let b∈Fn\mathbf{b} \in F^n. Consider the linear system

Ax=b.A\mathbf{x} = \mathbf{b}.

For each i=1,…,ni = 1, \dots, n, let Ai(b)A_i(\mathbf{b}) denote the matrix obtained from AA by replacing its ii-th column with the vector b\mathbf{b}, leaving all other columns unchanged. Then the unique solution x=(x1,…,xn)\mathbf{x} = (x_1, \dots, x_n) of the system is given by

xi=det⁡(Ai(b))det⁡(A),i=1,…,n.x_i = \frac{\det\bigl(A_i(\mathbf{b})\bigr)}{\det(A)}, \qquad i = 1, \dots, n.

Intuition

Think of the columns a1,…,an\mathbf{a}_1, \dots, \mathbf{a}_n of AA as a basis of FnF^n (they are a basis precisely because det⁡A≠0\det A \neq 0, by Determinant and Invertibility). The system Ax=bA\mathbf{x} = \mathbf{b} asks: what are the coordinates of b\mathbf{b} relative to this basis? Determinants measure signed volume, and volume scales linearly in each argument separately (multilinearity). If you write b=x1a1+⋯+xnan\mathbf{b} = x_1 \mathbf{a}_1 + \cdots + x_n \mathbf{a}_n and substitute this expansion into the ii-th column of AA, only the xiaix_i \mathbf{a}_i term survives after using alternation to kill the other terms (they duplicate columns already present) — this is exactly the volume-ratio idea: xix_i is the fraction of the "volume" of the parallelepiped spanned by AA's columns that gets replaced when you swap in b\mathbf{b} for column ii. Geometrically in R2\mathbb{R}^2: if a1,a2\mathbf{a}_1, \mathbf{a}_2 span a parallelogram of signed area det⁡A\det A, and b=x1a1+x2a2\mathbf{b} = x_1\mathbf{a}_1 + x_2\mathbf{a}_2, then the parallelogram spanned by b,a2\mathbf{b}, \mathbf{a}_2 has signed area x1det⁡Ax_1 \det A (because a1\mathbf{a}_1 is replaced by a combination that only contributes its a1\mathbf a_1-component, the a2\mathbf a_2-component vanishing against the repeated column). Ratio out det⁡A\det A and you recover x1x_1.

Figure
Cramer's Rule in the plane: replacing a column rescales the parallelogram's area by exactly xix_i
a₁=(3,1) a₂=(1,2) det A = 5 b=(7,4) a₂=(1,2) det(b,a₂) = 10 = 2·det A so x₁ = 10/5 = 2

Theorem

TheoremCramer's Rule

Let FF be a field, let n≥1n \geq 1, and let A∈Mn×n(F)A \in M_{n\times n}(F) satisfy det⁡(A)≠0\det(A) \neq 0. Let b∈Fn\mathbf{b} \in F^n. Then the linear system Ax=bA\mathbf{x} = \mathbf{b} has a unique solution x∈Fn\mathbf{x} \in F^n, and its entries are given by

xi=det⁡(Ai(b))det⁡(A),i=1,…,n,x_i = \frac{\det(A_i(\mathbf{b}))}{\det(A)}, \qquad i = 1,\dots, n,

where Ai(b)A_i(\mathbf{b}) is the matrix formed by replacing the ii-th column of AA by b\mathbf{b}.

LemmaAdjugate formula for the inverse

Let A∈Mn×n(F)A \in M_{n\times n}(F) with det⁡(A)≠0\det(A) \neq 0. Let CijC_{ij} denote the (i,j)(i,j)-cofactor of AA, and let adj(A)\mathrm{adj}(A) denote the adjugate, the matrix whose (i,j)(i,j)-entry is CjiC_{ji} (the cofactor matrix, transposed). Then

A⋅adj(A)=adj(A)⋅A=det⁡(A) I.A \cdot \mathrm{adj}(A) = \mathrm{adj}(A) \cdot A = \det(A)\, I.

Consequently AA is invertible with

A−1=1det⁡(A) adj(A).A^{-1} = \frac{1}{\det(A)} \, \mathrm{adj}(A).

This lemma is the content of The Adjugate and Cofactor Matrix; we cite it as already established and use it to prove Cramer's Rule.

Proof

We give a complete proof, using the technique of direct computation via the adjugate formula for A−1A^{-1}, together with the cofactor (Laplace) expansion of a determinant.

Step 1: Existence and uniqueness of the solution. Since det⁡(A)≠0\det(A) \neq 0, the matrix AA is invertible by Determinant and Invertibility. Hence the system Ax=bA\mathbf{x} = \mathbf{b} has the unique solution

x=A−1b.\mathbf{x} = A^{-1}\mathbf{b}.

This settles existence and uniqueness; it remains to derive the stated determinant formula for the entries of x\mathbf x.

Step 2: Write x=A−1b\mathbf{x} = A^{-1}\mathbf b using the adjugate. By the Lemma above,

A−1=1det⁡(A) adj(A),A^{-1} = \frac{1}{\det(A)}\,\mathrm{adj}(A),

where adj(A)ij=Cji\mathrm{adj}(A)_{ij} = C_{ji}, and CjiC_{ji} is the (j,i)(j,i)-cofactor of AA, i.e. Cji=(−1)j+idet⁡(Mji)C_{ji} = (-1)^{j+i}\det(M_{ji}) with MjiM_{ji} the (n−1)×(n−1)(n-1)\times(n-1) matrix obtained from AA by deleting row jj and column ii. Therefore, writing b=(b1,…,bn)T\mathbf{b} = (b_1, \dots, b_n)^T, the ii-th entry of x=A−1b\mathbf{x} = A^{-1}\mathbf{b} is

xi=1det⁡(A)∑j=1nadj(A)ij bj=1det⁡(A)∑j=1nCji bj.x_i = \frac{1}{\det(A)} \sum_{j=1}^n \mathrm{adj}(A)_{ij}\, b_j = \frac{1}{\det(A)} \sum_{j=1}^n C_{ji}\, b_j.

Step 3: Identify ∑j=1nCjibj\sum_{j=1}^n C_{ji} b_j as det⁡(Ai(b))\det(A_i(\mathbf{b})). Recall the cofactor expansion of a determinant along a column: for any n×nn \times n matrix BB with columns c1,…,cn\mathbf{c}_1,\dots,\mathbf{c}_n, expanding det⁡(B)\det(B) along its ii-th column gives

det⁡(B)=∑j=1n(−1)j+iBjidet⁡(Nji),\det(B) = \sum_{j=1}^n (-1)^{j+i} B_{ji} \det(N_{ji}),

where NjiN_{ji} is BB with row jj and column ii deleted, and BjiB_{ji} is the (j,i)(j,i)-entry of BB. Apply this with B=Ai(b)B = A_i(\mathbf{b}), the matrix AA with column ii replaced by b\mathbf{b}. Two facts are needed: (a) For B=Ai(b)B = A_i(\mathbf b), deleting row jj and column ii from BB gives exactly the same (n−1)×(n−1)(n-1)\times(n-1) matrix as deleting row jj and column ii from AA — because column ii of BB (the only column that differs from AA) is precisely the column being deleted. Hence Nji=MjiN_{ji} = M_{ji} for every jj, where MjiM_{ji} is computed from AA as in Step 2. So det⁡(Nji)=det⁡(Mji)\det(N_{ji}) = \det(M_{ji}). (b) The (j,i)(j,i)-entry of B=Ai(b)B = A_i(\mathbf b) is, by construction, the jj-th entry of b\mathbf b, namely bjb_j (since column ii of BB is b\mathbf b). Substituting (a) and (b) into the cofactor expansion of det⁡(Ai(b))\det(A_i(\mathbf b)) along column ii:

det⁡(Ai(b))=∑j=1n(−1)j+ibjdet⁡(Mji)=∑j=1nCji bj,\det(A_i(\mathbf{b})) = \sum_{j=1}^n (-1)^{j+i} b_j \det(M_{ji}) = \sum_{j=1}^n C_{ji}\, b_j,

which is exactly the sum appearing in Step 2, since Cji=(−1)j+idet⁡(Mji)C_{ji} = (-1)^{j+i}\det(M_{ji}) by definition of the cofactor.

Step 4: Conclude. Combining Steps 2 and 3,

xi=1det⁡(A)det⁡(Ai(b))=det⁡(Ai(b))det⁡(A),x_i = \frac{1}{\det(A)} \det(A_i(\mathbf b)) = \frac{\det(A_i(\mathbf{b}))}{\det(A)},

for each i=1,…,ni = 1, \dots, n. This is precisely the claimed formula, and the proof is complete. ■\blacksquare

∎
CorollaryHomogeneous case and rank-one perturbation sanity check

If b=0\mathbf{b} = \mathbf 0 and det⁡(A)≠0\det(A) \neq 0, then Ai(0)A_i(\mathbf 0) has a zero column, so det⁡(Ai(0))=0\det(A_i(\mathbf 0)) = 0 for every ii (a matrix with a zero column has determinant 00, since determinant is multilinear and det⁡\det of a matrix with a repeated/zero column vanishes — indeed cofactor expansion along that column gives 00 immediately). Hence xi=0/det⁡(A)=0x_i = 0/\det(A) = 0 for all ii, recovering the fact that a nonsingular homogeneous system has only the trivial solution.

Worked examples

Example 1 (a 3×33\times 3 system with no special symmetry). Solve

{2x1−x2+3x3=91x1+4x2−2x3=−33x1+2x2+x3=10⟺A=(2−1314−2321),b=(9−310).\begin{cases} 2x_1 - x_2 + 3x_3 = 9 \\ 1x_1 + 4x_2 - 2x_3 = -3\\ 3x_1 + 2x_2 + x_3 = 10 \end{cases} \quad\Longleftrightarrow\quad A = \begin{pmatrix} 2 & -1 & 3 \\ 1 & 4 & -2 \\ 3 & 2 & 1 \end{pmatrix},\quad \mathbf b = \begin{pmatrix} 9 \\ -3 \\ 10 \end{pmatrix}.

Step 1: compute det⁡(A)\det(A). Expand along the first row:

det⁡(A)=2det⁡(4−221)−(−1)det⁡(1−231)+3det⁡(1432).\det(A) = 2\det\begin{pmatrix}4 & -2\\ 2 & 1\end{pmatrix} - (-1)\det\begin{pmatrix}1 & -2\\3 & 1\end{pmatrix} + 3\det\begin{pmatrix}1 & 4\\3 & 2\end{pmatrix}.

Compute each 2×22\times2 determinant:

det⁡(4−221)=4(1)−(−2)(2)=4+4=8,\det\begin{pmatrix}4 & -2\\ 2 & 1\end{pmatrix} = 4(1) - (-2)(2) = 4 + 4 = 8,
det⁡(1−231)=1(1)−(−2)(3)=1+6=7,\det\begin{pmatrix}1 & -2\\3 & 1\end{pmatrix} = 1(1) - (-2)(3) = 1 + 6 = 7,
det⁡(1432)=1(2)−4(3)=2−12=−10.\det\begin{pmatrix}1 & 4\\3 & 2\end{pmatrix} = 1(2) - 4(3) = 2 - 12 = -10.

So

det⁡(A)=2(8)+1(7)+3(−10)=16+7−30=−7.\det(A) = 2(8) + 1(7) + 3(-10) = 16 + 7 - 30 = -7.

Since det⁡(A)=−7≠0\det(A) = -7 \neq 0, Cramer's Rule applies. Step 2: det⁡(A1(b))\det(A_1(\mathbf b)), replacing column 1 with b\mathbf b:

A1(b)=(9−13−34−21021).A_1(\mathbf b) = \begin{pmatrix} 9 & -1 & 3 \\ -3 & 4 & -2 \\ 10 & 2 & 1 \end{pmatrix}.

Expand along the first row:

det⁡(4−221)=4+4=8,det⁡(−3−2101)=−3+20=17,det⁡(−34102)=−6−40=−46.\det\begin{pmatrix}4 & -2\\2 & 1\end{pmatrix} = 4 + 4 = 8,\qquad \det\begin{pmatrix}-3 & -2\\10 & 1\end{pmatrix} = -3 + 20 = 17,\qquad \det\begin{pmatrix}-3 & 4\\10 & 2\end{pmatrix} = -6 - 40 = -46.
det⁡(A1(b))=9(8)−(−1)(17)+3(−46)=72+17−138=−49.\det(A_1(\mathbf b)) = 9(8) - (-1)(17) + 3(-46) = 72 + 17 - 138 = -49.

So x1=−49−7=7x_1 = \dfrac{-49}{-7} = 7. Step 3: det⁡(A2(b))\det(A_2(\mathbf b)), replacing column 2:

A2(b)=(2931−3−23101).A_2(\mathbf b) = \begin{pmatrix} 2 & 9 & 3 \\ 1 & -3 & -2 \\ 3 & 10 & 1 \end{pmatrix}.
det⁡(−3−2101)=−3+20=17,det⁡(1−231)=1+6=7,det⁡(1−3310)=10+9=19.\det\begin{pmatrix}-3 & -2\\10 & 1\end{pmatrix} = -3 + 20 = 17,\qquad \det\begin{pmatrix}1 & -2\\3 & 1\end{pmatrix} = 1 + 6 = 7,\qquad \det\begin{pmatrix}1 & -3\\3 & 10\end{pmatrix} = 10 + 9 = 19.
det⁡(A2(b))=2(17)−9(7)+3(19)=34−63+57=28.\det(A_2(\mathbf b)) = 2(17) - 9(7) + 3(19) = 34 - 63 + 57 = 28.

So x2=28−7=−4x_2 = \dfrac{28}{-7} = -4. Step 4: det⁡(A3(b))\det(A_3(\mathbf b)), replacing column 3:

A3(b)=(2−1914−33210).A_3(\mathbf b) = \begin{pmatrix} 2 & -1 & 9 \\ 1 & 4 & -3 \\ 3 & 2 & 10 \end{pmatrix}.
det⁡(4−3210)=40+6=46,det⁡(1−3310)=10+9=19,det⁡(1432)=2−12=−10.\det\begin{pmatrix}4 & -3\\2 & 10\end{pmatrix} = 40 + 6 = 46,\qquad \det\begin{pmatrix}1 & -3\\3 & 10\end{pmatrix} = 10 + 9 = 19,\qquad \det\begin{pmatrix}1 & 4\\3 & 2\end{pmatrix} = 2 - 12 = -10.
det⁡(A3(b))=2(46)−(−1)(19)+9(−10)=92+19−90=21.\det(A_3(\mathbf b)) = 2(46) - (-1)(19) + 9(-10) = 92 + 19 - 90 = 21.

So x3=21−7=−3x_3 = \dfrac{21}{-7} = -3. Check. Row 1: 2(7)−(−4)+3(−3)=14+4−9=92(7) - (-4) + 3(-3) = 14 + 4 - 9 = 9. ✓ Row 2: 7+4(−4)−2(−3)=7−16+6=−37 + 4(-4) - 2(-3) = 7 - 16 + 6 = -3. ✓ Row 3: 3(7)+2(−4)+(−3)=21−8−3=103(7) + 2(-4) + (-3) = 21 - 8 - 3 = 10. ✓ So (x1,x2,x3)=(7,−4,−3)(x_1,x_2,x_3) = (7,-4,-3).

Example 2 (a 2×22\times2 system with a complex-number twist, and extracting a single unknown). Suppose we only need x2x_2 from the complex-coefficient system

{(1+i)x1+2x2=3−i3x1+(2−i)x2=4A=(1+i232−i),b=(3−i4).\begin{cases} (1+i)x_1 + 2x_2 = 3 - i\\ 3x_1 + (2-i)x_2 = 4 \end{cases} \quad A = \begin{pmatrix} 1+i & 2 \\ 3 & 2-i\end{pmatrix},\quad \mathbf b = \begin{pmatrix}3-i\\4\end{pmatrix}.

This illustrates that Cramer's Rule works verbatim over any field, here C\mathbb C. Compute det⁡(A)\det(A):

det⁡(A)=(1+i)(2−i)−2(3)=(2−i+2i−i2)−6=(2+i+1)−6=(3+i)−6=−3+i.\det(A) = (1+i)(2-i) - 2(3) = (2 - i + 2i - i^2) - 6 = (2 + i + 1) - 6 = (3+i) - 6 = -3 + i.

We want only x2x_2, so we need only det⁡(A2(b))\det(A_2(\mathbf b)), replacing column 2 with b\mathbf b:

A2(b)=(1+i3−i34),det⁡(A2(b))=(1+i)(4)−(3−i)(3)=(4+4i)−(9−3i)=−5+7i.A_2(\mathbf b) = \begin{pmatrix}1+i & 3-i\\ 3 & 4\end{pmatrix}, \qquad \det(A_2(\mathbf b)) = (1+i)(4) - (3-i)(3) = (4+4i) - (9 - 3i) = -5 + 7i.

Therefore

x2=−5+7i−3+i.x_2 = \frac{-5+7i}{-3+i}.

Rationalize by multiplying by the conjugate −3+i‾=−3−i\overline{-3+i} = -3-i:

x2=(−5+7i)(−3−i)(−3+i)(−3−i)=15+5i−21i−7i29−i2=15−16i+79+1=22−16i10=115−85i.x_2 = \frac{(-5+7i)(-3-i)}{(-3+i)(-3-i)} = \frac{15 + 5i - 21i - 7i^2}{9 - i^2} = \frac{15 - 16i + 7}{9+1} = \frac{22 - 16i}{10} = \frac{11}{5} - \frac{8}{5}i.

This example demonstrates the key practical advantage of Cramer's Rule: to find a single coordinate x2x_2, we needed only two 2×22\times2 determinants (det⁡A\det A and det⁡A2(b)\det A_2(\mathbf b)), never solving for x1x_1 at all.

CounterexampleDropping nonsingularity: det⁡(A)=0\det(A) = 0 breaks the formula entirely

Hypothesis under attack: det⁡(A)≠0\det(A) \neq 0. Consider

A=(1224),b=(36).A = \begin{pmatrix} 1 & 2 \\ 2 & 4 \end{pmatrix}, \qquad \mathbf b = \begin{pmatrix} 3 \\ 6 \end{pmatrix}.

Here det⁡(A)=1(4)−2(2)=0\det(A) = 1(4) - 2(2) = 0, so AA is singular. The "formula" xi=det⁡(Ai(b))/det⁡(A)x_i = \det(A_i(\mathbf b))/\det(A) requires dividing by 00 and is not merely inconvenient — it is meaningless, and no reinterpretation rescues it, for two distinct structural reasons visible in this very example:

  • Case A (consistent, infinitely many solutions). Here Ax=bA\mathbf x = \mathbf b becomes x1+2x2=3x_1 + 2x_2 = 3 twice over (both equations are proportional to it), so every pair (x1,x2)(x_1,x_2) with x1=3−2x2x_1 = 3-2x_2 solves the system: there is no unique solution vector for Cramer's Rule to name. Compute A1(b)=(3264)A_1(\mathbf b) = \begin{pmatrix}3&2\\6&4\end{pmatrix}, with det⁡=12−12=0\det = 12-12=0, and similarly det⁡(A2(b))=0\det(A_2(\mathbf b)) = 0. We get the indeterminate form 0/00/0, consistent with there being infinitely many solutions but useless for producing any single one of them.
  • Case B (inconsistent, no solution). Change b\mathbf b to (37)\begin{pmatrix}3\\7\end{pmatrix}. Now the two equations x1+2x2=3x_1+2x_2=3 and 2x1+4x2=72x_1+4x_2=7 are contradictory (the second says x1+2x2=3.5x_1+2x_2 = 3.5), so the system has no solution. Yet det⁡(A1(b))=det⁡(3274)=12−14=−2≠0\det(A_1(\mathbf b)) = \det\begin{pmatrix}3&2\\7&4\end{pmatrix} = 12-14=-2 \ne 0 while det⁡(A)=0\det(A)=0: the ratio −2/0-2/0 is undefined, correctly signaling failure, but note it is not simply "0/00/0" this time — the two singular subcases (0/00/0 vs. nonzero/0/0) look identical from the hypothesis det⁡A=0\det A=0 alone, so the value of det⁡(Ai(b))\det(A_i(\mathbf b)) cannot by itself distinguish "no solution" from "infinitely many," without further analysis (e.g. rank comparison via the Determinant and Invertibility criterion or row reduction).

This shows precisely why nonsingularity cannot be relaxed to "det⁡(Ai(b))\det(A_i(\mathbf b)) happens to vanish too": the rule's entire derivation used A−1A^{-1} existing, and no substitute formula in terms of determinants alone recovers a unique answer once that fails.

Scope, edge cases & common traps

SituationWhat happensWhat to do instead
det⁡(A)≠0\det(A) \neq 0, any field FFCramer's Rule applies exactly as statedUse it, especially to extract one unknown
det⁡(A)=0\det(A) = 0, system consistentInfinitely many solutions; ratio is 0/00/0, undefinedRow-reduce; parametrize solution set
det⁡(A)=0\det(A) = 0, system inconsistentNo solution; ratio is (nonzero)/0/0, undefinedRow-reduce; detect inconsistency directly
Non-square systemRule does not apply at all — no Ai(b)A_i(\mathbf b) makes sense the same wayUse Gaussian elimination / least squares
Large nn (numerically)Technically correct but requires n+1n+1 determinants of size nn, each costing O(n!)O(n!) by cofactor expansion (or O(n3)O(n^3) via LU-based determinant algorithms) — either way, far more arithmetic than one O(n3)O(n^3) Gaussian elimination that solves for all unknowns at onceUse LU decomposition / Gaussian elimination for numerical work
Symbolic / parametric coefficientsRule is often the best choice: it isolates one unknown as an explicit rational function of parametersUse it deliberately for symbolic derivations

The mathematician behind it

Origins · 1 minGabriel Cramer and how this was discovered
GC
Gabriel Cramer
1704–1752 · Geneva, Switzerland — Enlightenment-era mathematics

Gabriel Cramer was a Genevan mathematician, largely self-taught in advanced analysis beyond his formal training, who held the chair of mathematics at the Academy of Geneva from a young age. He corresponded widely with the leading mathematicians of his era, including Johann and Daniel Bernoulli, and traveled extensively across Europe collecting mathematical correspondence and manuscripts, which he used to edit and publish the works of the Bernoulli brothers. His own most influential contribution appeared in an appendix on algebraic curves, where the determinant formula for solving linear systems was presented as a tool for eliminating unknowns among the coefficients of curves, not as an object of study in its own right.

History
- 1704 — Gabriel Cramer is born in Geneva.
- 1729–1750 — Cramer travels through Europe, corresponds with major mathematicians, and edits the collected works of Johann Bernoulli.
- 1750 — Cramer publishes Introduction à l'analyse des lignes courbes algébriques, whose appendix states the determinant rule for solving systems of linear equations, applied there to finding curves through prescribed points.
- Mid-18th century — Related determinant formulas appear independently in the work of Colin Maclaurin (published posthumously, 1748) and later Leibniz's earlier unpublished notes are recognized to anticipate similar ideas, though Cramer's clear general statement is the one that becomes standard.
- 1752 — Cramer dies; the eponymous rule becomes a fixture of linear algebra pedagogy over the following two centuries.
Does Cramer's Rule work for non-square systems?

No. The rule is stated only for square systems Ax=bA\mathbf x = \mathbf b with AA an n×nn\times n matrix, because the construction of Ai(b)A_i(\mathbf b) depends on AA having exactly as many columns as b\mathbf b has entries, and the proof relies on AA being invertible, which requires squareness. For a non-square (over- or under-determined) system, there is no invertible coefficient matrix to appeal to; instead one uses row reduction to find the general solution, or least-squares methods when an exact solution does not exist. There is no direct determinant-ratio analogue for rectangular systems, though related ideas (e.g. the Moore–Penrose pseudoinverse) generalize some of the same intuition.

Is Cramer's Rule ever actually the fastest method to solve a system?

For very small systems, n=2n=2 or n=3n=3, it is often the quickest method by hand, since each determinant is a short explicit sum. For symbolic systems where entries are parameters rather than numbers, it can also outperform elimination, because elimination on symbolic entries can produce fraction pile-ups mid-computation while Cramer's Rule produces one clean rational expression per unknown. For large numerical systems, however, its cost (computing n+1n+1 determinants of size nn) is prohibitively worse than the O(n3)O(n^3) cost of Gaussian elimination or LU decomposition, so it is not used in practice at scale.

Can Cramer's Rule be used to determine whether a system has a solution?

Not reliably on its own. If det⁡(A)≠0\det(A) \neq 0, the system always has a unique solution, given directly by the rule. If det⁡(A)=0\det(A) = 0, the rule breaks down entirely and gives no information by itself about whether the system is consistent; as the counterexample above shows, both a consistent (infinite-solution) system and an inconsistent system can have det⁡(A)=0\det(A)=0, and distinguishing them requires checking whether b\mathbf b lies in the column space of AA, typically via row reduction or rank comparison, not via Cramer's Rule.

How does Cramer's Rule relate to matrix inversion?

It is essentially matrix inversion in disguise. Since x=A−1b\mathbf x = A^{-1}\mathbf b and A−1=1det⁡Aadj(A)A^{-1} = \frac{1}{\det A}\mathrm{adj}(A), expanding this matrix-vector product entrywise and recognizing each entry as a cofactor expansion of a determinant is exactly the content of the proof of Cramer's Rule. In other words, Cramer's Rule is what you get when you apply the adjugate formula for the inverse, column by column of the "input" b\mathbf b, and interpret the resulting sum as a determinant.

Does Cramer's Rule work over fields other than the real numbers?

Yes, entirely unchanged. The proof uses only field axioms: multilinearity and alternation of the determinant, the cofactor expansion, and division by the nonzero scalar det⁡(A)\det(A), all of which make sense in any field FF (rationals, complex numbers, finite fields, etc.). The complex-number worked example above illustrates this directly; the same formula and proof apply verbatim over Fp\mathbb{F}_p for a prime pp, which is why Cramer's Rule appears in coding-theory and cryptographic contexts over finite fields.

What is the computational complexity of solving a system via Cramer's Rule?

Using cofactor expansion, computing a single n×nn\times n determinant costs O(n!)O(n!) arithmetic operations in the worst case, and Cramer's Rule requires computing n+1n+1 such determinants (det⁡A\det A and each det⁡Ai(b)\det A_i(\mathbf b)), so naive complexity is O(n⋅n!)O(n \cdot n!). Using more efficient determinant algorithms based on LU decomposition, each determinant can be computed in O(n3)O(n^3), bringing total cost to O(n4)O(n^4) for all n+1n+1 determinants — still worse than the O(n3)O(n^3) cost of solving the whole system at once via Gaussian elimination. This gap widens rapidly as nn grows, which is why the rule is a theoretical and small-scale tool rather than a numerical workhorse.

What exactly does Ai(b)A_i(\mathbf b) mean, and is the order of operations (which column, which vector) important?

Ai(b)A_i(\mathbf b) is formed by taking the original matrix AA and replacing its ii-th column — and only its ii-th column — with the constant vector b\mathbf b from the right-hand side of Ax=bA\mathbf x = \mathbf b; all other columns of AA stay exactly as they were. The index ii must match the unknown being solved for: to find x2x_2, replace column 22, not row 22 and not column 11. Swapping which column is replaced, or replacing a row instead, produces a different (generally unrelated) determinant and an incorrect value for xix_i.

Before this