## Solving a System of Linear Equations Using the Inverse of a Matrix

Solving a system of linear equations using the inverse of a matrix requires the definition of two new matrices: $X$ is the matrix representing the variables of the system, and $B$ is the matrix representing the constants. Using matrix multiplication, we may define a system of equations with the same number of equations as variables as

$AX=B$

To solve a system of linear equations using an inverse matrix, let $A$ be the coefficient matrix, let $X$ be the variable matrix, and let $B$ be the constant matrix. Thus, we want to solve a system $AX=B$. For example, look at the following system of equations.

$\begin{array}{c}{a}_{1}x+{b}_{1}y={c}_{1}\\ {a}_{2}x+{b}_{2}y={c}_{2}\end{array}$

From this system, the coefficient matrix is

$A=\left[\begin{array}{cc}{a}_{1}& {b}_{1}\\ {a}_{2}& {b}_{2}\end{array}\right]$

The variable matrix is

$X=\left[\begin{array}{c}x\\ y\end{array}\right]$

And the constant matrix is

$B=\left[\begin{array}{c}{c}_{1}\\ {c}_{2}\end{array}\right]$

Then $AX=B$ looks like

$\left[\begin{array}{cc}{a}_{1}& {b}_{1}\\ {a}_{2}& {b}_{2}\end{array}\right]\text{ }\left[\begin{array}{c}x\\ y\end{array}\right]=\left[\begin{array}{c}{c}_{1}\\ {c}_{2}\end{array}\right]$

Recall the discussion earlier in this section regarding multiplying a real number by its inverse, $\left({2}^{-1}\right)2=\left(\frac{1}{2}\right)2=1$. To solve a single linear equation $ax=b$ for $x$, we would simply multiply both sides of the equation by the multiplicative inverse (reciprocal) of $a$. Thus,

$\begin{array}{c}\text{ }ax=b\\ \text{ }\left(\frac{1}{a}\right)ax=\left(\frac{1}{a}\right)b\\ \left({a}^{-1}\text{ }\right)ax=\left({a}^{-1}\right)b\\ \left[\left({a}^{-1}\right)a\right]x=\left({a}^{-1}\right)b\\ \text{ }1x=\left({a}^{-1}\right)b\\ \text{ }x=\left({a}^{-1}\right)b\end{array}$

The only difference between a solving a linear equation and a system of equations written in matrix form is that finding the inverse of a matrix is more complicated, and matrix multiplication is a longer process. However, the goal is the same—to isolate the variable.

We will investigate this idea in detail, but it is helpful to begin with a $2\times 2$ system and then move on to a $3\times 3$ system.

### A General Note: Solving a System of Equations Using the Inverse of a Matrix

Given a system of equations, write the coefficient matrix $A$, the variable matrix $X$, and the constant matrix $B$. Then

$AX=B$

Multiply both sides by the inverse of $A$ to obtain the solution.

$\begin{array}{r}\hfill \left({A}^{-1}\right)AX=\left({A}^{-1}\right)B\\ \hfill \left[\left({A}^{-1}\right)A\right]X=\left({A}^{-1}\right)B\\ \hfill IX=\left({A}^{-1}\right)B\\ \hfill X=\left({A}^{-1}\right)B\end{array}$

### If the coefficient matrix does not have an inverse, does that mean the system has no solution?

No, if the coefficient matrix is not invertible, the system could be inconsistent and have no solution, or be dependent and have infinitely many solutions.

### Example 7: Solving a 2 × 2 System Using the Inverse of a Matrix

Solve the given system of equations using the inverse of a matrix.

$\begin{array}{r}\hfill 3x+8y=5\\ \hfill 4x+11y=7\end{array}$

### Solution

Write the system in terms of a coefficient matrix, a variable matrix, and a constant matrix.

$A=\left[\begin{array}{cc}3& 8\\ 4& 11\end{array}\right],X=\left[\begin{array}{c}x\\ y\end{array}\right],B=\left[\begin{array}{c}5\\ 7\end{array}\right]$

Then

$\left[\begin{array}{cc}3& 8\\ 4& 11\end{array}\right]\text{ }\left[\begin{array}{c}x\\ y\end{array}\right]=\left[\begin{array}{c}5\\ 7\end{array}\right]$

First, we need to calculate ${A}^{-1}$. Using the formula to calculate the inverse of a 2 by 2 matrix, we have:

$\begin{array}{l}{A}^{-1}=\frac{1}{ad-bc}\left[\begin{array}{cc}d& -b\\ -c& a\end{array}\right]\hfill \\ \text{ }=\frac{1}{3\left(11\right)-8\left(4\right)}\left[\begin{array}{cc}11& -8\\ -4& 3\end{array}\right]\hfill \\ \text{ }=\frac{1}{1}\left[\begin{array}{cc}11& -8\\ -4& 3\end{array}\right]\hfill \end{array}$

So,

${A}^{-1}=\left[\begin{array}{cc}11& -8\\ -4& \text{ }\text{ }3\end{array}\right]$

Now we are ready to solve. Multiply both sides of the equation by ${A}^{-1}$.

$\begin{array}{l}\left({A}^{-1}\right)AX=\left({A}^{-1}\right)B\hfill \\ \left[\begin{array}{rr}\hfill 11& \hfill -8\\ \hfill -4& \hfill 3\end{array}\right]\text{ }\left[\begin{array}{cc}3& 8\\ 4& 11\end{array}\right]\text{ }\left[\begin{array}{c}x\\ y\end{array}\right]=\left[\begin{array}{rr}\hfill 11& \hfill -8\\ \hfill -4& \hfill 3\end{array}\right]\text{ }\left[\begin{array}{c}5\\ 7\end{array}\right]\hfill \\ \left[\begin{array}{cc}1& 0\\ 0& 1\end{array}\right]\text{ }\left[\begin{array}{c}x\\ y\end{array}\right]=\left[\begin{array}{r}\hfill 11\left(5\right)+\left(-8\right)7\\ \hfill -4\left(5\right)+3\left(7\right)\end{array}\right]\hfill \\ \left[\begin{array}{c}x\\ y\end{array}\right]=\left[\begin{array}{r}\hfill -1\\ \hfill 1\end{array}\right]\hfill \end{array}$

The solution is $\left(-1,1\right)$.

### Can we solve for $X$ by finding the product $B{A}^{-1}?$

No, recall that matrix multiplication is not commutative, so ${A}^{-1}B\ne B{A}^{-1}$. Consider our steps for solving the matrix equation.

$\begin{array}{r}\hfill \left({A}^{-1}\right)AX=\left({A}^{-1}\right)B\\ \hfill \left[\left({A}^{-1}\right)A\right]X=\left({A}^{-1}\right)B\\ \hfill IX=\left({A}^{-1}\right)B\\ \hfill X=\left({A}^{-1}\right)B\end{array}$

Notice in the first step we multiplied both sides of the equation by ${A}^{-1}$, but the ${A}^{-1}$ was to the left of $A$ on the left side and to the left of $B$ on the right side. Because matrix multiplication is not commutative, order matters.

### Example 8: Solving a 3 × 3 System Using the Inverse of a Matrix

Solve the following system using the inverse of a matrix.

$\begin{array}{r}\hfill 5x+15y+56z=35\\ \hfill -4x - 11y - 41z=-26\\ \hfill -x - 3y - 11z=-7\end{array}$

### Solution

Write the equation $AX=B$.

$\left[\begin{array}{ccc}5& 15& 56\\ -4& -11& -41\\ -1& -3& -11\end{array}\right]\text{ }\left[\begin{array}{c}x\\ y\\ z\end{array}\right]=\left[\begin{array}{r}\hfill 35\\ \hfill -26\\ \hfill -7\end{array}\right]$

First, we will find the inverse of $A$ by augmenting with the identity.

$\left[\begin{array}{rrr}\hfill 5& \hfill 15& \hfill 56\\ \hfill -4& \hfill -11& \hfill -41\\ \hfill -1& \hfill -3& \hfill -11\end{array}|\begin{array}{ccc}1& 0& 0\\ 0& 1& 0\\ 0& 0& 1\end{array}\right]$

Multiply row 1 by $\frac{1}{5}$.

$\left[\begin{array}{ccc}1& 3& \frac{56}{5}\\ -4& -11& -41\\ -1& -3& -11\end{array}|\begin{array}{ccc}\frac{1}{5}& 0& 0\\ 0& 1& 0\\ 0& 0& 1\end{array}\right]$

Multiply row 1 by 4 and add to row 2.

$\left[\begin{array}{ccc}1& 3& \frac{56}{5}\\ 0& 1& \frac{19}{5}\\ -1& -3& -11\end{array}|\begin{array}{ccc}\frac{1}{5}& 0& 0\\ \frac{4}{5}& 1& 0\\ 0& 0& 1\end{array}\right]$

Add row 1 to row 3.

$\left[\begin{array}{ccc}1& 3& \frac{56}{5}\\ 0& 1& \frac{19}{5}\\ 0& 0& \frac{1}{5}\end{array}|\begin{array}{ccc}\frac{1}{5}& 0& 0\\ \frac{4}{5}& 1& 0\\ \frac{1}{5}& 0& 1\end{array}\right]$

Multiply row 2 by −3 and add to row 1.

$\left[\begin{array}{ccc}1& 0& -\frac{1}{5}\\ 0& 1& \frac{19}{5}\\ 0& 0& \frac{1}{5}\end{array}|\begin{array}{ccc}-\frac{11}{5}& -3& 0\\ \frac{4}{5}& 1& 0\\ \frac{1}{5}& 0& 1\end{array}\right]$

Multiply row 3 by 5.

$\left[\begin{array}{ccc}1& 0& -\frac{1}{5}\\ 0& 1& \frac{19}{5}\\ 0& 0& 1\end{array}|\begin{array}{ccc}-\frac{11}{5}& -3& 0\\ \frac{4}{5}& 1& 0\\ 1& 0& 5\end{array}\right]$

Multiply row 3 by $\frac{1}{5}$ and add to row 1.

$\left[\begin{array}{ccc}1& 0& 0\\ 0& 1& \frac{19}{5}\\ 0& 0& 1\end{array}|\begin{array}{ccc}-2& -3& 1\\ \frac{4}{5}& 1& 0\\ 1& 0& 5\end{array}\right]$

Multiply row 3 by $-\frac{19}{5}$ and add to row 2.

$\left[\begin{array}{ccc}1& 0& 0\\ 0& 1& 0\\ 0& 0& 1\end{array}|\begin{array}{ccc}-2& -3& 1\\ -3& 1& -19\\ 1& 0& 5\end{array}\right]$

So,

${A}^{-1}=\left[\begin{array}{ccc}-2& -3& 1\\ -3& 1& -19\\ 1& 0& 5\end{array}\right]$

Multiply both sides of the equation by ${A}^{-1}$. We want ${A}^{-1}AX={A}^{-1}B:$

$\left[\begin{array}{rrr}\hfill -2& \hfill -3& \hfill 1\\ \hfill -3& \hfill 1& \hfill -19\\ \hfill 1& \hfill 0& \hfill 5\end{array}\right]\text{ }\left[\begin{array}{rrr}\hfill 5& \hfill 15& \hfill 56\\ \hfill -4& \hfill -11& \hfill -41\\ \hfill -1& \hfill -3& \hfill -11\end{array}\right]\text{ }\left[\begin{array}{c}x\\ y\\ z\end{array}\right]=\left[\begin{array}{rrr}\hfill -2& \hfill -3& \hfill 1\\ \hfill -3& \hfill 1& \hfill -19\\ \hfill 1& \hfill 0& \hfill 5\end{array}\right]\text{ }\left[\begin{array}{r}\hfill 35\\ \hfill -26\\ \hfill -7\end{array}\right]$

Thus,

${A}^{-1}B=\left[\begin{array}{r}\hfill -70+78 - 7\\ \hfill -105 - 26+133\\ \hfill 35+0 - 35\end{array}\right]=\left[\begin{array}{c}1\\ 2\\ 0\end{array}\right]$

The solution is $\left(1,2,0\right)$.

### Try It 4

Solve the system using the inverse of the coefficient matrix.

$\begin{array}{l}\text{ }2x - 17y+11z=0\hfill \\ \text{ }-x+11y - 7z=8\hfill \\ \text{ }3y - 2z=-2\hfill \end{array}$

### How To: Given a system of equations, solve with matrix inverses using a calculator.

1. Save the coefficient matrix and the constant matrix as matrix variables $\left[A\right]$ and $\left[B\right]$.
2. Enter the multiplication into the calculator, calling up each matrix variable as needed.
3. If the coefficient matrix is invertible, the calculator will present the solution matrix; if the coefficient matrix is not invertible, the calculator will present an error message.

### Example 9: Using a Calculator to Solve a System of Equations with Matrix Inverses

Solve the system of equations with matrix inverses using a calculator

$\begin{array}{l}2x+3y+z=32\hfill \\ 3x+3y+z=-27\hfill \\ 2x+4y+z=-2\hfill \end{array}$

### Solution

On the matrix page of the calculator, enter the coefficient matrix as the matrix variable $\left[A\right]$, and enter the constant matrix as the matrix variable $\left[B\right]$.

$\left[A\right]=\left[\begin{array}{ccc}2& 3& 1\\ 3& 3& 1\\ 2& 4& 1\end{array}\right],\text{ }\left[B\right]=\left[\begin{array}{c}32\\ -27\\ -2\end{array}\right]$

On the home screen of the calculator, type in the multiplication to solve for $X$, calling up each matrix variable as needed.

${\left[A\right]}^{-1}\times \left[B\right]$

Evaluate the expression.

$\left[\begin{array}{c}-59\\ -34\\ 252\end{array}\right]$