# The Matrix and Solving Systems with Matrices

This section covers:

# Introduction to the Matrix

A matrix (plural matrices) is sort of like a “box” of information where you are keeping track of things both right and left (columns), and up and down (rows). Usually a matrix contains numbers or algebraic expressions. You may have heard matrices called arrays, especially in computer science.

As an example, if you had three sisters, and you wanted an easy way to store their age and number of pairs of shoes, you could store this information in a matrix. The actual matrix is inside and includes the brackets:

$$\displaystyle \begin{array}{l}\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\begin{array}{*{20}{c}} {\text{Ashley}} & {\text{Emma}} & {\text{Chloe}} \end{array}\\\begin{array}{*{20}{c}} {\text{Age}} \\ {\text{Number of Pairs of Shoes}} \end{array}\text{ }\left[ {\begin{array}{*{20}{c}} {\text{23}} & {\,\,\,\,\,\,\,\,\,\text{18}} & {\,\,\,\,\,\,\,\,\,\text{15}} \\ \text{5} & {\,\,\,\,\,\,\,\,\text{23}} & {\,\,\,\,\,\,\,\,\,\text{12}} \end{array}} \right]\end{array}$$

Matrices are called multi-dimensional since we have data being stored in different directions in a grid. The dimensions of this matrix are  “2 x 3” or “2  by 3”, since we have 2 rows and 3 columns. (You always go down first, and then over to get the dimensions of the matrix).

Again, matrices are great for storing numbers and variables – and also great for solving systems of equations, which we’ll see later. Each number or variable inside the matrix is called an entry or element, and can be identified by subscripts. For example, for the matrix above, “Ashley’s number of pairs of shoes (5)” would be identified as $${{a}_{{2,1}}}$$, since it’s on the 2nd row and it’s the 1st entry.

Let’s look at a matrix that contains numbers and see how we can add and subtract matrices.

Let’s say you’re in avid reader, and in June, July, and August you read fiction and non-fiction books, and magazines, both in paper copies and online. You want to keep track of how many different types of books and magazines you read, and store that information in matrices. Here is that information, and how it would look in matrix form:

June July August
 Paper Online Fiction 2 4 Non-Fiction 3 1 Magazines 4 5
 Paper Online Fiction 3 2 Non-Fiction 1 1 Magazines 5 3
 Paper Online Fiction 1 3 Non-Fiction 2 3 Magazines 4 6

Matrix Form:  $$\left[ {\begin{array}{*{20}{c}} 2 & 4 \\ \begin{array}{l}3\\4\end{array} & \begin{array}{l}1\\5\end{array} \end{array}} \right]$$

Matrix Form:  $$\left[ {\begin{array}{*{20}{c}} 3 & 2 \\ \begin{array}{l}1\\5\end{array} & \begin{array}{l}1\\3\end{array} \end{array}} \right]$$

Matrix Form:  $$\left[ {\begin{array}{*{20}{c}} 1 & 3 \\ \begin{array}{l}2\\4\end{array} & \begin{array}{l}3\\6\end{array} \end{array}} \right]$$

We can add matrices if the dimensions are the same; since the three matrices are all “3  by  2”, we can add them. For example, if we wanted to know the total number of each type of book/magazine we read, we could add each of the elements to get the sum:

<

$$\displaystyle \require{cancel} \color{#800000}{{\left[ {\begin{array}{*{20}{c}} 2 & 4 \\ \begin{array}{l}3\\4\end{array} & \begin{array}{l}1\\5\end{array} \end{array}} \right]\,\,+\,\,\left[ {\begin{array}{*{20}{c}} 3 & 2 \\ \begin{array}{l}1\\5\end{array} & \begin{array}{l}1\\3\end{array} \end{array}} \right]\,\,\,+\,\,\left[ {\begin{array}{*{20}{c}} 1 & 3 \\ \begin{array}{l}2\\4\end{array} & \begin{array}{l}3\\6\end{array} \end{array}} \right]}}\,\,=\,\,\left[ {\begin{array}{*{20}{c}} {2+3+1} & {4+2+3} \\ \begin{array}{l}3+1+2\\4+5+4\end{array} & \begin{array}{l}1+1+3\\5+3+6\end{array} \end{array}} \right]\,\,=\,\,\left[ {\begin{array}{*{20}{c}} 6 & 9 \\ 6 & 5 \\ {13} & {14} \end{array}} \right]$$

Thus we could see that we read 6 paper fiction, 9 online fiction, 6 paper non-fiction, 5 online non-fiction books, and 13 paper and 14 online magazines.

We could also subtract matrices this same way.

If we wanted to see how many book and magazines we would have read in August if we had doubled what we actually read, we could multiply the August matrix by the number 2. This is called matrix scalar multiplication; a scalar is just a single number that we multiply with every entry. Note that this is not the same as multiplying 2 matrices together (which we’ll get to next):

$$\displaystyle \color{#800000}{{2\left[ {\begin{array}{*{20}{c}} 1 & 3 \\ \begin{array}{l}2\\4\end{array} & \begin{array}{l}3\\6\end{array} \end{array}} \right]}}\,=\,\left[ {\begin{array}{*{20}{c}} {1\times 2} & {3\times 2} \\ {2\times 2} & {3\times 2} \\ {4\times 2} & {6\times 2} \end{array}} \right]\,=\,\left[ {\begin{array}{*{20}{c}} 2 & 6 \\ 4 & 6 \\ 8 & {12} \end{array}} \right]$$

# Multiplying Matrices

Multiplying matrices is a little trickier. First of all, you can only multiply matrices if the dimensions “match”; the second dimension (columns) of the first matrix has to match the first dimension (rows) of the second matrix, or you can’t multiply them. Think of it like the inner dimensions have to match, and the resulting dimensions of the new matrix are the outer dimensions.

Here’s an example of matrices with dimensions that would work:

Notice how the “middle” or “inner” dimensions of the first matrices have to be the same (in this case, “2”), and the new matrix has the “outside” or “outer” dimensions of the first two matrices (“3 by 5”).

Now, let’s do a real-life example to see how the multiplication works. Let’s say we want to find the final grades for 3 girls, and we know what their averages are for tests, projects, homework, and quizzes. We also know that tests are 40% of the grade, projects 15%, homework 25%, and quizzes 20%.

Here’s the data we have:

 Student Tests Projects Homework Quizzes Alexandra 92 100 89 80 Megan 72 85 80 75 Brittney 88 78 85 92
 Type Weight Tests 40%   (.4) Projects 15%   (.15) Homework 25%   (.25) Quizzes 20%   (.2)

Let’s organize the following data into two matrices, and perform matrix multiplication to find the final grades for Alexandra, Megan, and Brittney. To do this, you have to multiply in the following way:

Just remember when you put matrices together with matrix multiplication, the columns (what you see across) on the first matrix have to correspond to the rows down on the second matrix. You should end up with entries that correspond with the entries of each row in the first matrix.

For example, with the problem above, the columns of the first matrix each had something to do with Tests, Projects, Homework, and Quizzes (grades). The row down on the second matrix each had something to do with the same four items (weights of grades). But then we ended up with information on the three girls (rows down on the first matrix).

Alexandra has a 90, Megan has a 77, and Brittney has an 87. See how cool this is?  Matrices are really useful for a lot of applications in “real life”!

Now let’s do another example; let’s multiply the following matrices:

Don’t worry; probably most of the time you’ll be doing matrix multiplication will be in the calculator!

Oh, one more thing! Remember that multiplying matrices is not commutative (order makes a difference), but is associative (you can change grouping of matrices when you multiply them). Multiplying matrices is also distributive (you can “push through” a matrix through parentheses), as long as the matrices have the correct dimensions to be multiplied.

# Matrices in the Graphing Calculator

The TI graphing calculator is great for matrix operations! Here are some basic steps for storing, multiplying, adding, and subtracting matrices:

(Note that you can also enter matrices using ALPHA ZOOM and the arrow keys in the newer graphing calculators.)

We’ll learn other ways to use the calculator with matrices a little later.

# Determinants,  the Matrix Inverse, and the Identity Matrix

Soon we will be solving Systems of Equations using matrices, but we need to learn a few mechanics first!

<

Most square matrices (same dimension down and across) have what we call a determinant, which we’ll need to get the multiplicative inverse of that matrix. The inverse of a matrix is what we multiply that square matrix by to get the identity matrix. We’ll use the inverses of matrices to solve Systems of Equations; the inverses will allow us to get variables by themselves on one side (like “regular” algebra). You’ll solve these mainly by using your calculator, but you’ll also have to learn how to get them “by hand”.

Note that the determinant of a matrix can be designated by $$\det \left[ \text{A} \right]$$  or  $$\left| \text{A} \right|$$, and the inverse of a matrix by  $${{\text{A}}^{{-1}}}$$.

Let’s do some examples and first get the determinant of matrices (which we can get easily on a calculator!). The determinant is always just a scalar (number), and you’ll see it with two lines around the matrix:

Now let’s use the determinant to get the inverse of a matrix. We’ll only work with 2 by 2 matrices, since you’ll probably be able to use the calculator for larger matrices. Note again that only square matrices have inverses, but there are square matrices that don’t have one (when the determinant is 0):

Note that a matrix, multiplied by its inverse, if it’s defined, will always result in what we call an Identity Matrix:  $$\displaystyle \left[ {\begin{array}{*{20}{c}} 3 & 1 \\ 4 & 8 \end{array}} \right]\,\times \,\left[ {\begin{array}{*{20}{c}} {\frac{2}{5}} & {-\frac{1}{{20}}} \\ {-\frac{1}{5}} & {\frac{3}{{20}}} \end{array}} \right]=\left[ {\begin{array}{*{20}{c}} 1 & 0 \\ 0 & 1 \end{array}} \right]$$. An identity matrix has 1’s along the diagonal starting with the upper left, and 0’s everywhere else.

When you multiply a square matrix with an identity matrix, you just get that matrix back: $$\displaystyle \left[ {\begin{array}{*{20}{c}} 3 & 1 \\ 4 & 8 \end{array}} \right]\,\times \,\left[ {\begin{array}{*{20}{c}} 1 & 0 \\ 0 & 1 \end{array}} \right]=\left[ {\begin{array}{*{20}{c}} 3 & 1 \\ 4 & 8 \end{array}} \right]$$. Think of an identity matrix like “1” in regular multiplication (the multiplicative identity), and the inverse matrix like a reciprocal (the multiplicative inverse).

# Solving Systems with Matrices

Why are we doing all this crazy math? Because we can solve systems with the inverse of a matrix, since the inverse is sort of like dividing to get the variables all by themselves on one side.

To solve systems with matrices, we use $$\displaystyle X={{A}^{{-1}}}B$$. Here is why, if you’re interested in the “theory” (the column on the right provides an example with “regular” multiplication). (is the identity matrix.)

$$\displaystyle \begin{array}{l}\,\,\,\,\,\,\,\,AX=B\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,5x=10\\{{A}^{{-1}}}AX={{A}^{{-1}}}B\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\frac{1}{5}\cdot 5x=\frac{1}{5}\cdot 10\\\,\,\,\,\,\,\,\,\,\,IX={{A}^{{-1}}}B\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,1x=2\\\,\,\,\,\,\,\,\,\,\,\,X={{A}^{{-1}}}B\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,x=2\end{array}$$

Let’s take the system of equations that we worked with earlier and show that it can be solved using matrices:

(It is important to note that if we are trying to solve a system of equations and the determinant turns out to be 0, that system either has an infinite number of solutions, or no solution.)

# Solving Systems with Reduced Row Echelon Form

There’s another way to solve systems by converting a systems’ matrix into reduced row echelon form, where we can put everything in one matrix (called an augmented matrix).

I show how to use this method by hand here in the Solving Systems using Reduced Row Echelon Form section, but here I’ll just show you how to easy it is to solve using RREF in a graphing calculator:

A little easier, right?

<

# Solving Matrix Equations

Here are a couple more types of matrices problems you might see:

## Matrix Multiplication Problem

Let $$P=\left[ {\begin{array}{*{20}{c}} 4 & {-6} \\ {-2} & 8 \end{array}} \right]$$.   (a) Find $$2P$$,    (b) Find $${{P}^{2}}$$,   (c) Find $$Q$$ when $$P\times Q=\left[ {\begin{array}{*{20}{c}} 5 \\ 0 \end{array}} \right]$$.

Solutions:

(a)  When we multiply a matrix by a scalar (number), we just multiply all elements in the matrix by that number.  So $$\displaystyle 2P=2\left[ {\begin{array}{*{20}{c}} {2\times 4} & {2\times -6} \\ {2\times -2} & {2\times 8} \end{array}} \right]\,=\,\left[ {\begin{array}{*{20}{c}} 8 & {-12} \\ {-4} & {16} \end{array}} \right]$$.

(b)  When we square P, we just multiply it by itself.  Let’s do this “by hand”:

$$\displaystyle {{P}^{2}}=\,\left[ {\begin{array}{*{20}{c}} 4 & {-6} \\ {-2} & 8 \end{array}} \right]\,\times \,\left[ {\begin{array}{*{20}{c}} 4 & {-6} \\ {-2} & 8 \end{array}} \right]\,=\left[ {\begin{array}{*{20}{c}} {(4\times 4)+(-6\times -2)} & {(4\times -6)+(-6\times 8)} \\ {(-2\times 4)+(8\times -2)} & {(-2\times -6)+(8\times 8)} \end{array}} \right]\,=\,\left[ {\begin{array}{*{20}{c}} {28} & {-72} \\ {-24} & {76} \end{array}} \right]$$

(c)  Since $$\displaystyle \,\left[ {\begin{array}{*{20}{c}} 4 & {-6} \\ {-2} & 8 \end{array}} \right]\,\times \,Q=\left[ {\begin{array}{*{20}{c}} 5 \\ 0 \end{array}} \right]$$, we have $$\displaystyle Q=\,{{\left[ {\begin{array}{*{20}{c}} 4 & {-6} \\ {-2} & 8 \end{array}} \right]}^{{-1}}}\times \,\left[ {\begin{array}{*{20}{c}} 5 \\ 0 \end{array}} \right]$$ (sort of like when we’re solving a system). Let’s use our calculator to put $$P$$ in $$[A]$$ and $$\displaystyle \left[ {\begin{array}{*{20}{c}} 5 \\ 0 \end{array}} \right]$$ in $$[B]$$. Then $$\displaystyle \,{{\left[ A \right]}^{{-1}}}\times \,\left[ B \right]=\left[ {\begin{array}{*{20}{c}} 2 \\ {.5} \end{array}} \right]$$.

### Matrix Equation Problem:

This one’s a little trickier, since it doesn’t really look like a systems problem, but you solve it the same way:

Solve the matrix equation for $$X$$ ($$X$$ will be a matrix):

$$\displaystyle \left[ {\begin{array}{*{20}{c}} 2 & 3 \\ 1 & {-4} \end{array}} \right]X-\,\,\left[ {\begin{array}{*{20}{c}} 4 & {-6} \\ {-2} & 8 \end{array}} \right]\,=\,\left[ {\begin{array}{*{20}{c}} 5 & 0 \\ {-2} & 3 \end{array}} \right]$$

Solution:

Let’s add the second matrix to both sides, to get $$X$$ and its coefficient matrix alone by themselves. Then we’ll “divide” by the matrix in front of $$X$$. Watch the order when we multiply by the inverse (matrix multiplication is not commutative), and thank goodness for the calculator!

\displaystyle \begin{align}\left[ {\begin{array}{*{20}{c}} 2 & 3 \\ 1 & {-4} \end{array}} \right]\,X-\,\left[ {\begin{array}{*{20}{c}} 4 & {-6} \\ {-2} & 8 \end{array}} \right]+\left[ {\begin{array}{*{20}{c}} 4 & {-6} \\ {-2} & 8 \end{array}} \right]&=\,\left[ {\begin{array}{*{20}{c}} 5 & 0 \\ {-2} & 3 \end{array}} \right]\,+\left[ {\begin{array}{*{20}{c}} 4 & {-6} \\ {-2} & 8 \end{array}} \right]\\\,\,\,\left[ {\begin{array}{*{20}{c}} 2 & 3 \\ 1 & {-4} \end{array}} \right]\,X&=\,\left[ {\begin{array}{*{20}{c}} 9 & {-6} \\ {-4} & {11} \end{array}} \right]\\X&={{\left[ {\begin{array}{*{20}{c}} 2 & 3 \\ 1 & {-4} \end{array}} \right]}^{{-1}}}\,\left[ {\begin{array}{*{20}{c}} 9 & {-6} \\ {-4} & {11} \end{array}} \right]\,=\,\left[ {\begin{array}{*{20}{c}} {\frac{{24}}{{11}}} & {\frac{9}{{11}}} \\ {\frac{{17}}{{11}}} & {-\frac{{28}}{{11}}} \end{array}} \right]\end{align}

Watch order!

We can check it back: $$\displaystyle \left[ {\begin{array}{*{20}{c}} 2 & 3 \\ 1 & {-4} \end{array}} \right]\left[ {\begin{array}{*{20}{c}} {\tfrac{{24}}{{11}}} & {\tfrac{9}{{11}}} \\ {\tfrac{{17}}{{11}}} & {-\tfrac{{28}}{{11}}} \end{array}} \right]-\left[ {\begin{array}{*{20}{c}} 4 & {-6} \\ {-2} & 8 \end{array}} \right]=\left[ {\begin{array}{*{20}{c}} 5 & 0 \\ {-2} & 3 \end{array}} \right]$$?  It works!

# Cramer’s Rule

Sometimes you’ll have to learn Cramer’s Rule, which is another way to solve systems with matrices. Cramer’s Rule was named after the Swiss mathematician Gabriel Cramer, who also did a lot of other neat stuff with math.

Cramer’s rule is all about getting determinants of the square matrices that are used to solve systems. It’s really not too difficult; it can just be a lot of work, so again, I’ll take the liberty of using the calculator to do most of the work 🙂

Let’s just show an example; let’s solve the following system using Cramer’s rule:  $$\displaystyle \begin{array}{l}\,2x+3y-\,\,z\,=\,15\\4x-3y-\,\,z\,=\,19\\\,\,x\,-\,3y+\,3z\,=\,-4\end{array}$$

To solve for $$x, y$$, and $$z$$, we need to get the determinants of four matrices, the first one being the 3 by 3 matrix that holds the coefficients of $$x,y$$, and $$z$$. Let’s call this first determinant $$D$$;  $$\displaystyle D=\det \left[ {\begin{array}{*{20}{c}} 2 & 3 & {-1} \\ 4 & {-3} & {-1} \\ 1 & {-3} & 3 \end{array}} \right]=-54$$.

Now we’ll get a matrix called $${{D}_{x}}$$, which is obtained by “throwing away” the first ($$x$$) column, and replacing the numbers with the “answer” or constant column. So $$x$$. So $$\displaystyle {{D}_{x}}=\det \left[ {\begin{array}{*{20}{c}} {\boldsymbol{{15}}} & 3 & {-1} \\ {\boldsymbol{{19}}} & {-3} & {-1} \\ {\boldsymbol{{-4}}} & {-3} & 3 \end{array}} \right]=-270$$.

You can probably guess what the next determinant we need is: $${{D}_{y}}$$, which we get by “throwing away” the second column ($$y$$) of the original matrix and replacing the numbers with the constant column like we did earlier for the $$x$$. So $$\displaystyle {{D}_{y}}=\det \left[ {\begin{array}{*{20}{c}} 2 & {\boldsymbol{{15}}} & {-1} \\ 4 & {\boldsymbol{{19}}} & {-1} \\ 1 & {\boldsymbol{{-4}}} & 3 \end{array}} \right]=-54$$. Similarly, $$\displaystyle {{D}_{z}}=\det \left[ {\begin{array}{*{20}{c}} 2 & 3 & {\boldsymbol{{15}}} \\ 4 & {-3} & {\boldsymbol{{19}}} \\ 1 & {-3} & {\boldsymbol{{-4}}} \end{array}} \right]=108$$.

OK, now for the fun and easy part! To get the $$x, y$$, and $$z$$ answers to the system, you simply divide the determinants $${{D}_{x}}$$, $${{D}_{y}}$$, and $${{D}_{z}}$$, by the determinant $$D$$, respectively. So $$\displaystyle \left[ {\begin{array}{*{20}{c}} x \\ \begin{array}{l}y\\z\end{array} \end{array}} \right]\,=\,\left[ {\begin{array}{*{20}{c}} {\tfrac{{{{D}_{x}}}}{D}} \\ {\tfrac{{{{D}_{y}}}}{D}} \\ {\tfrac{{{{D}_{z}}}}{D}} \end{array}} \right]\,=\,\left[ {\begin{array}{*{20}{c}} {\tfrac{{-270}}{{-54}}} \\ {\tfrac{{-54}}{{-54}}} \\ {\tfrac{{108}}{{-54}}} \end{array}} \right]\,=\,\left[ {\begin{array}{*{20}{c}} 5 \\ 1 \\ {-2} \end{array}} \right]$$.

Now we know that $$x=5$$, $$y=1$$, and $$z=-2$$.

Note that, like the other systems, we can do this for any system where we have the same numbers of equations as unknowns.

# Number of Solutions when Solving Systems with Matrices

Most systems problems that you’ll deal with will just have one solution.  (These equations are called independent or consistent). But, like we learned in the Systems of Linear Equations and Word Problems Section here, sometimes we have systems where we either have no solutions or an infinite number of solutions.

Without going too much into Geometry, let’s look at what it looks like when three systems (each system looks like a “plane” or a piece of paper) have an infinite number of solutions, no solutions, and one solution, respectively:

Systems that have an infinite number of solutions (called dependent or coincident) will have two equations that are basically the same. One row of the coefficient matrix (and the corresponding constant matrix) is a multiple of another row. Then it’s like you’re trying to solve a system with only two equations, but three unknowns.

A system that has an infinite number of solutions may look like this: \displaystyle \begin{align}2x+2y-\,z\,&=16\\4x+4y-2z&=32\\\,\,x\,-\,3y+3z&=-4\end{align}.

Systems with no solutions (called inconsistent) will have one row of the coefficient matrix a multiple of another, but the coefficient matrix will not have this. So a system that has no solutions may look like this: \displaystyle \begin{align}2x+2y-\,z\,&=16\\4x+4y-2z&=\,10\\\,\,x\,-\,3y+3z&=-4\end{align}.

When you try to these types of systems in your calculator (using matrices), you’ll get an error since the determinant of the coefficient matrix will be 0. This is called a singular matrix and the calculator will tell you so:

Also, if you put these systems in a 3 by 4 matrix and use RREF, you’ll be able to see what is happening. For the systems with infinite solutions, you can see you won’t get an identity matrix, and that 0 always equals 0. You can actually define the set of solutions by just allowing $$z$$ to be anything, and then, from the other rows, solve for $$x$$ and $$y$$ in terms of $$z$$:  This would look like  \displaystyle \begin{align}1x+0y+.375z&=5\\0x+1y-.875z&=3\\\,\,\,\,\,\,\,\text{For all }z,\,\,\,\,\,\,0&=0\end{align}, so the solution set for $${x,y,z}$$ is $$\displaystyle \{5-.375z,5-.375z,z\}$$. (This may be a little advanced for high school 🙂 )

For the system with no solutions, you’ll get this, where you can see that you still don’t have an identity matrix, and 0 can never equal 1 from the last row:

# Applications of Matrices

Matrices can be used for many applications, including combining data, finding areas, and solving systems. Here are some examples of those applications.

## Using the Determinant to get the Area of a Triangle

In your Geometry class, you may learn a neat trick where we can get the area of a triangle using the determinant of a matrix.

<

Let’s say we have the three coordinate points of that triangle, $$\left( {{{a}_{1}},{{b}_{1}}} \right),\left( {{{a}_{2}},{{b}_{2}}} \right)$$, and $$\left( {{{a}_{3}},{{b}_{3}}} \right)$$. The formula for the area of the triangle bounded by those points is:

$$\displaystyle \text{Area of Triangle with points }\left( {{{a}_{1}},{{b}_{1}}} \right),\,\left( {{{a}_{2}},{{b}_{2}}} \right)\,\,\text{and}\,\left( {{{a}_{3}},{{b}_{3}}} \right)=\pm \frac{1}{2}\left| {\begin{array}{*{20}{c}} {{{a}_{1}}} & {{{b}_{1}}} & 1 \\ {{{a}_{2}}} & {{{b}_{2}}} & 1 \\ {{{a}_{3}}} & {{{b}_{3}}} & 1 \end{array}} \right|$$

(Try both plus and minus, but only take positive answer)

Let’s do an example:

Find the area of the triangle bounded by the points , $$\left( {-1,3} \right),\left( {0,-5} \right)$$ and $$\left( {2,8} \right)$$.

Solution:

Use the equation above to find the area:

\displaystyle \begin{align}\pm \frac{1}{2}\left| {\begin{array}{*{20}{c}} {{{a}_{1}}} & {{{b}_{1}}} & 1 \\ {{{a}_{2}}} & {{{b}_{2}}} & 1 \\ {{{a}_{3}}} & {{{b}_{3}}} & 1 \end{array}} \right|&=\pm \frac{1}{2}\left| {\begin{array}{*{20}{c}} {-1} & 3 & 1 \\ 0 & {-5} & 1 \\ 2 & 8 & 1 \end{array}} \right|=\pm \frac{1}{2}\left[ {\left( {-1} \right)\left( {-5\cdot 1-1\cdot 8} \right)-3\left( {0\cdot 1-1\cdot 2} \right)+1\left( {0\cdot 8–5\cdot 2} \right)} \right]\\&=\pm \frac{1}{2}\left( {29} \right)=\frac{1}{2}\left( {29} \right)=14.5\end{align}

We take the positive only since the determinant is positive.

## Matrix Multiplication Word Problem:

The following matrix consists of a shoe store’s inventory of flip flops, clogs, and Mary Janes in sizes small, medium, and large:

The store wants to know how much their inventory is worth for all the shoes. How should we set up the matrix multiplication to determine this the best way?

Solution:

The trick for these types of problems is to line up what matches (flip flops, clogs, and Mary Janes), and that will be “in the middle” when we multiply. This way our dimension will line up. Another way to look at it is we need to line up what goes across the first matrix with what goes down the second matrix, and we’ll end up with what goes down the first matrix for these types of problems.

Our matrix multiplication will look like this, even though our tables look a little different (I did this on a calculator):

We’ll have $1050 worth of small shoes,$2315 worth of medium shoes, and $1255 worth of large shoes for a total of$4620.

## Another Matrix Multiplication Word Problem:

A nut distributor wants to know the nutritional content of various mixtures of almonds, cashews, and pecans. Her supplier has provided the following nutrition information:

 Almonds Cashews Pecans Protein (g/cup) 26.2 21 10.1 Carbs (g/cup) 40.2 44.8 14.3 Fat (g/cup) 71.9 63.5 82.8

Her first mixture, a protein blend, consists of 6 cups of almonds, 3 cups of cashews, and 1 cup of pecans. Her second mixture, a low fat mix, consists of 3 cups of almonds, 6 cups of cashews, and 1 cup of pecans. Her third mixture, a low carb mix consists of 3 cups of almonds, 1 cup of cashews, and 6 cups of pecans. Determine the amount of protein, carbs, and fats in a 1 cup serving of each of the mixtures.

Solution:

Sometimes we can just put the information we have into matrices to sort of see what we are going to do from there. It makes sense to put the first group of data into a matrix with Almonds, Cashews, and Pecans as columns, and then put the second group of data into a matrix with information about Almonds, Cashews, and Pecans as rows. This way the columns of the first matrix lines up with the rows of the second matrix, and we can perform matrix multiplication. This way we get rid of the number of cups of Almonds, Cashews, and Pecans, which we don’t need. Here is the information we have in table/matrix form:

Then we can multiply the matrices (we can use a graphing calculator) since we want to end up with the amount of Protein, Carbs, and Fat in each of the mixtures. The product of the matrices consists of rows of Protein, Carbs, and Fat, and columns of the Protein, Low Fat, and Low Carb mixtures:

$$\displaystyle \begin{array}{l}\,\,\,\,\,\,\,\,\,\,\,\,\cancel{{\text{Almonds, Cashews and Pecans}}}\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\text{Protein, Low-Fat and Carb }\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\text{Protein, Low-Fat and Carb}\\\,\,\begin{array}{*{20}{c}} {\text{Protein}} \\ {\text{Carbs}} \\ {\text{Fat}} \end{array}\,\,\,\,\,\left[ {\begin{array}{*{20}{c}} {26.2} & {21} & {10.1} \\ {40.2} & {44.8} & {14.3} \\ {71.9} & {63.5} & {82.8} \end{array}} \right]\,\,\,\,\,\,\times \,\,\,\cancel{{\begin{array}{*{20}{c}} {\text{Almonds}} \\ {\text{Cashews}} \\ {\text{Pecans}} \end{array}}}\,\,\,\,\,\left[ {\begin{array}{*{20}{c}} 6 & 3 & 3 \\ 3 & 6 & 1 \\ 1 & 1 & 6 \end{array}} \right]\,\,\,\,\,\,\,=\,\,\,\begin{array}{*{20}{c}} {\text{Protein}} \\ {\text{Carbs}} \\ {\text{Fat}} \end{array}\,\,\,\,\left[ {\begin{array}{*{20}{c}} {230.3} & {214.7} & {160.2} \\ {389.9} & {403.7} & {251.2} \\ {704.7} & {679.5} & {776} \end{array}} \right]\end{array}$$

But we have to be careful, since these amounts are for 10 cups (add down to see we’ll get 10 cups for each mixture in the second matrix above). Also, notice how the cups unit “canceled out” when we did the matrix multiplication (grams/cup time cups = grams).

To get the answers, we have to divide each answer by 10 to get grams per cup. The numbers in bold are our answers:

 Protein Blend Low Fat Mixture Low Carb Mixture Protein (grams) 230.3/10 = 23.03 214.7/10 = 21.47 160.2/10 = 16.02 Carbs (grams) 389.9/10 = 38.9 403.7/10=40.37 251.2/10 = 25.12 Fat (grams) 704.7/10 = 70.47 679.5/10 = 67.95 776/10 = 77.6

## Matrix Word Problem when Tables are not Given:

Sometimes you’ll get a matrix word problem where just numbers are given; these are pretty tricky. Here is one:

An outbreak of Chicken Pox hit the local public schools. Approximately 15% of the male and female juniors and 25% of the male and female seniors are currently healthy, 35% of the male and female juniors and 30% of the male and female seniors are currently sick, and 50% of the male and female juniors and 45% of the male and female seniors are carriers of Chicken Pox.

There are 100 male juniors, 80 male seniors, 120 female juniors, and 100 female seniors.

Using two matrices and one matrix equation, find out how many males and how many females (don’t need to divide by class) are healthy, sick, and carriers.

Solution:

The best way to approach these types of problems is to set up a few manual calculations and see what we’re doing. For example, to find out how many healthy males we would have, we’d set up the following equation and do the calculation: $$.15(100)+.25(80)=35$$. Likewise, to find out how many females are carriers, we can calculate:  $$.50(120)+.45(100)=105$$.

We can tell that this looks like matrix multiplication. And since we want to end up with a matrix that has males and females by healthy, sick and carriers, we know it will be either a 2 x 3 or a 3 x 2.  But since we know that we have both juniors and seniors with males and females, the first matrix will probably be a 2 x 2. That means, in order to do matrix multiplication, the second matrix that holds the %’s of students will have to be a 2 x 3, since there are 3 types of students, healthy (H), sick (S), and carriers (C). Notice how the percentages in the rows in the second matrix add up to 100%. Also notice that if we add up the number of students in the first matrix and the last matrix, we come up with 400.

We can come up with the following matrix multiplication:

$$\displaystyle \begin{array}{l}\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\text{Junior}\,\,\,\,\,\,\text{Senior}\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\text{H}\,\,\,\,\,\,\,\,\,\text{S}\,\,\,\,\,\,\,\,\text{C}\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\text{H}\,\,\,\,\,\,\,\text{S}\,\,\,\text{ }\,\,\,\,\text{C}\\\begin{array}{*{20}{c}} {\text{Male}} \\ {\text{Female}} \end{array}\,\,\,\left[ {\begin{array}{*{20}{c}} {100} & {80} \\ {120} & {100} \end{array}} \right]\,\,\times \,\begin{array}{*{20}{c}} {\text{Junior}} \\ {\text{Senior}} \end{array}\,\,\,\left[ {\begin{array}{*{20}{c}} {.15} & {.35} & {.50} \\ {.25} & {.30} & {.45} \end{array}} \right]\,\,=\,\,\left[ {\begin{array}{*{20}{c}} {35} & {59} & {86} \\ {43} & {72} & {105} \end{array}} \right]\begin{array}{*{20}{c}} {\text{Male}} \\ {\,\,\,\,\,\,\text{Female}} \end{array}\end{array}$$

There will be 35 healthy males, 59 sick males, and 86 carrier males, 43 healthy females, 72 sick females, and 95 carrier females. Pretty clever!

## Matrix Multiplication when Diagonals are Answers:

The first table below show the points awarded by judges at a state fair for a crafts contest for Brielle, Brynn, and Briana. The second table shows the multiplier used for the degree of difficulty for each of the pieces the girls created. Find the total score for each of the girls in this contest.

Solution:

This one’s a little trickier since it looks like we have two 3 x 2 matrices (tables), but we only want to end up with three answers: the total score for each of the girls.

If we were to do the matrix multiplication using the two tables above, we would get:

$$\displaystyle \begin{array}{l}\,\,\,\,\,\,\,\,\,\cancel{{\text{Quilting, Butter and Knitting}}}\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\text{Brielle, Brynn and Briana }\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\text{Brielle, Brynn and Briana}\\\,\,\begin{array}{*{20}{c}} {\text{Brielle}} \\ {\text{Brynn}} \\ {\text{Briana}} \end{array}\,\,\,\,\,\left[ {\begin{array}{*{20}{c}} {16.4} & {19} & {17.5} \\ {12.4} & {13} & {16} \\ {15} & {20} & {17.5} \end{array}} \right]\,\,\,\,\,\times \,\,\,\cancel{{\begin{array}{*{20}{c}} {\text{Quilting}} \\ {\text{Butter}} \\ {\text{Knitting}} \end{array}}}\,\,\,\,\,\left[ {\begin{array}{*{20}{c}} 2 & 3 & 1 \\ 1 & 2 & 3 \\ 2 & 1 & 2 \end{array}} \right]\,\,\,\,=\,\,\,\,\begin{array}{*{20}{c}} {\text{Brielle}} \\ {\text{Brynn}} \\ {\text{Briana}} \end{array}\,\,\,\,\left[ {\begin{array}{*{20}{c}} {\color{#800000}{{86.8}}} & {104.7} & {108.4} \\ {69.8} & {\color{#800000}{{79.2}}} & {83.4} \\ {85} & {102.5} & {\color{#800000}{{110}}} \end{array}} \right]\end{array}$$

Hmm….this is interesting; we end up with a matrix with the girls’s names as both rows and columns.  It turns out that we have extraneous information in this matrix; we only need the information where the girls’ names line up. So we only look at the diagonal of the matrix to get our answers:  Brielle had 86.8 points, Brynn 79.2 points, and Briana 110 points.

What we really should have done with this problem is to use matrix multiplication separately for each girl; for example, for Brielle, we should have multiplied $$\left[ {\begin{array}{*{20}{c}} {16.4} & {19} & {17.5} \end{array}} \right]\,\times \,\left[ {\begin{array}{*{20}{c}} 2 \\ 1 \\ 2 \end{array}} \right]=\left[ {86.8} \right]$$ and so on. Oh well, no harm done; and now you’ll know what to do if you see these types of matrices problems.

## Using Matrices to Solve Systems

Solve these word problems with a system of equations. Write the system, the matrix equations, and solve:

## Finding the Numbers Word Problem:

The sum of three numbers is 26. The third number is twice the second, and is also 1 less than 3 times the first. What are the three numbers?

Solution:

Let’s translate word-for-word from English to Math that we learned in the Algebra Word Problem Section here.

Let $$x=$$ the first number, $$y=$$ the second number, and $$z=$$ the third number. So here are the three equations: $$\begin{array}{c}x+y+z=26\\z=2y\\z=3x-1\end{array}$$.

Note that, in the last equation, “one less than” means put the –1 at the end (do this with real numbers to see why).

We need to turn these equations into a matrix form that looks like this:

$$\displaystyle \begin{array}{l}\,\,x\text{, }y\text{, }z\text{ coefficients}\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\text{constants}\\\,\left[ {\begin{array}{*{20}{c}} {{{a}_{{11}}}} & {{{a}_{{12}}}} & {{{a}_{{13}}}} \\ {{{a}_{{21}}}} & {{{a}_{{22}}}} & {{{a}_{{23}}}} \\ {{{a}_{{31}}}} & {{{a}_{{32}}}} & {{{a}_{{33}}}} \end{array}} \right]\,\times \,\left[ {\begin{array}{*{20}{c}} x \\ \begin{array}{l}y\\z\end{array} \end{array}} \right]\,=\,\left[ {\begin{array}{*{20}{c}} {{{c}_{{11}}}} \\ {{{c}_{{21}}}} \\ {{{c}_{{31}}}} \end{array}} \right]\end{array}$$

We need to move things around so that all the variables (with coefficients in front of them) are on the left, and the numbers are on the right.  (It doesn’t matter which side; just watch for negatives). If we just have the variable in the equation, we put a 1 in the matrix; if we don’t have a variable or a constant (number), we put a 0 in the matrix.  So we get: $$\begin{array}{l}1x\,+\,\,1y\,+1z=26\\\,\,\,\,0x-2y+1z=0\\-3x+0y+1z=-1\end{array}$$ and in matrix form: $$\displaystyle \begin{array}{l}x, y, z\,\,\text{coefficients} \,\,\,\,\,\,\,\,\,\, \,\,\,\,\,\,\,\,\,\,\,\,\,\text{constants}\\\left[ {\begin{array}{*{20}{c}} 1 & 1 & 1 \\ 0 & {-2} & 1 \\ {-3} & 0 & 1 \end{array}} \right]\,\times \,\left[ {\begin{array}{*{20}{c}} x \\ \begin{array}{l}y\\z\end{array} \end{array}} \right]\,=\,\left[ {\begin{array}{*{20}{c}} {26} \\ 0 \\ {-1} \end{array}} \right]\end{array}$$.

Putting the matrices in the calculator, and using the methods from above, we get:

So the numbers are 5, 7, and 14. Much easier than figuring it out by hand!

## A Florist Must Make 5 Identical Bridesmaid Bouquets Systems Problem

Here’s a problem from the Systems of Linear Equations and Word Problems Section; we can see how much easier it is to solve with a matrix.

A florist is making 5 identical bridesmaid bouquets for a wedding. She has $610 to spend (including tax) and wants 24 flowers for each bouquet. Roses cost$6 each, tulips cost $4 each, and lilies cost$3 each. She wants to have twice as many roses as the other 2 flowers combined in each bouquet. How many roses, tulips, and lilies are in each bouquet?

Solution:

Let’s look at the question that is being asked and define our variables:  Let $$r=$$ the number of roses, $$t=$$ the number of tulips, and $$l=$$ the number of lilies. Let’s put the money terms together, and also the counting terms together:

$$\begin{array}{l}6r+4t+3l=610\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\text{(price of each flower times number of each flower = total price)}\\r=2(t+l)\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\text{(two times the sum of the other two flowers = number of roses)}\\r+t+l=5(24)\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\text{(total flowers = 5 bouquets, each with 24 flowers)}\end{array}$$

Now let’s put the system in matrices (let’s just use one matrix!) and on the calculator:

$$\displaystyle \begin{array}{l}\,\,\,\,\,x\,\,\,\,\,\,\,\,y\,\,\,\,\,\,\,\,z\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\text{constants}\\\left[ {\begin{array}{*{20}{c}} 6 & 4 & 3 \\ 1 & {-2} & {-2} \\ 1 & 1 & 1 \end{array}} \right]\,\,\,\,\times \,\,\,\,\left[ {\begin{array}{*{20}{c}} x \\ \begin{array}{l}y\\z\end{array} \end{array}} \right]\,\,\,\,=\,\,\,\,\left[ {\begin{array}{*{20}{c}} {610} \\ 0 \\ {120} \end{array}} \right]\end{array}$$

For all the bouquets, we’ll have 80 roses, 10 tulips, and 30 lilies.

For one bouquet, we’ll have $$\displaystyle \frac{1}{5}$$ of the flowers, so we’ll have 16 roses, 2 tulips, and 6 lilies.

## An Input Output Problem:

Input-output problems are seen in Economics, where we might have industries that produce for consumers, but also consume for themselves. An application of matrices is used in this input-output analysis, which was first proposed by Wassily Leontief; in fact he won the Nobel Prize in economics in 1973 for this work.

We can express the amounts (proportions) the industries consume in matrices, such as in the following problem:

The following coefficient matrix, or input-output matrix, shows the values of energy and manufacturing consumed internally needed to produce $1 of energy and manufacturing, respectively. In other words, of the value of energy produced (x for energy, y for manufacturing), 40 percent of it, or .40x pays to produce internal energy, and 25 percent of it, or .25x pays for internal manufacturing. Of the value of the manufacturing produced, .25y pays for its internal energy and .10y pays for manufacturing consumed internally. The inputs are the amount used in production, and the outputs are the amounts produced. $$\displaystyle \begin{array}{l}\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\text{Outputs:}\\\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\text{Energy}\,\,\,\,\,\,\,\text{Manufacturing}\\\,\,\,\,\text{Inputs}:\,\,\,\,\,\,\,\,\,\,\,\,\,\,\begin{array}{*{20}{c}} {\text{Energy }} \\ {\text{Manufacturing }} \end{array}\,\,\,\,\,\left[ {\begin{array}{*{20}{c}} {.40} & {\,\,\,\,\,\,\,\,.25} \\ {.25} & {\,\,\,\,\,\,\,\,\,.10} \end{array}} \right]\end{array}$$ (a) If the capacity of energy production is$15 million and the capacity of manufacturing production is $20 million, how much of each is consumed internally for capacity production? (b) How much energy and manufacturing must be produced to have$8 million worth of energy and $5 million worth of manufacturing available for consumer use? Solution: (a) If production capacities are$15 million for energy and $20 million for manufacturing, the amount consumed internally is $$\displaystyle \left[ {\begin{array}{*{20}{c}} {.4} & {.25} \\ {.25} & {.10} \end{array}} \right]\left[ {\begin{array}{*{20}{c}} {15} \\ {20} \end{array}} \right]=\left[ {\begin{array}{*{20}{c}} {11} \\ {5.75} \end{array}} \right]$$. So$11 million of energy is consumed internally and $5.75 million of manufacturing is consumed internally. This makes sense, for example, since we’re multiplying the proportion of energy consumed internally (.4) by the production capacity for energy ($15 million) and adding that to the proportion of energy needed for internal manufacturing (.25) by the production capacity of manufacturing ($20 million) to get the total dollar amount of energy needed or consumed internally ($11 million). Then we do the same for manufacturing.

(b) The amount of energy and manufacturing to be produced to have $8 million worth of energy and$5 million worth of manufacturing available for consumer (non-internal) use is solved using the following equation (we want what’s “left over” after the internal consumption, so it makes sense): $$\displaystyle \left[ {\begin{array}{*{20}{c}} x \\ y \end{array}} \right]-\left[ {\begin{array}{*{20}{c}} {.4} & {\,.25} \\ {.25} & {\,\,\,.10} \end{array}} \right]\left[ {\begin{array}{*{20}{c}} x \\ y \end{array}} \right]=\left[ {\begin{array}{*{20}{c}} 8 \\ 5 \end{array}} \right]$$. To get $$\left[ {\begin{array}{*{20}{c}} x \\ y \end{array}} \right]$$, we can use the formula $$X={{\left( {I-A} \right)}^{{-1}}}D={{\left( {\left[ {\begin{array}{*{20}{c}} 1 & 0 \\ 0 & 1 \end{array}} \right]-\left[ {\begin{array}{*{20}{c}} {.4} & {.25} \\ {.25} & {.10} \end{array}} \right]} \right)}^{{-1}}}\left[ {\begin{array}{*{20}{c}} 8 \\ 5 \end{array}} \right]=\left[ {\begin{array}{*{20}{c}} {17.7} \\ {10.5} \end{array}} \right]$$.

The two industries must produce $17.7 million worth of energy and$10.5 million worth of manufacturing, respectively.

Learn these rules, and practice, practice, practice!

For Practice: Use the Mathway widget below to try a Matrix Multiplication problem. Click on Submit (the blue arrow to the right of the problem) and click on Multiply the Matrices to see the answer.

You can also type in your own problem, or click on the three dots in the upper right hand corner and click on “Examples” to drill down by topic.

If you click on Tap to view steps, or Click Here, you can register at Mathway for a free trial, and then upgrade to a paid subscription at any time (to get any type of math problem solved!).

On to Introduction to Linear Programming  – you are ready!

<