Skip to main content

Section 3.4 Cramer’s Rule

Given a matrix equation \(A\mathbf{x}=\mathbf{b}\text{,}\) where \(A\) is an \(n \times n\) matrix. Let \(A_i(\mathbf{b})\) be the matrix obtained from \(A\) by replacing column \(i\) by the vector \(\mathbf{b}\text{.}\)
\begin{equation*} \begin{array}{lllclll} A_i(\mathbf{b})=[\mathbf{a}_1 \amp \cdots \amp \mathbf{a}_{i-1}\amp \mathbf{b} \amp \mathbf{a}_{i+1}\amp \cdots \amp \mathbf{a}_n]\\ \amp\amp\amp\uparrow\amp\amp\amp\\ \amp\amp\amp\text{col } i\amp\amp\amp \end{array} \end{equation*}

Proof.

We prove Cramer’s Rule using the adjoint matrix formula and properties of determinants.
Since \(A\) is invertible, we know from Theorem 3.3.9 that
\begin{equation*} A^{-1} = \frac{1}{\det(A)} \operatorname{adj}(A) \end{equation*}
The unique solution to \(A\mathbf{x} = \mathbf{b}\) is given by
\begin{equation*} \mathbf{x} = A^{-1}\mathbf{b} = \frac{1}{\det(A)} \operatorname{adj}(A) \mathbf{b} \end{equation*}
Let’s examine the \(i\)-th component of \(\mathbf{x}\text{.}\) Recall that the \((i,j)\)-entry of \(\operatorname{adj}(A)\) is \(C_{ji}\text{,}\) where \(C_{ji}\) is the \((j,i)\)-cofactor of \(A\text{.}\) Therefore:
\begin{align*} x_i \amp= \frac{1}{\det(A)} \left[\operatorname{adj}(A) \mathbf{b}\right]_i\\ \amp= \frac{1}{\det(A)} \sum_{j=1}^{n} [\operatorname{adj}(A)]_{ij} b_j\\ \amp= \frac{1}{\det(A)} \sum_{j=1}^{n} C_{ji} b_j\\ \amp= \frac{1}{\det(A)} \left(C_{1i}b_1 + C_{2i}b_2 + \cdots + C_{ni}b_n\right) \end{align*}
Now, consider the matrix \(A_i(\mathbf{b})\) obtained by replacing the \(i\)-th column of \(A\) with \(\mathbf{b}\text{:}\)
\begin{equation*} A_i(\mathbf{b}) = \begin{bmatrix} a_{11} \amp \cdots \amp a_{1,i-1} \amp b_1 \amp a_{1,i+1} \amp \cdots \amp a_{1n} \\ a_{21} \amp \cdots \amp a_{2,i-1} \amp b_2 \amp a_{2,i+1} \amp \cdots \amp a_{2n} \\ \vdots \amp \amp \vdots \amp \vdots \amp \vdots \amp \amp \vdots \\ a_{n1} \amp \cdots \amp a_{n,i-1} \amp b_n \amp a_{n,i+1} \amp \cdots \amp a_{nn} \end{bmatrix} \end{equation*}
If we expand \(\det(A_i(\mathbf{b}))\) along the \(i\)-th column (the column containing \(\mathbf{b}\)), we get:
\begin{equation*} \det(A_i(\mathbf{b})) = b_1 C_{1i} + b_2 C_{2i} + \cdots + b_n C_{ni} \end{equation*}
where \(C_{ji}\) are the cofactors of the \(i\)-th column of \(A_i(\mathbf{b})\text{.}\)
Key observation: Since \(A_i(\mathbf{b})\) differs from \(A\) only in column \(i\text{,}\) the cofactor \(C_{ji}\) (which is computed by deleting row \(j\) and column \(i\)) is the same for both \(A_i(\mathbf{b})\) and \(A\text{.}\)
Therefore:
\begin{equation*} \det(A_i(\mathbf{b})) = b_1 C_{1i} + b_2 C_{2i} + \cdots + b_n C_{ni} \end{equation*}
Comparing this with our earlier expression for \(x_i\text{:}\)
\begin{align*} x_i \amp= \frac{1}{\det(A)} \left(C_{1i}b_1 + C_{2i}b_2 + \cdots + C_{ni}b_n\right)\\ \amp= \frac{\det(A_i(\mathbf{b}))}{\det(A)} \end{align*}
This completes the proof of Cramer’s Rule.

Example 3.4.2.

Use Cramer’s Rule to solve the system of linear equations.
\begin{align*} 2x_1-x_2\amp=5\\ 3x_1-5x_2\amp=11 \end{align*}
Solution.
We first identify our coefficient matrix \(A\) and constant vector \(\mathbf{b}\text{:}\)
\begin{equation*} A = \begin{bmatrix} 2 \amp -1 \\ 3 \amp -5 \end{bmatrix}, \quad \mathbf{b} = \begin{bmatrix} 5 \\ 11 \end{bmatrix} \end{equation*}
Step 1: Compute \(\det(A)\)
The determinant of the coefficient matrix is:
\begin{equation*} \det(A) = (2)(-5) - (-1)(3) = -10 + 3 = -7 \end{equation*}
Since \(\det(A) \neq 0\text{,}\) the matrix \(A\) is invertible and Cramer’s Rule applies.
Step 2: Form \(A_1(\mathbf{b})\) and compute \(x_1\)
To find \(x_1\text{,}\) we replace the first column of \(A\) with \(\mathbf{b}\text{:}\)
\begin{equation*} A_1(\mathbf{b}) = \begin{bmatrix} 5 \amp -1 \\ 11 \amp -5 \end{bmatrix} \end{equation*}
The determinant is:
\begin{equation*} \det(A_1(\mathbf{b})) = (5)(-5) - (-1)(11) = -25 + 11 = -14 \end{equation*}
Therefore, by Cramer’s Rule:
\begin{equation*} x_1 = \frac{\det(A_1(\mathbf{b}))}{\det(A)} = \frac{-14}{-7} = 2 \end{equation*}
Step 3: Form \(A_2(\mathbf{b})\) and compute \(x_2\)
To find \(x_2\text{,}\) we replace the second column of \(A\) with \(\mathbf{b}\text{:}\)
\begin{equation*} A_2(\mathbf{b}) = \begin{bmatrix} 2 \amp 5 \\ 3 \amp 11 \end{bmatrix} \end{equation*}
The determinant is:
\begin{equation*} \det(A_2(\mathbf{b})) = (2)(11) - (5)(3) = 22 - 15 = 7 \end{equation*}
Therefore, by Cramer’s Rule:
\begin{equation*} x_2 = \frac{\det(A_2(\mathbf{b}))}{\det(A)} = \frac{7}{-7} = -1 \end{equation*}
Final Answer: The solution to the system is \(x_1 = 2\) and \(x_2 = -1\text{.}\)
We can verify this solution by substituting back into the original equations:
\begin{align*} 2(2) - (-1) \amp = 4 + 1 = 5 \quad \checkmark\\ 3(2) - 5(-1) \amp = 6 + 5 = 11 \quad \checkmark \end{align*}
Let’s verify the solution using SageMath. In what follows, the matrix \(B\) is defined by the coefficient matrix \(A\) and the vector \(\mathbf{b}\)(as the third column), and then the matrices \(A_0\text{,}\) \(A_1\text{,}\) and \(A_2\) are created by replacing the appropriate columns of \(B\) (pay attention to the code). Finally, we compute the determinants and find the values of \(x_1\) and \(x_2\text{.}\)

Example 3.4.3.

Use Cramer’s Rule to solve the system
\begin{align*} 2x_1 + x_2 - x_3 \amp = 1 \\ -3x_1 + 4x_2 + 2x_3 \amp = 7 \\ x_1 - 5x_2 + 3x_3 \amp = -4 \end{align*}
Confirm your result with row-reduction.
Cramer’s Rule requires that \(A\) be invertible, which by Theorem 3.2.8 is equivalent to \(\det(A) \neq 0\text{.}\) By taking the contrapositive of this statement, we obtain: \(A\) is not invertible if and only if \(\det(A) = 0\text{.}\) Recall that a square matrix \(A\) is singular(not invertible) precisely when the homogeneous system \(A\mathbf{x} = \mathbf{0}\) has nontrivial solutions. This observation leads directly to the following important corollary.

Proof.

Suppose on the contrary that \(\det(A) \neq 0\text{.}\) Then by Theorem 3.2.8, \(A\) is invertible, which implies that the homogeneous system \(A\mathbf{x} = \mathbf{0}\) has only the trivial solution. This contradicts our assumption that there is a nontrivial solution. Therefore, \(\det(A) = 0\text{.}\)