Determinants · Definition
Cramer's rule
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.
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
- Use Cramer's rule to find \(x\) in \(\begin{cases}2x+y=7\\ x-y=-1\end{cases}\).
- Cramer's rule for a system \(A\mathbf{x}=\mathbf{b}\) with square \(A\) can be applied when:
- Solve for \(y\) with Cramer's rule: \(\begin{cases}x+2y=8\\ 3x-y=3\end{cases}\).
- For \(\begin{pmatrix}1&1&1\\0&2&1\\1&0&3\end{pmatrix}\begin{pmatrix}x\\y\\z\end{pmatrix}=\begin{pmatrix}6\\7\\10\end{pmatrix}\), use Cramer's rule to find \(z\).
- In Cramer's rule, to compute \(x_i\) the matrix \(A_i\) is formed from \(A\) by:
- For \(\begin{cases}2x+4y=6\\ x+2y=3\end{cases}\), what do you conclude when trying Cramer's rule?
- For which values of \(k\) does \(\begin{cases}kx+2y=3\\ 2x+ky=1\end{cases}\) have a unique solution?
- If \(\det A=4\) and the determinant of the matrix obtained by replacing column 1 with \(\mathbf{b}\) is \(-8\), what is \(x_1\)?
- Solving a \(4\times4\) system with a unique solution using Cramer's rule requires computing at least:
- Let \(A\) be a square matrix with integer entries and \(\det A=1\), and \(\mathbf{b}\) a vector with integer entries. What can be said about the solution of \(A\mathbf{x}=\mathbf{b}\)?
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.