Skip to main content

Section 3.3 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*}

Example 3.3.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.3.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.