Skip to content

Cramer's Rule

Theorem

If A\boldsymbol{A} is a nonsingular n×nn\times n matrix, then the unique solution of Ax=b\boldsymbol{A}\boldsymbol{x}=\boldsymbol{b} is given by xj=det⁡(Bj)det⁡(A)x_j=\frac{\det(\boldsymbol{B}_j)}{\det(\boldsymbol{A})}, where Bj\boldsymbol{B}_j is obtained from A\boldsymbol{A} by replacing column jj with b\boldsymbol{b}.


Interpretation

Cramer's rule expresses each unknown of a square linear system with a nonsingular coefficient matrix as a quotient of two determinants. The denominator is always det⁡(A)\det(\boldsymbol{A}); the numerator is the determinant of A\boldsymbol{A} with the column of xjx_j replaced by the right-hand side b\boldsymbol{b}.

Two parallelograms in the plane: one spanned by the columns a1 and a2 with area 5, and a larger one spanned by b and a2 with area 10, whose ratio gives x1 = 2.

For the illustrated system Ax=b\boldsymbol{A}\boldsymbol{x}=\boldsymbol{b}, A=(a1 a2)=(3112)\boldsymbol{A}=(\boldsymbol{a}_1\ \boldsymbol{a}_2)=\begin{pmatrix}3&1\\1&2\end{pmatrix} and b=(74)\boldsymbol{b}=\begin{pmatrix}7\\4\end{pmatrix}. The blue parallelogram spanned by a1,a2\boldsymbol{a}_1,\boldsymbol{a}_2 has area 55, the red one spanned by b,a2\boldsymbol{b},\boldsymbol{a}_2 has area 1010, so x1=det⁡(b,a2)det⁡(a1,a2)=2x_1=\dfrac{\det(\boldsymbol{b},\boldsymbol{a}_2)}{\det(\boldsymbol{a}_1,\boldsymbol{a}_2)}=2; similarly x2=det⁡(a1,b)det⁡(a1,a2)=55=1x_2=\dfrac{\det(\boldsymbol{a}_1,\boldsymbol{b})}{\det(\boldsymbol{a}_1,\boldsymbol{a}_2)}=\dfrac{5}{5}=1. Replacing a1\boldsymbol{a}_1 by b=x1a1+x2a2\boldsymbol{b}=x_1\boldsymbol{a}_1+x_2\boldsymbol{a}_2 multiplies the area by x1x_1, while the a2\boldsymbol{a}_2 component only shears it.

Each unknown is a ratio of determinants: xj=det⁡(Bj)/det⁡(A)x_j=\det(\boldsymbol{B}_j)/\det(\boldsymbol{A}), where Bj\boldsymbol{B}_j has b\boldsymbol{b} in column jj. Make det⁡(A)=0\det(\boldsymbol{A})=0 and the rule breaks down.

The same argument works in general. The determinant is linear in each column and is zero when two columns are equal, so replacing column jj by b=x1a1+⋯+xnan\boldsymbol{b}=x_1\boldsymbol{a}_1+\cdots+x_n\boldsymbol{a}_n leaves only the term xjdet⁡(A)x_j\det(\boldsymbol{A}). The hypothesis det⁡(A)≠0\det(\boldsymbol{A})\neq0 cannot be dropped: then the system has no solution or infinitely many, so there is no single value of xjx_j to give, and elimination is needed to decide which case occurs.

Cramer's rule is convenient for 2×22\times2 and small 3×33\times3 systems, or when only one unknown is needed; an n×nn\times n system needs n+1n+1 determinants, while Gauss-Jordan elimination needs one reduction. The rule is the formula x=A−1b\boldsymbol{x}=\boldsymbol{A}^{-1}\boldsymbol{b} written out with the adjugate matrix.

A common slip is to replace a row of A\boldsymbol{A} by b\boldsymbol{b}. It must be column jj, the column holding the coefficients of xjx_j.


Key Results

  • Cramer's rule applies only when A\boldsymbol{A} is nonsingular.
  • It gives an explicit formula for the unique solution of Ax=b\boldsymbol{A}\boldsymbol{x}=\boldsymbol{b}.

Examples

  • For a 2×22\times2 nonsingular system, x1=det⁡(B1)/det⁡(A)x_1=\det(\boldsymbol{B}_1)/\det(\boldsymbol{A}) and x2=det⁡(B2)/det⁡(A)x_2=\det(\boldsymbol{B}_2)/\det(\boldsymbol{A}).
  • If det⁡(A)=0\det(\boldsymbol{A})=0, Cramer's rule cannot be used.

Prerequisites

Sources

Aliases: Cramer rule Keywords: determinant formula for linear systems

Last updated: 20 October 2026 03:02