11.8: Solving Systems with Cramer's Rule
- Evaluate 2 × 2 determinants.
- Use Cramer’s Rule to solve a system of equations in two variables.
- Evaluate 3 × 3 determinants.
- Use Cramer’s Rule to solve a system of three equations in three variables.
- Know the properties of determinants.
We have learned how to solve systems of equations in two variables and three variables, and by multiple methods: substitution, addition, Gaussian elimination, using the inverse of a matrix, and graphing. Some of these methods are easier to apply than others and are more appropriate in certain situations. In this section, we will study two more strategies for solving systems of equations.
Evaluating the Determinant of a 2 × 2 Matrix
A determinant is a real number that can be very useful in mathematics because it has multiple applications, such as calculating area, volume, and other quantities. Here, we will use determinants to reveal whether a matrix is invertible by using the entries of a square matrix to determine whether there is a solution to the system of equations. Perhaps one of the more interesting applications, however, is their use in cryptography. Secure signals or messages are sometimes sent encoded in a matrix. The data can only be decrypted with an invertible matrix and the determinant. For our purposes, we focus on the determinant as an indication of the invertibility of the matrix. Calculating the determinant of a matrix involves following the specific patterns that are outlined in this section.
The determinant of a 2 × 2 matrix, given
\(A=\begin{bmatrix}a&b\\c&d\end{bmatrix}\)
is defined as
Notice the change in notation. There are several ways to indicate the determinant, including \(\det(A)\) and replacing the brackets in a matrix with straight lines, \(| A |\).
Find the determinant of the given matrix.
\(A=\begin{bmatrix}5&2\\−6&3\end{bmatrix}\)
Solution
\[\begin{align*} \det(A)&= \begin{vmatrix}5&2\\-6&3\end{vmatrix}\\ &= 5(3)-(-6)(2)\\ &= 27 \end{align*}\]
Using Cramer’s Rule to Solve a System of Two Equations in Two Variables
We will now introduce a final method for solving systems of equations that uses determinants. Known as Cramer’s Rule , this technique dates back to the middle of the 18th century and is named for its innovator, the Swiss mathematician Gabriel Cramer (1704-1752), who introduced it in 1750 in Introduction à l'Analyse des lignes Courbes algébriques . Cramer’s Rule is a viable and efficient method for finding solutions to systems with an arbitrary number of unknowns, provided that we have the same number of equations as unknowns.
Cramer’s Rule will give us the unique solution to a system of equations, if it exists. However, if the system has no solution or an infinite number of solutions, this will be indicated by a determinant of zero. To find out if the system is inconsistent or dependent, another method, such as elimination, will have to be used.
To understand Cramer’s Rule, let’s look closely at how we solve systems of linear equations using basic row operations. Consider a system of two equations in two variables.
\[\begin{align} a_1x+b_1y&= c_1 (1) \label{eq1}\\ a_2x+b_2y&= c_2 (2) \label{eq2}\\ \end{align}\]
We eliminate one variable using row operations and solve for the other. Say that we wish to solve for \(x\). If Equation \ref{eq2} is multiplied by the opposite of the coefficient of \(y\) in Equation \ref{eq1}, Equation \ref{eq1} is multiplied by the coefficient of \(y\) in Equation \ref{eq2}, and we add the two equations, the variable \(y\) will be eliminated.
\[\begin{align*} &b_2a_1x+b_2b_1y = b_2c_1 & \text{Multiply }R_1 \text{ by }b_2 \\ -&\underline{b_1a_2x−b_1b_2y=−b_1c_2} & \text{Multiply }R_2 \text{ by }−b_1 \\ & b_2a_1x−b_1a_2x=b_2c_1−b_1c_2 \end{align*}\]
Now, solve for \(x\).
\[\begin{align*} b_2a_1x−b_1a_2x &= b_2c_1−b_1c_2 \\ x(b_2a_1−b_1a_2) &= b_2c_1−b_1c_2 \\ x &= \dfrac{b_2c_1−b_1c_2}{b_2a_1−b_1a_2}=\dfrac{\begin{bmatrix}c_1&b_1\\c_2&b_2\end{bmatrix}}{\begin{bmatrix}a_1&b_1\\a_2&b_2\end{bmatrix}} \end{align*}\]
Similarly, to solve for \(y\),we will eliminate \(x\).
\[\begin{align*} & a_2a_1x+a_2b_1y = a_2c_1 & \text{Multiply }R_1 \text{ by }a_2 \\ -& \underline{a_1a_2x−a_1b_2y=−a_1c_2} & \text{Multiply }R_2 \text{ by }−a_1 \\ & a_2b_1y−a_1b_2y =a_2c_1−a_1c_2 \end{align*}\]
Solving for \(y\) gives
\[ \begin{align*} a_2b_1y−a_1b_2y &= a_2c_1−a_1c_2 \\ y(a_2b_1−a_1b_2) &= a_2c_1−a_1c_2 \\ y &= \dfrac{a_2c_1−a_1c_2}{a_2b_1−a_1b_2}=\dfrac{a_1c_2−a_2c_1}{a_1b_2−a_2b_1}=\dfrac{\begin{bmatrix}a_1&c_1\\a_2&c_2\end{bmatrix}}{\begin{bmatrix}a_1&b_1\\a_2&b_2\end{bmatrix}} \end{align*}\]
Notice that the denominator for both \(x\) and \(y\) is the determinant of the coefficient matrix.
We can use these formulas to solve for \(x\) and \(y\), but Cramer’s Rule also introduces new notation:
- \(D\):determinant of the coefficient matrix
-
\(D_x\):determinant of the numerator in the solution of \(x\)
\[x=\dfrac{D_x}{D}\]
-
\(D_y\):determinant of the numerator in the solution of \(y\)
\[y=\dfrac{D_y}{D}\]
The key to Cramer’s Rule is replacing the variable column of interest with the constant column and calculating the determinants. We can then express \(x\) and \(y\) as a quotient of two determinants.
Cramer’s Rule is a method that uses determinants to solve systems of equations that have the same number of equations as variables.
Consider a system of two linear equations in two variables.
\[\begin{align*} a_1x+b_1y&= c_1\\ a_2x+b_2y&= c_2 \end{align*}\]
The solution using Cramer’s Rule is given as
\[\begin{align} x&= \dfrac{D_x}{D} = \dfrac{\begin{bmatrix}c_1&b_1\\c_2&b_2\end{bmatrix}}{\begin{bmatrix}a_1&b_1\\a_2&b_2\end{bmatrix}}\; , D\neq 0\\ y&= \dfrac{D_y}{D} = \dfrac{\begin{bmatrix}a_1&c_1\\a_2&c_2\end{bmatrix}}{\begin{bmatrix}a_1&b_1\\a_2&b_2\end{bmatrix}}\; , D\neq 0 \end{align}\]
If we are solving for \(x\), the \(x\) column is replaced with the constant column. If we are solving for \(y\), the \(y\) column is replaced with the constant column.
Solve the following \(2 × 2\) system using Cramer’s Rule.
\[\begin{align*} 12x+3y&= 15\\ 2x-3y&= 13 \end{align*}\]
Solution
Solve for \(x\).
\[\begin{align*} x&= \dfrac{D_x}{D}\\ &= \dfrac{\begin{bmatrix}15&3\\13&-3\end{bmatrix}}{\begin{bmatrix}12&3\\2&-3\end{bmatrix}}\\ &= \dfrac{-45-39}{-36-6}\\ &= \dfrac{-84}{-42}\\ &= 2 \end{align*}\]
Solve for \(y\).
\[\begin{align*} y&= \dfrac{D_y}{D}\\ &= \dfrac{\begin{bmatrix}12&15\\2&13\end{bmatrix}}{\begin{bmatrix}12&3\\2&-3\end{bmatrix}}\\ &= \dfrac{156-30}{-36-6}\\ &= -\dfrac{126}{42}\\ &= -3 \end{align*}\]
The solution is \((2,−3)\).
Use Cramer’s Rule to solve the \(2 × 2\) system of equations.
\[\begin{align*} x+2y&= -11\\ -2x+y&= -13 \end{align*}\]
- Answer
-
\((3,−7)\)
Evaluating the Determinant of a 3 × 3 Matrix
Finding the determinant of a 2×2 matrix is straightforward, but finding the determinant of a 3×3 matrix is more complicated. One method is to augment the 3×3 matrix with a repetition of the first two columns, giving a 3×5 matrix. Then we calculate the sum of the products of entries down each of the three diagonals (upper left to lower right), and subtract the products of entries up each of the three diagonals (lower left to upper right). This is more easily understood with a visual and an example.
Find the determinant of the 3×3 matrix.
\(A=\begin{bmatrix}a_1&b_1&c_1\\a_2&b_2&c_2\\a_3&b_3&c_3\end{bmatrix}\)
-
Augment \(A\) with the first two columns.
\(\det(A)=\left| \begin{array}{ccc|cc} a_1&b_1&c_1&a_1&b_1\\a_2&b_2&c_2&a_2&b_2\\a_3&b_3&c_3&a_3&b_3\end{array} \right|\)
- From upper left to lower right: Multiply the entries down the first diagonal. Add the result to the product of entries down the second diagonal. Add this result to the product of the entries down the third diagonal.
- From lower left to upper right: Subtract the product of entries up the first diagonal. From this result subtract the product of entries up the second diagonal. From this result, subtract the product of entries up the third diagonal.
The algebra is as follows:
\(| A |=a_1b_2c_3+b_1c_2a_3+c_1a_2b_3−a_3b_2c_1−b_3c_2a_1−c_3a_2b_1\)
Find the determinant of the \(3 × 3\) matrix given
\(A=\begin{bmatrix}0&2&1\\3&−1&1\\4&0&1\end{bmatrix}\)
Solution
Augment the matrix with the first two columns and then follow the formula. Thus,
\[\begin{align*} | A | &= \left| \begin{array}{ccc|cc}0&2&1&0&2\\3&-1&1&3&-1\\4&0&1&4&0\end{array}\right| \\ &= 0(−1)(1)+2(1)(4)+1(3)(0)−4(−1)(1)−0(1)(0)−1(3)(2) \\ &=0+8+0+4−0−6 \\ &= 6 \end{align*}\]
Find the determinant of the 3 × 3 matrix.
\(\det(A)=\begin{vmatrix}1&−3&7\\1&1&1\\1&−2&3\end{vmatrix}\)
- Answer
-
\(−10\)
No, this method only works for 2 × 2 and 3 × 3 matrices. For larger matrices it is best to use a graphing utility or computer software.
Using Cramer’s Rule to Solve a System of Three Equations in Three Variables
Now that we can find the determinant of a \(3 × 3\) matrix, we can apply Cramer’s Rule to solve a system of three equations in three variables. Cramer’s Rule is straightforward, following a pattern consistent with Cramer’s Rule for \(2 × 2\) matrices. As the order of the matrix increases to \(3 × 3\), however, there are many more calculations required.
When we calculate the determinant to be zero, Cramer’s Rule gives no indication as to whether the system has no solution or an infinite number of solutions. To find out, we have to perform elimination on the system.
Consider a \(3 × 3\) system of equations.
\[\begin{align} a_1x+b_1y+c_1z &= \color{blue}d_1 \\ a_2x+b_2y+c_2z &= \color{blue}d_2 \\ a_3x+b_3y+c_3z &= \color{blue}d_3 \\ \end{align}\]
\(x=\dfrac{D_x}{D}\), \(y=\dfrac{D_y}{D}\), \(z=\dfrac{D_z}{D}\), \(D≠0\)
where
\[D = \begin{vmatrix} a_1 & b_1 & c_1\\ a_2 & b_2 & c_2\\ a_3 & b_3 & c_3 \end{vmatrix}\; ,\; D_x = \begin{vmatrix} \color{blue}d_1 & b_1 & c_1\\ \color{blue}d_2 & b_2 & c_2\\ \color{blue}d_3 & b_3 & c_3 \end{vmatrix}\; ,\; D_y = \begin{vmatrix} a_1 & \color{blue}d_1 & c_1\\ a_2 & \color{blue}d_2 & c_2\\ a_3 & \color{blue}d_3 & c_3 \end{vmatrix}\; ,\; D_z = \begin{vmatrix} a_1 & b_1 & \color{blue}d_1\\ a_2 & b_2 & \color{blue}d_2\\ a_3 & b_3 & \color{blue}d_3 \end{vmatrix}\]
If we are writing the determinant \(D_x\),we replace the \(x\) column with the constant column. If we are writing the determinant \(D_y\),we replace they y column with the constant column. If we are writing the determinant \(D_z\),we replace the \(z\) column with the constant column. Always check the answer.
Find the solution to the given \(3 × 3\) system using Cramer’s Rule.
\[\begin{align*} x+y-z&= 6\\ 3x-2y+z&= -5\\ x+3y-2z&= 14 \end{align*}\]
Solution
Use Cramer’s Rule.
\(D=\begin{vmatrix}1&1&−1\\3&−2&1\\1&3&−2\end{vmatrix}\), \(D_x=\begin{vmatrix}6&1&−1\\−5&−2&1\\14&3&−2\end{vmatrix}\), \(D_y=\begin{vmatrix}1&6&−1\\3&−5&1\\1&14&−2\end{vmatrix}\), \(D_z=\begin{vmatrix}1&1&6\\3&−2&−5\\1&3&14\end{vmatrix}\)
Then,
\[\begin{align*} x&= \dfrac{D_x}{D}&= \dfrac{-3}{-3}&= 1\\ y&= \dfrac{D_y}{D}&= \dfrac{-9}{-3}&= 3\\ z&= \dfrac{D_z}{D}&= \dfrac{6}{-3}&= -2\\ \end{align*}\]
The solution is \((1,3,−2)\).
Use Cramer’s Rule to solve the \(3 × 3\) matrix.
\[\begin{align*} x-3y+7z&= 13\\ x+y+z&= 1\\ x-2y+3z&= 4 \end{align*}\]
- Answer
-
\(\left(−2,\dfrac{3}{5},\dfrac{12}{5}\right)\)
Solve the system of equations using Cramer’s Rule.
\[\begin{align} 3x-2y&= 4 \label{eq3}\\ 6x-4y&= 0 \label{eq4}\end{align}\]
Solution
We begin by finding the determinants \(D\), \(D_x\),and \(D_y\).
\(D=\begin{vmatrix}3&−2\\6&−4\end{vmatrix}=3(−4)−6(−2)=0\)
We know that a determinant of zero means that either the system has no solution or it has an infinite number of solutions. To see which one, we use the process of elimination. Our goal is to eliminate one of the variables.
- Multiply Equation \ref{eq3} by \(−2\).
- Add the result to Equation \ref{eq4}.
\[\begin{align*} &−6x+4y=−8 \\ &\;\;\;\underline{6x−4y=0} \\ &\;\;\;\;\;\;\;\;\;\; 0=−8 \end{align*}\]
We obtain the equation \(0=−8\), which is false. Therefore, the system has no solution. Graphing the system reveals two parallel lines. See Figure \(\PageIndex{1}\).
Solve the system with an infinite number of solutions.
\[\begin{align} x-2y+3z&= 0 \label{eq5}\\ 3x+y-2z&= 0 \label{eq6}\\ 2x-4y+6z&= 0 \label{eq7} \end{align}\]
Solution
Let’s find the determinant first. Set up a matrix augmented by the first two columns.
\(\left| \begin{array}{ccc|cc}1&−2&3&1&-2\\3&1&−2&3&1\\2&−4&6&2&-4\end{array}\right|\)
Then,
\(1(1)(6)+(−2)(−2)(2)+3(3)(−4)−2(1)(3)−(−4)(−2)(1)−6(3)(−2)=0\)
As the determinant equals zero, there is either no solution or an infinite number of solutions. We have to perform elimination to find out.
1. Multiply Equation \ref{eq5} by \(−2\) and add the result to Equation \ref{eq7}:
\[\begin{align*} &−2x+4y−6x=0 \\ &\;\;\underline{2x−4y+6z=0} \\ &\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;0=0 \end{align*}\]
2. Obtaining an answer of \(0=0\), a statement that is always true, means that the system has an infinite number of solutions. Graphing the system, we can see that two of the planes are the same and they both intersect the third plane on a line. See Figure \(\PageIndex{2}\).
Understanding Properties of Determinants
There are many properties of determinants. Listed here are some properties that may be helpful in calculating the determinant of a matrix.
- If the matrix is in upper triangular form, the determinant equals the product of entries down the main diagonal.
- When two rows are interchanged, the determinant changes sign.
- If either two rows or two columns are identical, the determinant equals zero.
- If a matrix contains either a row of zeros or a column of zeros, the determinant equals zero.
- The determinant of an inverse matrix \(A^{−1}\) is the reciprocal of the determinant of the matrix \(A\).
- If any row or column is multiplied by a constant, the determinant is multiplied by the same factor.
Illustrate each of the properties of determinants.
Solution
Property 1 states that if the matrix is in upper triangular form, the determinant is the product of the entries down the main diagonal.
\(A=\begin{bmatrix}1&2&3\\0&2&1\\0&0&−1\end{bmatrix}\)
Augment \(A\) with the first two columns.
\(A=\left[ \begin{array}{ccc|cc}1&2&3&1&2\\0&2&1&0&2\\0&0&−1&0&0\end{array}\right]\)
Then
\[\begin{align*} \det(A)&= 1(2)(-1)+2(1)(0)+3(0)(0)-0(2)(3)-0(1)(1)+1(0)(2)\\ &= -2 \end{align*}\]
Property 2 states that interchanging rows changes the sign. Given
\[\begin{align*} A&=\begin{bmatrix}-1&5\\4&-3\end{bmatrix}\\ \det(A)&= (-1)(-3)-(4)(5)\\ &= 3-20\\ &= -17 \end{align*}\]
\[\begin{align*} B&= \begin{bmatrix}4&-3\\-1&5\end{bmatrix}\\ \det(B)&= (4)(5)-(-1)(-3)\\ &= 20-3\\ &= 17 \end{align*}\]
Property 3 states that if two rows or two columns are identical, the determinant equals zero.
\[\begin{align*} A&=\left[ \begin{array}{ccc|cc}1&2&2&1&2\\2&2&2&2&2\\-1&2&2&-1&2\end{array}\right]\\ \det(A)&=1(2)(2)+2(2)(-1)+2(2)(2)+1(2)(2)-2(2)(1)-2(2)(2)\\ &=4-4+8+4-4-8\\ &=0 \end{align*}\]
Property 4 states that if a row or column equals zero, the determinant equals zero. Thus,
\[\begin{align*} A&=\begin{bmatrix}1&2\\0&0\end{bmatrix}\\ \det(A)&=1(0)-2(0)\\ &=0 \end{align*}\]
Property 5 states that the determinant of an inverse matrix \(A^{−1}\) is the reciprocal of the determinant \(A\). Thus,
\[\begin{align*} A&=\begin{bmatrix}1&2\\3&4\end{bmatrix}\\ \det(A)&=1(4)-3(2)\\ &=-2 \end{align*}\]
\[\begin{align*} A^{-1}&=\begin{bmatrix}-2&1\\\dfrac{3}{2}&-\dfrac{1}{2}\end{bmatrix}\\ \det(A^{-1})&=-2\left(-\dfrac{1}{2}\right)-\dfrac{3}{2}(1)\\ &=-\dfrac{1}{2} \end{align*}\]
Property 6 states that if any row or column of a matrix is multiplied by a constant, the determinant is multiplied by the same factor. Thus,
\[\begin{align*} A&=\begin{bmatrix}1&2\\3&4\end{bmatrix}\\ \det(A)&=1(4)-2(3)\\ &=-2 \end{align*}\]
\[\begin{align*} B&=\begin{bmatrix}2(1)&2(2)\\3&4\end{bmatrix}\\ \det(B)&=2(4)-3(4)\\ &=-4 \end{align*}\]
Find the solution to the given \(3 × 3\) system.
\[\begin{align} 2x+4y+4z&=2 \label{eq8}\\ 3x+7y+7z&=-5 \label{eq9}\\ x+2y+2z&=4 \label{eq10}\end{align}\]
Solution
Using Cramer’s Rule, we have
\(D=\begin{bmatrix}2&4&4\\3&7&7\\1&2&2\end{bmatrix}\)
Notice that the second and third columns are identical. According to Property 3, the determinant will be zero, so there is either no solution or an infinite number of solutions. We have to perform elimination to find out.
1. Multiply Equation \ref{eq10} by \(–2\) and add the result to Equation \ref{eq8}.
\[\begin{align*} -2x-4y-4x&=-8\\ 2x+4y+4z&=2\\ 0&=-6 \end{align*}\]
Obtaining a statement that is a contradiction means that the system has no solution.
Access these online resources for additional instruction and practice with Cramer’s Rule.
Key Concepts
- The determinant for \(\begin{bmatrix}a&b\\c&d\end{bmatrix}\) is \(ad−bc\). See Example \(\PageIndex{1}\).
- Cramer’s Rule replaces a variable column with the constant column. Solutions are \(x=\dfrac{D_x}{D}\), \(y=\dfrac{D_y}{D}\). See Example \(\PageIndex{2}\).
- To find the determinant of a \(3×3\) matrix, augment with the first two columns. Add the three diagonal entries (upper left to lower right) and subtract the three diagonal entries (lower left to upper right). See Example \(\PageIndex{3}\).
- To solve a system of three equations in three variables using Cramer’s Rule, replace a variable column with the constant column for each desired solution: \(x=\dfrac{D_x}{D}\), \(y=\dfrac{D_y}{D}\), \(z=\dfrac{D_z}{D}\). See Example \(\PageIndex{4}\).
- Cramer’s Rule is also useful for finding the solution of a system of equations with no solution or infinite solutions. See Example \(\PageIndex{5}\) and Example \(\PageIndex{6}\).
-
Certain properties of determinants are useful for solving problems. For example:
- If the matrix is in upper triangular form, the determinant equals the product of entries down the main diagonal.
- When two rows are interchanged, the determinant changes sign.
- If either two rows or two columns are identical, the determinant equals zero.
- If a matrix contains either a row of zeros or a column of zeros, the determinant equals zero.
- The determinant of an inverse matrix \(A^{−1}\) is the reciprocal of the determinant of the matrix \(A\).
- If any row or column is multiplied by a constant, the determinant is multiplied by the same factor. See Example \(\PageIndex{7}\) and Example \(\PageIndex{8}\).