# Solving systems via Cramer’s Rule

Chpt: Matrices
<< prev chpt home >>

## 1 Cramer's rule for systems of two linear equations

Cramer’s Rule is a way to solve a system of linear equations using determinants. Let’s start with a system of two linear equations in two variables. In the system below, we will use generic letters to represent the coefficients of x and y and the numbers on the right-hand side of the equation.

ax + by = e
cx + dy = f

(Here, a, b, c, d, e, and f represent real numbers.)

Recall that the coefficient matrix associated with this system is simply the 2 x 2 matrix consisting of the coefficients of x and y:

Coefficient matrix:

$\begin{bmatrix} a & b \\ c & d \end{bmatrix}$

For Cramer’s Rule, we will need the determinant of the coefficient matrix. In many textbooks, the determinant of the coefficient matrix is represented by D:

$D = {\rm det} \begin{bmatrix} a & b \\ c & d \end{bmatrix} = \begin{vmatrix} a & b \\ c & d \end{vmatrix}$ .

Warning: If D = 0, then Cramer’s Rule should be abandoned and another method, such as substitution or elimination, should be used. Your answer will be either no solution or a solution that requires a generic variable in the answer. See the following note for more information: When D=0

To finish solving a system of two linear equations using Cramer’s Rule, you will need to evaluate two additional determinants, Dx and Dy. The matrices for these determinants are formed by using the numbers on the right-hand side of the equations in place of the appropriate column in the coefficient matrix. Thus:

$D_x = {\rm det} \begin{bmatrix} e & b \\ f & d \end{bmatrix} = \begin{vmatrix} e & b \\ f & d \end{vmatrix}$

Note that the “x” column in this matrix is replaced by the numbers on the right-hand side.

$D_y = {\rm det} \begin{bmatrix} a & e \\ c & f \end{bmatrix} = \begin{vmatrix} a & e \\ c & f \end{vmatrix}$

Note that the “y” column in this matrix is replaced by the numbers on the right-hand side.

Finally, we are ready to solve our system. To find the solution (x,y), we simply use our determinants:

$x = \frac{D_x}{D}$ and $y = \frac{D_y}{D}$ .

## 2 Example (system of two linear equations)

Suppose we need to solve the system:

9x − 4y = 13
3x + 10y = 10

We need to compute three determinants: D, Dx, and Dy. We have:

$D = \begin{vmatrix} 9 & -4 \\ 3 & 10 \end{vmatrix} = (9)(10) - (3)(-4) = 102$

(This uses the coefficient matrix.)

$D_x = \begin{vmatrix} 13 & -4 \\ 10 & 10 \end{vmatrix} = (13)(10)-(10)(-4) = 170$

(Note that the "x" column has been replaced by the numbers on the right-hand side of the equations.)

$D_y = \begin{vmatrix} 9 & 13 \\ 3 & 10 \end{vmatrix} = (9)(10)-(13)(3) = 51$

(Note that the "y" column has been replaced by the numbers on the right-hand side of the equations.)

Now, we need to find x and y:

$x = \frac{D_x}{D} = \frac{170}{102} = \frac{5}{3}$

and

$y = \frac{D_y}{D} = \frac{51}{102} = \frac{1}{2}$

Our solution: $\left(\frac{5}{3}, \frac{1}{2}\right)$.

## 3 Cramer’s Rule—system of three linear equations in three variables

We can extend Cramer’s Rule to systems of three equations, four equations, etc., using the same ideas that we used in our system of two linear equations and two variables. Suppose our system is:

ax + by + cz = r
dx + ey + fz = s
gx + hy + iz = t

We begin by forming the coefficient matrix and taking its determinant:

$D = {\rm det} \begin{bmatrix} a & b & c\\ d & e & f \\ g & h & i \end{bmatrix} = \begin{vmatrix} a & b & c\\ d & e & f \\ g & h & i \end{vmatrix}$

We also need the determinants formed by replacing a column by the numbers on the right-hand side of the equation. Thus:

$D_x = {\rm det} \begin{bmatrix} r & b & c\\ s & e & f \\ t & h & i \end{bmatrix} = \begin{vmatrix} r & b & c\\ s & e & f \\ t & h & i \end{vmatrix}$ Note that the “x” column is replaced.

$D_y = {\rm det} \begin{bmatrix} a & r & c\\ d & s & f \\ g & t & i \end{bmatrix} = \begin{vmatrix} a & r & c\\ d & s & f \\ g & t & i \end{vmatrix}$ Note that the “y” column is replaced.

$D_z = {\rm det} \begin{bmatrix} a & b & r\\ d & e & s \\ g & h & t \end{bmatrix} = \begin{vmatrix} a & b & r\\ d & e & s \\ g & h & t \end{vmatrix}$ Note that the “z” column is replaced.

To find our solution (x,y,z), we compute:

$x = \frac{D_x}{D}$, $y = \frac{D_y}{D}$, and $z = \frac{D_z}{D}$.

## 4 Example (system of three linear equations)

Suppose we want to solve the system:

x − 5y + 2z = − 7
4x + 10y + z = 11
− 2x − 3z = 5

We need to compute D, Dx, Dy, and Dz. We have:

$D=\begin{vmatrix} 1 & -5 & 2\\ 4 & 10 & 1 \\ -2 & 0 & -3\end{vmatrix} = -40$

$D_x=\begin{vmatrix} -7 & -5 & 2\\ 11 & 10 & 1 \\ 5& 0 & -3\end{vmatrix} = -80$

$D_y=\begin{vmatrix} 1 & -7 & 2\\ 4 & 11 & 1 \\ -2 &5 & -3\end{vmatrix} = -24$

$D_z=\begin{vmatrix} 1 & -5 & -7\\ 4 & 10 & 11 \\ -2 & 0 & 5\end{vmatrix} = 120$

Then $\displaystyle x = \frac{D_x}{D} = \frac{-80}{-40} = 2$ , $y = \frac{D_y}{D} = \frac{-24}{-40}= \frac{3}{5}$ , and $z = \frac{D_z}{D}=\frac{120}{-40}=-3$. Our solution is $\left(2, \frac{3}{5}, -3\right)$.

Try to solve the following systems using Cramer's Rule on your own. Check you answer by mousing on the black rectangle. If you need additional help, look at the pencasts.

Check yourself!
System Solution
6x − 3y = 7
12x + 9y = 4
(56,-23)
9x −   4y = 13
3x + 10y = 10
(53,12)
4x − 3y +   8z =  33
6y + 10z =  31
-8x + 6y −   4z = -24
(34,-23,72)

## 6 When D = 0

Recall that the solution to a system of linear equations is either no solution, a unique solution, or infinitely many solutions. As we saw in this section, if in application of Cramer's Rule, D ≠ 0, then the system has a unique solution. In the case that D=0, we have the following (in terms of a system of 3 linear equations in 3 variables):

1. If D = 0, and at least one of Dx, Dy, or Dz is non-zero, then the system has no solution.
2. If D = 0, and Dx = Dy = Dz = 0, then the system has infinitely many solutions.

Note that Cramer's Rule does not give us a method to write the general solution to a system with infinitely many solutions. It merely allows us to determine number of solutions to the system and find the solution when it is unique.

<center>
1