Determinants · Definition

Cramer's rule

linear algebradeterminantssystems

Before you start you need to know

Cramer's rule gives the solution of a square system as a quotient of determinants: an explicit formula for each unknown.

Definition

Cramer's rule gives the unique solution of a square system, whose coefficient matrix \(A\) has nonzero determinant, as a quotient of determinants.

\[x_i=\frac{\det A_i}{\det A}\]

Until now solving \(A\mathbf x=\mathbf b\) was a process: eliminate, then back-substitute. In the eighteenth century Gabriel Cramer showed that when the solution is unique each unknown can be written directly as a quotient of two determinants. It is the first time the solution appears as a formula rather than a procedure, which makes it useful in theory, for instance to see how \(x_i\) changes when a datum varies.

The recipe is mechanical: \(x_i=\det A_i/\det A\), where \(A_i\) is \(A\) with its column \(i\) replaced by \(\mathbf b\). The underlying idea is that replacing a column by \(\mathbf b\) measures, through determinants, how much of \(\mathbf b\) that column contributes; the fact that the determinant is linear in each column makes the formula work. It requires \(\det A\neq0\), that is, \(A\) invertible; if \(\det A=0\) the rule says nothing and one must go back to elimination.

Guiding example: for \(x+2y=5,\ 3x-y=1\), \(\det A=-7\), \(\det A_1=-7\) and \(\det A_2=-14\), so \(x=1\) and \(y=2\). It is convenient for \(2\times2\) and \(3\times3\) systems; for large \(n\) it is far costlier than Gaussian elimination, so numerically it is rarely used. A typical mistake is replacing a row instead of a column, or putting \(\det A_i\) in the denominator. In the formula, \(A_i\) is the matrix obtained by replacing column \(i\) of \(A\) with \(\mathbf{b}\).

Think about it

Can Cramer's rule be used if \(\det A=0\)?

No: it would require dividing by \(0\). In that case the system is inconsistent or has infinitely many solutions, and it is studied with Gaussian elimination.

Exercises 10

References

  • Gilbert Strang, Introduction to Linear Algebra, 6th edition, Wellesley-Cambridge Press, 2023. §5.3
  • Sheldon Axler, Linear Algebra Done Right, 4th edition, Springer, 2024.