2.4. Cramer’s rule#
Cramer’s rule, named after Swiss mathematician Gabriel Cramer, is an explicit rule for calculating the solution to a system of linear equations using determinants. We saw in the section on determinants that the solution to the system of linear equations
is
We can recognise that the solution to both variables includes the determinant of the coefficient matrix, \(ad - bc\), in the denominator. But what about the numerator? If we consider the solution to \(x_1\) then in \(de - bf\) we can see that the constant values \(e\) and \(f\) are included and we have the subtraction of two products which is similar to the determinant of a \(2 \times 2\) matrix, i.e.,
Doing similar for the solution to \(x_2\) we see that the numerator is
These determinants are simply the coefficient matrix \(\begin{pmatrix} a & b \\ c & d \end{pmatrix}\) with columns 1 and 2 replaced by the constant vector \(\begin{pmatrix} e \\ f \end{pmatrix}\) for \(x_1\) and \(x_2\) respectively. This can be extended to larger systems to give us Cramer’s rule.
(Cramer’s rule)
The solution to a non-singular linear system of equations of the form \(A\vec{x}=\vec{b}\) can be calculated using Cramer’s rule which is
where \(A_i\) is a matrix obtained by replacing column \(i\) of \(A\) with \(\vec{b}\).
Proof. The solution to a system of linear equations \(A \vec{x} = \vec{b}\) can be calculated using \(\vec{x} = A^{-1} \vec{b}\) where \(A^{-1}\) is the inverse of the coefficient matrix \(A\). The adjoint-determinant formula for calculating the inverse is
so
Since \(\operatorname{adj}(A) = C^\mathsf{T}\) where \(C\) is the matrix of co-factors
then for the \(i\)th element of \(\vec{x}\) using the definition of matrix multiplication we have
In Cramer’s rule, \(A_i\) is the matrix formed by replacing the \(i\)th column of \(A\) with \(\vec{b}\)
Since removing the \(i\)th column from both \(A\) and \(A_i\) (the one with the \(b\) values) results in the same matrix then the cofactors of \(A_i\) are the same as the cofactors of \(A\). If we calculate \(\det(A_i)\) by expanding along the \(i\)th column of \(A_i\) then
so \(x_i = \dfrac{\det(A_i)}{\det(A)}\).
Solve the following systems of linear equations using Cramer’s rule
(i) \(\begin{array}{rl} 3x_1 - 2x_2 \!\!\!\! &= -4, \\ x_1 - 3x_2 \!\!\!\! &= 1. \end{array}\)
Solution
Here \(A = \begin{pmatrix} 3 & -2 \\ 1 & -3 \end{pmatrix}\) and \(\vec{b} = \begin{pmatrix} -4 \\ 1 \end{pmatrix}\)
Checking the solution
(ii) \(\begin{array}{rl} -2x_1 - 3x_2 - x_3 \!\!\!\! &= -5, \\ -4x_1 + 4x_2 + 3x_3 \!\!\!\! &= -20, \\ -3x_1 \!\!\!\! &= -12. \end{array}\)
Solution
Here \(A = \begin{pmatrix} -2 & -3 & -1 \\ -4 & 4 & 3 \\ -3 & 0 & 0 \end{pmatrix}\) and \(\vec{b} = \begin{pmatrix} -5 \\ -20 \\ -12 \end{pmatrix}\)
Checking the solution