# Solving Systems Using Matrices

### Solve Using the Inverse The inverse of a matrix can be used to solve a matrix equation of the form $AX=B$.

To solve an algebraic equation of the form $ax=b$ where $a\neq0$, multiply both sides of the equation by the multiplicative inverse of $a$. Similarly, to solve a matrix equation of the form $AX=B$, multiply both sides of the equation by the inverse of $A$.

Since matrix multiplication is not commutative, be sure to multiply both sides by $A^{-1}$ in the same order. Use $A^{-1}$ as the first factor in each product.

Step-By-Step Example
Solving a Matrix Equation Using the Inverse
Solve the matrix equation $CX=D$.
$C=\begin{bmatrix} 2 & 5 \\ 3 & 9 \end{bmatrix}\hspace{20pt}D=\begin{bmatrix} \phantom{-}0 & -1 \\ -2 & \phantom{-}3 \end{bmatrix}$
Step 1
Write the equation using matrices.
\begin{aligned}CX&=D\\\begin{bmatrix} 2 & 5 \\ 3 & 9 \end{bmatrix}X&= \begin{bmatrix} \phantom{-}0 & -1 \\ -2 & \phantom{-}3 \end{bmatrix}\end{aligned}
Step 2
Use any method to identify the inverse of $C$.
$C^{-1}=\begin{bmatrix}\phantom{-}3&-\frac{5}{3}\\[0.5em]-1&\phantom{-}\frac{2}{3} \end{bmatrix}$
Step 3
Multiply both sides of the matrix equation by $C^{-1}$.
$\begin{bmatrix}\phantom{-}3&-\frac{5}{3}\\[0.5em]-1&\phantom{-}\frac{2}{3} \end{bmatrix} \begin{bmatrix} 2 & 5 \\ 3 & 9 \end{bmatrix}X= \begin{bmatrix}\phantom{-}3&-\frac{5}{3}\\[0.5em]-1&\phantom{-}\frac{2}{3} \end{bmatrix} \begin{bmatrix} \phantom{-}0 & -1 \\ -2 & \phantom{-}3 \end{bmatrix}$
Step 4
Simplify the left side of the equation.
$\begin{bmatrix}1&0\\0&1 \end{bmatrix}X=\begin{bmatrix}\phantom{-}3&-\frac{5}{3}\\[0.5em]-1&\phantom{-}\frac{2}{3} \end{bmatrix} \begin{bmatrix} \phantom{-}0 & -1 \\ -2 & \phantom{-}3 \end{bmatrix}$
The left side simplifies to $IX$ because the product of a matrix and its inverse is the identity matrix.
Step 5
Use matrix multiplication to simplify the right side of the equation.
$\begin{bmatrix}1&0\\0&1 \end{bmatrix}X=\overset{\text{Matrix }C^{-1}}{\begin{bmatrix}\phantom{-}3&-\frac{5}{3}\\[0.5em]-1&\phantom{-}\frac{2}{3} \end{bmatrix}} \overset{\text{Matrix }D}{\begin{bmatrix} \phantom{-}0 & -1 \\ -2 & \phantom{-}3 \end{bmatrix}}$
Calculate the entries for the first row. Multiply each entry in $\text{{\color{#c42126}{row 1 of matrix}}}$ ${\color{#c42126}{C^{-1}}}$ by each entry in all $\text{{\color{#0047af}{columns of matrix}}}$ ${\color{#0047af}{D}}$. Then add the products.
\begin{aligned}{\color{#c42126} 3}\cdot{\color{#0047af} 0}+{\color{#c42126} \left(-\frac{5}{3} \right )}\cdot{\color{#0047af} \left(-2 \right )}=\frac{10}{3}\\{\color{#c42126} 3}\cdot{\color{#0047af} \left(-1 \right )}+{\color{#c42126} \left(-\frac{5}{3} \right )}\cdot{\color{#0047af} 3}=-8\end{aligned}
Calculate the entries for the second row. Calculate the entries for the first row. Multiply each entry in $\text{{\color{#c42126}{row 2 of matrix}}}$ ${\color{#c42126}{C^{-1}}}$ by each entry in all $\text{{\color{#0047af}{columns of matrix}}}$ ${\color{#0047af}{D}}$. Then add the products.
$\begin{gathered}{\color{#c42126} -1}\cdot{\color{#0047af} 0}+{\color{#c42126} \frac{2}{3} }\cdot{\color{#0047af} \left(-2 \right )}=-\frac{4}{3}\\{\color{#c42126} -1}\cdot{\color{#0047af} \left(-1 \right )}+{\color{#c42126} \frac{2}{3} }\cdot{\color{#0047af} 3}=3\end{gathered}$
Write the product on the right side of the equation.
$\begin{bmatrix}1&0\\0&1 \end{bmatrix}X= \begin{bmatrix}\phantom{-}\frac{10}{3}&-8\\[0.5em] -\frac{4}{3} & \phantom{-}3 \end{bmatrix}$
Solution
The matrix on the left side of the equation is the identity matrix, $I$. Simplify the right side of the equation: $IX = X$.
$X= \begin{bmatrix}\phantom{-}\frac{10}{3}&-8\\[0.5em] -\frac{4}{3} & \phantom{-}3 \end{bmatrix}$

### Solve Using Row Operations Gaussian elimination is a method of solving systems of linear equations by using an augmented matrix and row operations.
An augmented matrix can be used to represent a system of linear equations. First, check that each equation is written in standard form. Each row of the augmented matrix will represent one of the equations in the system. Use the coefficients of the variable terms as the entries for the left side of the matrix and the constant terms as the entries for the right side. Be sure to include any coefficients of zero.

### Linear Equations Matrix

System of Linear Equations Corresponding Augmented Matrix
\begin{aligned} w+x+y+z &=11 \\ 2w+y &=9 \\ -w+4x-2y+3z &=3 \\ x+2y-3z &=10 \end{aligned} $\left[\begin{array}{rrrr|r}1&1&1&1&11 \\ 2&0&1&0&9\\ -1&4&-2&3&3\\ 0&1&2&-3&10 \\ \end{array}\right]$

The Gaussian elimination method is a way to solve systems of linear equations by using row operations. The steps are the same as when using the standard elimination method to solve systems of equations, but using a matrix helps to keep the numbers organized.

After translating the system into an augmented matrix, the goal is to reduce it so that all entries along the main diagonal of the coefficient matrix are 1s and all entries below the main diagonal are zeros. Then translate the matrix back to a system of equations, and use substitution to solve the simplified system.

Step-By-Step Example
Solving a System of Equations Using a Matrix and Row Operations
Solve the system of equations.
\begin{aligned} w+x+y+z &=11 \\ 2w+y &=9 \\ -w+4x-2y+3z &=3 \\ x+2y-3z &=10 \end{aligned}
Step 1
Check that the equations are in standard form, and use the coefficients and constants to represent the system with an augmented matrix.
$\left[\begin{array}{rrrr|r}1&1&1&1&11 \\ 2&0&1&0&9\\ -1&4&-2&3&3\\ 0&1&2&-3&10 \\ \end{array}\right]$
Step 2

Begin to use row operations to get 1s as entries along the main diagonal and 0s as entries below the main diagonal.

Start by getting zeros in the first column of rows 2 and 3.

Multiply the first row by –2, and add the result to row 2.
$\left[\begin{array}{rrrr|r}1&1&1&1&11 \\ 1\cdot (-2)+2&1\cdot (-2)+0&1\cdot (-2)+1&1\cdot (-2)+0&11\cdot (-2)+9\\ -1&4&-2&3&3\\ 0&1&2&-3&10 \\ \end{array}\right]$
Replace row 2 with the sum.
$\left[\begin{array}{rrrr|r}1&1&1&1&11 \\ 0&-2&-1&-2&-13\\ -1&4&-2&3&3\\ 0&1&2&-3&10 \\ \end{array}\right]$
Add row 1 to row 3.
$\left[\begin{array}{rrrr|r}1&1&1&1&11 \\ 0&-2&-1&-2&-13\\ 1+(-1)&1+4&1+(-2)&1+3&11+3\\ 0&1&2&-3&10 \\ \end{array}\right]$
Replace row 3 with the sum.
$\left[\begin{array}{rrrr|r}1&1&1&1&11 \\ 0&-2&-1&-2&-13\\ 0&5&-1&4&14\\ 0&1&2&-3&10 \\ \end{array}\right]$
Step 3
Switch rows 2 and 4 so that the entry at $a_{2,2}$ is 1.
$\left[\begin{array}{rrrr|r}1&1&1&1&11 \\ 0&1&2&-3&10 \\ 0&5&-1&4&14\\ 0&-2&-1&-2&-13\\ \end{array}\right]$
Step 4
Get zeros as entries in the second column at $a_{3,2}$ and $a_{4,2}$. Multiply row 2 by –5, and add the result to row 3.
$\left[\begin{array}{rrrr|r}1&1&1&1&11 \\ 0&1&2&-3&10 \\ 0\cdot (-5)+0&1\cdot (-5)+5&2\cdot (-5)+(-1)&(-3)\cdot (-5)+4&10\cdot (-5)+14\\ 0&-2&-1&-2&-13\\ \end{array}\right]$
Replace row 3 with the sum.
$\left[\begin{array}{rrrr|r}1&1&1&1&11 \\ 0&1&2&-3&10 \\ 0&0&-11&19&-36\\ 0&-2&-1&-2&-13\\ \end{array}\right]$
Multiply row 2 by 2, and add the result to row 4.
$\left[\begin{array}{rrrr|r}1&1&1&1&11 \\ 0&1&2&-3&10 \\ 0&0&-11&19&-36\\ 0\cdot 2+0&1\cdot 2+-2&2\cdot 2+(-1)&(-3)\cdot 2+(-2)&10\cdot 2+(-13)\\ \end{array}\right]$
Replace row 4 with the sum.
$\left[\begin{array}{rrrr|r}1&1&1&1&11 \\ 0&1&2&-3&10 \\ 0&0&-11&19&-36\\ 0&0&3&-8&7\\ \end{array}\right]$
Step 5
Multiply row 3 by $-\frac{1}{11}$ so that the entry at $a_{3,3}$ is 1.
$\left[\begin{array}{rrrr|r}1&1&1&1&11 \\[0.5em] 0&1&2&-3&10 \\[0.5em] 0&0&1&-\frac{19}{11}&\frac{36}{11}\\[0.5em] 0&0&3&-8&7\ \end{array}\right]$
Step 6
Get zero as the entry at $a_{4,3}$. Multiply row 3 by –3, and add the result to row 4.
$\left[\begin{array}{rrrr|r}1&1&1&1&11 \\[0.5em] 0&1&2&-3&10 \\[0.5em] 0&0&1&-\frac{19}{11}&\frac{36}{11}\\[0.5em] 0\cdot (-3)+0&0\cdot (-3)+0&1\cdot (-3)+3&-\frac{19}{11}\cdot (-3)+(-8)&\frac{36}{11}\cdot (-3)+7\ \end{array}\right]$
Replace row 4 with the sum.
$\left[\begin{array}{rrrr|r}1&1&1&1&11 \\[0.5em] 0&1&2&-3&10 \\[0.5em] 0&0&1&-\frac{19}{11}&\frac{36}{11}\\[0.5em] 0&0&0&-\frac{31}{11}&-\frac{31}{11} \end{array}\right]$
Step 7
Multiply row 4 by $-\frac{11}{31}$ so that the entry at $a_{4,4}$ is 1.
$\left[\begin{array}{rrrr|r}1&1&1&1&11 \\[0.5em] 0&1&2&-3&10 \\[0.5em] 0&0&1&-\frac{19}{11}&\frac{36}{11}\\[0.5em] 0&0&0&1&1 \end{array}\right]$
Step 8
Translate the augmented matrix back into a system of equations.
\begin{aligned} w+x+y+z &=11 \\ x+2y-3z &=10 \\ y-\frac{19}{11}z &=\frac{36}{11} \\ z &=1 \end{aligned}
Step 9
Substitute the solution for $z$ into the third equation to find the solution for $y$.
\begin{aligned} y-\frac{19}{11}(1) &=\frac{36}{11} \\y &=\frac{55}{11} \\ y &=5 \end{aligned}
Substitute the solutions for $y$ and $z$ into the second equation to find the solution for $x$.
\begin{aligned} x+2(5)-3(1) &=10 \\ x &=3 \end{aligned}
Substitute the solutions for $x$, $y$, and $z$ into the first equation to find the solution for $w$.
\begin{aligned} w+3+5+1 &=11 \\ w &=2 \end{aligned}
Solution
The solution to the system of equations is $(2,3,5,1)$.

### Dependent and Inconsistent Systems Row operations can be used to determine whether a linear system of equations is consistent and independent, inconsistent, or dependent.
An augmented matrix can be used to determine the number of solutions of a system of linear equations. Use row operations to reduce the augmented matrix that represents the system.

### Independent, Dependent, and Inconsistent Systems

Type of System Reduced Form (After Row Operations) Number of Solutions Example
Consistent and independent Ones along the main diagonal of the coefficient matrix Exactly one solution $\left[\begin{array}{rrrr|r}{\color{#c42126} 1}&1&1&1&11 \\[0.5em] 0&{\color{#c42126} 1}&2&-3&10 \\[0.5em] 0&0&{\color{#c42126} 1}&-\frac{19}{11}&\frac{36}{11}\\[0.5em] 0&0&0&{\color{#c42126} 1}&1 \end{array}\right]$
Inconsistent Contains a row in which all entries are zero except the last entry No solution $\left[\begin{array}{rrrr|r}1&4&5&6&11 \\ 0&1&-2&-4&10 \\ 0&0&1&-1&3\\ {\color{#c42126} 0}&{\color{#c42126} 0}&{\color{#c42126} 0}&{\color{#c42126} 0}&{\color{#c42126} -3}\\ \end{array}\right]$
Dependent Contains a row in which all entries are zero Infinite number of solutions $\left[\begin{array}{rrrr|r}1&0&-5&5&2 \\ 0&1&5&1&8 \\ 0&0&1&-1&6\\ {\color{#c42126} 0}&{\color{#c42126} 0}&{\color{#c42126} 0}&{\color{#c42126} 0}&{\color{#c42126} 0}\\ \end{array}\right]$