<meta http-equiv="refresh" content="1; url=/nojavascript/">

# Solving a Matrix Equation

%
Progress
Progress
%
Solving a Matrix Equation

Katel and Juan are in charge of building a stage for their school's upcoming play. They go to the hardware store to buy supplies. Katel buys 10 yards of wood and 2 hammers. Her total comes to $130. Juan buys 8 yards of wood and 4 hammers. His total comes to$116. How could you use a matrix inverse to find the cost of a yard of wood and the cost of a hammer?

### Guidance

Solving equations with matrices is very similar to solving an equation with real numbers. Just like real numbers, we can add or subtract the same matrix on both sides of an equation to isolate the variable matrix. The big change is that we cannot divide by a matrix - division by a matrix is not defined. We can, however, multiply by the inverse of a matrix to isolate the variable matrix. Just be careful - matrix multiplication is not commutative so you must “right multiply” or “left multiply” on both sides of the equation. To illustrate, let’s look at the variable matrix, $x$ , and constant matrices, $A$ and $B$ .

If $AX=B$ , then to solve we must multiply on the left as shown:

$AX &= B\\A^{-1} AX &= A^{-1} B\\IX &= A^{-1} B\\X &= A^{-1} B$

If $XA=B$ , then to solve we must multiply on the right as shown:

$XA &= B\\XAA^{-1} &= BA^{-1} \\XI &= BA^{-1}\\X &= BA^{-1}$

#### Example A

Solve the equation: $\begin{bmatrix} 2 & -4\\5 & 1 \end{bmatrix}X = \begin{bmatrix} -14 & -14\\-13 & 9 \end{bmatrix}$

Solution: To isolate the variable matrix, denoted by $X$ , we need to get rid of the matrix being multiplied by $X$ on the left. Find the inverse of $\begin{bmatrix} 2 & -4\\5 & 1 \end{bmatrix}$ and multiply by it on the left of both sides of the equation as shown below.

$\begin{bmatrix} 2 & -4\\5 & 1 \end{bmatrix}^{-1} = \frac{1}{2-(-20)} \begin{bmatrix} 1 & 4\\-5 & 2 \end{bmatrix} = \frac{1}{22} \begin{bmatrix} 1 & 4\\-5 & 2 \end{bmatrix}$

Now, multiply by this inverse on the left on both sides of the equation:

$\frac{1}{22} \begin{bmatrix} 1 & 4\\-5 & 2 \end{bmatrix} \begin{bmatrix} 2 & -4\\5 & 1 \end{bmatrix} X &= \frac{1}{22} \begin{bmatrix} 1 & 4\\-5 & 2 \end{bmatrix} \begin{bmatrix} -14 & -14\\-13 & 9 \end{bmatrix}\\\frac{1}{22} \begin{bmatrix} 22 & 0\\0 & 22 \end{bmatrix} X &= \frac{1}{22} \begin{bmatrix} -66 & 22\\44 & 88 \end{bmatrix}\\\begin{bmatrix} 1 & 0\\0 & 1 \end{bmatrix} X &= \begin{bmatrix} -3 & 1\\2 & 4 \end{bmatrix}\\X &= \begin{bmatrix} -3 & 1\\2 & 4 \end{bmatrix}$

#### Example B

Solve the equation: $X \begin{bmatrix} -8 & 0\\7 & 13 \end{bmatrix} = \begin{bmatrix} 96 & 104\\-60 & 52 \end{bmatrix}$

Solution: This time the variable matrix, $X$ , is being multiplied by another matrix on the right. This time we will need to find the inverse of $\begin{bmatrix} -8 & 0\\7 & 13 \end{bmatrix}$ and multiply by it on the right side as shown below.

$\begin{bmatrix} -8 & 0\\7 & 13 \end{bmatrix}^{-1} = \frac{1}{-104} \begin{bmatrix} 13 & 0\\-7 & -8 \end{bmatrix}$

Now, multiply by this inverse on the right on both sides of the equation:

$X \begin{bmatrix} -8 & 0\\7 & 13 \end{bmatrix} \frac{1}{-104} \begin{bmatrix} 13 & 0\\ -7 & -8 \end{bmatrix} = \begin{bmatrix} 96 & 104\\-60 & 52 \end{bmatrix} \frac{1}{-104} \begin{bmatrix} 13 & 0\\ -7 & -8 \end{bmatrix}$

Because scalar multiplication is commutative, we can move this factor to the end and do the matrix multiplication first to avoid fractions.

$X \begin{bmatrix} -8 & 0\\7 & 13 \end{bmatrix} \begin{bmatrix} 13 & 0\\ -7 & -8 \end{bmatrix} \frac{1}{-104} &= \begin{bmatrix} 96 & 104\\-60 & 52 \end{bmatrix} \begin{bmatrix} 13 & 0\\ -7 & -8 \end{bmatrix} \frac{1}{-104}\\X \begin{bmatrix} -104 & 0\\0 & -104 \end{bmatrix} \frac{1}{-104} &= \begin{bmatrix} 520 & -832\\-1144 & -416 \end{bmatrix} \frac{1}{-104}\\X \begin{bmatrix} 1 & 0\\0 & 1 \end{bmatrix} &= \begin{bmatrix} -5 & 8\\11 & 4 \end{bmatrix}\\X &= \begin{bmatrix} -5 & 8\\11 & 4 \end{bmatrix}$

Solve the matrix equation: $\begin{bmatrix} 11 & 2\\-5 & 7 \end{bmatrix} X + \begin{bmatrix} 15 \\-13 \end{bmatrix} = \begin{bmatrix} 10 \\13 \end{bmatrix}$

#### Example C

Solution: This equation is a little different. First, we have a matrix that we must subtract on both sides before we can multiply by the inverse of $\begin{bmatrix} 11 & 2\\-5 & 7 \end{bmatrix}.$

$\begin{bmatrix} 11 & 2\\-5 & 7 \end{bmatrix}X + \begin{bmatrix} 15 \\-13 \end{bmatrix} - \begin{bmatrix} 15 \\-13 \end{bmatrix} &= \begin{bmatrix} 10 \\13 \end{bmatrix} - \begin{bmatrix} 15 \\-13 \end{bmatrix} \\\begin{bmatrix} 11 & 2\\-5 & 7 \end{bmatrix}X &= \begin{bmatrix} -5 \\26\end{bmatrix}$

Second, $X$ , is not a $2 \times 2$ matrix. What are the dimensions of $X$ ? If we multiply a $2 \times 2$ matrix by a $2 \times 1$ matrix then we will get a $2 \times 1$ matrix, so $X$ is a $2 \times 1$ matrix. Let’s find the inverse of

$\begin{bmatrix} 11 & 2\\-5 & 7 \end{bmatrix}.$

$\begin{bmatrix} 11 & 2\\-5 & 7 \end{bmatrix}^{-1} = \frac{1}{87} \begin{bmatrix} 7 & -2\\5 & 11 \end{bmatrix}$

Now we can “left multiply” on both sides of the equation and solve for $X$ .

$\frac{1}{87}\begin{bmatrix} 7 & -2\\5 & 11 \end{bmatrix} \begin{bmatrix} 11 & 2\\-5 & 7 \end{bmatrix} &= \frac{1}{87} \begin{bmatrix} 7 & -2\\5 & 11 \end{bmatrix} \begin{bmatrix} -5 \\26 \end{bmatrix} \\\frac{1}{87}\begin{bmatrix} 87 & 0\\0 & 87 \end{bmatrix} X &= \frac{1}{87} \begin{bmatrix} -87 \\261 \end{bmatrix}\\\begin{bmatrix} 1 & 0\\0 & 1 \end{bmatrix}X &= \begin{bmatrix} -1\\3 \end{bmatrix}\\X &= \begin{bmatrix} -1 \\3 \end{bmatrix}$

Intro Problem Revisit Solve the equation: $\begin{bmatrix} 10 & 2\\8 & 4 \end{bmatrix}X = \begin{bmatrix} 130 \\116 \end{bmatrix}$

Solution: To isolate the variable matrix, denoted by $X$ , we need to get rid of the matrix being multiplied by $X$ on the left. Find the inverse of $\begin{bmatrix} 10 & 2\\8 & 4 \end{bmatrix}$ and multiply by it on the left of both sides of the equation as shown below.

$\begin{bmatrix} 10 & 2\\8 & 4 \end{bmatrix}^{-1} = \frac{1}{(10)(4)-(2)(8)} \begin{bmatrix} 4 & -2\\-8 & 10 \end{bmatrix} = \frac{1}{24} \begin{bmatrix} 4 & -2\\-8 & 10 \end{bmatrix}$

Now, multiply by this inverse on the left on both sides of the equation:

$\frac{1}{24} \begin{bmatrix} 4 & -2\\-8 & 10 \end{bmatrix} \begin{bmatrix} 10 & 2\\8 & 4 \end{bmatrix} X &= \frac{1}{24} \begin{bmatrix} 4 & -2\\-8 & 10 \end{bmatrix} \begin{bmatrix} 130\\116\end{bmatrix}\\\frac{1}{24} \begin{bmatrix} 24 & 0\\0 & 24 \end{bmatrix} X &= \frac{1}{24} \begin{bmatrix} 288\\120 \end{bmatrix}\\\begin{bmatrix} 1 & 0\\0 & 1 \end{bmatrix} X &= \begin{bmatrix} 12\\5 \end{bmatrix}\\X &= \begin{bmatrix} 12\\5 \end{bmatrix}$

Therefore, wood costs $12 per yard and hammers cost$5 apiece.

### Guided Practice

Solve the following matrix equations.

1. $\begin{bmatrix} 2 & -5\\6 & 1 \end{bmatrix} X = \begin{bmatrix} 39\\37 \end{bmatrix}$

2. $X \begin{bmatrix} -3 & 8\\-2 & 15 \end{bmatrix} = \begin{bmatrix} 0 & 87\\33 & -88 \end{bmatrix}$

3. $\begin{bmatrix} -1 & 3\\0 & 5 \end{bmatrix}X - \begin{bmatrix} 11 & 7\\13 & 21 \end{bmatrix} = \begin{bmatrix} -7 & 15 \\7 & 14 \end{bmatrix}$

1. “Left multiply” by the inverse on both sides.

$\frac{1}{32} \begin{bmatrix} 1 & 5\\-6 & 2 \end{bmatrix} \begin{bmatrix} 2 & -5\\6 & 1 \end{bmatrix} X &= \frac{1}{32} \begin{bmatrix} 1 & 5\\-6 & 2 \end{bmatrix} \begin{bmatrix} 39\\37 \end{bmatrix}\\\begin{bmatrix} 1 & 0\\0 & 1 \end{bmatrix} X &= \frac{1}{32} \begin{bmatrix} 224\\-160 \end{bmatrix}\\X &= \begin{bmatrix} 7\\-5 \end{bmatrix}$

2. “Right multiply” by the inverse on both sides.

$X \begin{bmatrix} -3 & 8\\-2 & 15 \end{bmatrix} \frac{1}{-29} \begin{bmatrix} 15 & -8\\2 & -3 \end{bmatrix} &= \begin{bmatrix} 0 & 87\\33 & -88 \end{bmatrix} \frac{1}{-29} \begin{bmatrix} 15 & -8\\2 & -3 \end{bmatrix}\\X \begin{bmatrix} 1 & 0\\0 & 1 \end{bmatrix} &= \frac{1}{-29} \begin{bmatrix} 174 & -261\\319 & 0 \end{bmatrix}\\X &= \begin{bmatrix} -6 & 9\\-11 & 0 \end{bmatrix}$

3. Add the matrix $\begin{bmatrix} 11 & 7\\13 & 21 \end{bmatrix}$ to both sides and then “left multiply” by the inverse on both sides.

$\begin{bmatrix} -1 & 3\\0 & 5 \end{bmatrix} X - \begin{bmatrix} 11 & 7\\13 & 21 \end{bmatrix} + \begin{bmatrix} 11 & 7\\13 & 21 \end{bmatrix} &= \begin{bmatrix} -7 & 15\\7 & 14 \end{bmatrix} + \begin{bmatrix} 11 & 7\\13 & 21 \end{bmatrix}\\\begin{bmatrix} -1 & 3\\0 & 5 \end{bmatrix} X &= \begin{bmatrix} 4 & 22\\20 & 35 \end{bmatrix}\\\frac{1}{-5} \begin{bmatrix} 5 & -3\\0 & -1 \end{bmatrix} \begin{bmatrix} -1 & 3\\0 & 5 \end{bmatrix} X &= \frac{1}{-5} \begin{bmatrix} 5 & -3\\0 & -1 \end{bmatrix} \begin{bmatrix} 4 & 22\\20 & 35 \end{bmatrix}\\\begin{bmatrix} 1 & 0\\0 & 1 \end{bmatrix}X &= \frac{1}{-5} \begin{bmatrix} -40 & 5 \\-20 & -35 \end{bmatrix}\\X &= \begin{bmatrix} 8 & -1\\4 & 7 \end{bmatrix}$

### Explore More

1. Explain the steps used to solve for matrix X in the equation $AX=B$ if A and B are 2x2 matrices.
2. How is solving a matrix equation like solving a linear equation? How is it different?
3. In the matrix equation $XA=B$ , can the equation be solved for matrix X if there is no inverse of A ?

Solve for the unknown matrix in each equation below.

1. $\begin{bmatrix} 2 & -1\\3 & 5 \end{bmatrix} X = \begin{bmatrix} -10 & 4\\11 & 6 \end{bmatrix}$
2. $X \begin{bmatrix} 6 & 7\\11 & -3 \end{bmatrix} = \begin{bmatrix} 47 & -56\\81 & 47 \end{bmatrix}$
3. $\begin{bmatrix} 5 & -10\\1 & 9 \end{bmatrix} X = \begin{bmatrix} 50\\-23 \end{bmatrix}$
4. $\begin{bmatrix} 2 & 8\\12 & -7 \end{bmatrix} X = \begin{bmatrix} -2 & -76\\-67 & 204 \end{bmatrix}$
5. $X \begin{bmatrix} 2 & 9\\5 & -1 \end{bmatrix} = \begin{bmatrix} 10 & -2\\22 & -42 \end{bmatrix}$
6. $\begin{bmatrix} -9 \\-77 \end{bmatrix} = \begin{bmatrix} 3 & 2\\-1 & -6 \end{bmatrix} X$
7. $\begin{bmatrix} -1 & 0\\7 & 2 \end{bmatrix} X + \begin{bmatrix} 2 & 6\\18 & -12 \end{bmatrix} = \begin{bmatrix} 5 & 5\\5 & 5 \end{bmatrix}$
8. $\begin{bmatrix} 2 & -8\\11 & -5 \end{bmatrix} X - \begin{bmatrix} -14\\0 \end{bmatrix} = \begin{bmatrix} -30\\31 \end{bmatrix}$
9. $\begin{bmatrix} -3 & -10\\0 & 1 \end{bmatrix} + X \begin{bmatrix} 2 & -3\\1 & 0 \end{bmatrix} = \begin{bmatrix} 1 & 2\\3 & 4 \end{bmatrix}$
10. $\begin{bmatrix} -2 \\10 \end{bmatrix} = \begin{bmatrix} -6 & 7\\1 & -2 \end{bmatrix} X - \begin{bmatrix} 12\\-15 \end{bmatrix}$
11. $\left(\begin{bmatrix} 2 & -3\\7 & 5 \end{bmatrix} + \begin{bmatrix} 3 & 1\\-3 & -2 \end{bmatrix}\right) X + \begin{bmatrix} 3 & -1\\2 & 5 \end{bmatrix} = \begin{bmatrix} -66 & 43\\-21 & 54 \end{bmatrix}$
12. $X \left(\begin{bmatrix} 5 & -1\\2 & 4 \end{bmatrix} - \begin{bmatrix} 3 & -1\\2 & 2 \end{bmatrix}\right) + \begin{bmatrix} 5 & -2\\9 & 7 \end{bmatrix} = \begin{bmatrix} 9 & -16\\11 & 13 \end{bmatrix}$