# Introduction to the Matrix

A matrix (plural matrices) is sort of like a “table” 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). 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.

Again, matrices are great for storing numbers and variables – and also great for solving systems of equations, which we’ll see later.

# Adding and Subtracting Matrices

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 books 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 two 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. Again, always remember with matrices that you go down first and then over, to get their dimensions.

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; this is a weighted average! To do this, you have to multiply in the following way:

 Matrix Multiplication Think of turning the first matrix to the right and sideways, multiplying each number by the numbers in the second matrix, and then adding them together. For example, $$\begin{array}{l}\color{brown}{{\left( {92\times .4} \right)+\left( {100\times .15} \right)+\left( {89\times .25} \right)+\left( {80\times .2} \right)=90.05}}\\\color{blue}{{\left( {72\times .4} \right)+\left( {85\times .15} \right)+\left( {80\times .25} \right)+\left( {75\times .2} \right)=76.55}}\\\color{green}{{\left( {88\times .4} \right)+\left( {78\times .15} \right)+\left( {85\times .25} \right)+\left( {92\times .2} \right)=86.55}}\end{array}$$

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), and the middle “descriptions” (test, projects, etc.) went away.

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: (And don’t worry too much; most of the time you’ll be doing matrix multiplication 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, but I still like “naming” the matrices.)

 Matrices in the Calculator – Steps and Screens Let’s multiply the following matrices using the calculator: $$\color{#800000}{{\left[ {\begin{array}{*{20}{c}} 2 & {-1} \\ 3 & 2 \\ 7 & 5 \end{array}} \right]\,\times \,\left[ {\begin{array}{*{20}{c}} 0 & {-4} & 3 & 1 & 4 \\ 6 & 7 & 2 & 9 & {-3} \end{array}} \right]\,\,}}\,=\,\,\left[ {\begin{array}{*{20}{c}} {-6} & {-15} & 4 & {-7} & {11} \\ {12} & 2 & {13} & {21} & 6 \\ {30} & 7 & {31} & {52} & {13} \end{array}} \right]$$   To store matrices, hit, and you’ll get a screen with NAMES, MATH, and EDIT, where you can identify, perform operations, and edit (store) the matrices. Hittwice so that EDIT is highlighted; then hit ENTER. Then type 3, ENTER, 2, ENTER, (dimensions of the first matrix) and type in each value (rows at a time), followed by ENTER. This stores the first matrix in [A]: Note that you can use the cursor buttons to go back, forth, up or down to change any of the entries. When you’re done, hitto get back to the main screen.   We’ll store the second matrix in [B] by doing the same, but after scrolling to the right to EDIT, scroll down to highlight 2 (for [B]), and hit ENTER. Enter the dimensions and matrix the same way. Again, key into get back to the main screen. To multiply matrices, hit(or ENTER, since the cursor is at 1), then(or scroll down to 2 and hit ENTER), ENTER. You can also put a “times” sign between the matrices: You’ll get errors if the matrices you’re trying to multiply have incorrect dimensions; for example, you try to multiply a 3 by 2 matrix by a 1 by 5 matrix, instead of by a 2 by 5 matrix. You can add and subtract matrices this same way, if the matrices have the same dimensions.

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, designated by $$\det \left[ \text{A} \right]$$ or $$\left| \text{A} \right|$$, for example, which we’ll need to get the multiplicative inverse of that matrix. (The inverse of a matrix, designated by $${{\text{A}}^{{-1}}}$$, for example, is what we multiply that square matrix by to get the identity matrix, a matrix with 1‘s along the diagonal starting with the upper left element, and 0‘s everywhere else.)

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”.

I know all this sounds confusing, but let’s do some examples step-by-step. Let’s 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:

 Matrix Determinant Notes Calculator 2 by 2 matrix: With a 2 by 2 matrix, you start with the upper left corner, multiply diagonally down for the product, and then subtract the product where you multiply down diagonally from the upper right corner. To store matrices, hit, and you’ll get a screen with NAMES, MATH, and EDIT, where you can identify, perform operations, and edit (store) the matrices. To enter dimensions of the matrix, hittwice so that EDIT is highlighted; then hit ENTER. Then type 3, ENTER, 3, ENTER, (for example, for a 3 by 3 matrix) and type in each value (rows at a time), followed by ENTER. This stores the first matrix in [A].   When you’re done, hitto get back to the main screen.   After you’ve stored the square matrix, hit, and then hit once so that MATH is highlighted. Hit ENTER or 1 for det(.   Then type, and hit ENTER for matrix [A], or scroll to the matrix you want. Then hit ENTER once more and you’ll get the determinant!   If the matrix is not square, or doesn’t have a determinant, you’ll get an error. 3 by 3 matrix (Method 1): 3 by 3 matrix (Method 2): With a 3 by 3 matrix, there are a few ways to get the determinant. First, you can use determinants of 2 by 2 matrices:   (Method 1): Multiply each of the top numbers by the determinant of the 2 by 2 matrix that you get by crossing out the other numbers in that top number’s row and column. For the middle term, you have to subtract.     There are other ways to get determinants of 3 by 3 matrices; this is the way I prefer to do it:   (Method 2): Repeat the first two columns on the outside to the right of the matrix. Then, starting with the upper left corner, multiply diagonally down and add those three products (moving to the right). Then, starting back from the upper right corner, multiply diagonally down and subtract those three products (moving to the left).

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):

 Matrix Inverse Notes Calculator For Matrix $$A$$, inverse is $${{A}^{{-1}}}$$: $$\displaystyle \text{Inverse }\left[ {\begin{array}{*{20}{c}} {{{a}_{{11}}}} & {{{a}_{{12}}}} \\ {{{a}_{{21}}}} & {{{a}_{{22}}}} \end{array}} \right]=\frac{1}{{\det A}}\left[ {\begin{array}{*{20}{c}} {{{a}_{{22}}}} & {-{{a}_{{12}}}} \\ {-{{a}_{{21}}}} & {{{a}_{{11}}}} \end{array}} \right]$$   Examples: $$\displaystyle \color{#800000}{{\text{Inverse }\left[ {\begin{array}{*{20}{c}} 3 & 1 \\ 4 & 8 \end{array}} \right]}}=\frac{1}{{20}}\left[ {\begin{array}{*{20}{c}} 8 & {-1} \\ {-4} & 3 \end{array}} \right]=\left[ {\begin{array}{*{20}{c}} {\frac{2}{5}} & {-\frac{1}{{20}}} \\ {-\frac{1}{5}} & {\frac{3}{{20}}} \end{array}} \right]$$   $$\displaystyle \color{#800000}{{\text{Inverse }\left[ {\begin{array}{*{20}{c}} 3 & 6 \\ 2 & 4 \end{array}} \right]}}=\frac{1}{0}\left[ {\begin{array}{*{20}{c}} 4 & {-6} \\ {-2} & 3 \end{array}} \right]=\text{No Inverse}$$ By definition, the inverse of a matrix is the reciprocal of the determinant, multiplied by a “switch-op” matrix: switch the diagonals starting from the upper left, and take the opposites of the diagonals starting from the upper right.   Note that when the determinant is 0, the reciprocal is undefined; therefore, there is no inverse matrix. After you’ve stored the square matrix in [A], type, and hit ENTER for matrix [A], or scroll to the matrix you want.   Then hit(without the 2nd before it), and ENTER to get the inverse matrix. You can hit MATH ENTER (for Frac) to get the matrix in fractions:

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 element, 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}$$

Here’s an example:

 Convert System to Matrices Solve with Matrices Calculator $$\displaystyle \begin{array}{l}(1)x+(1)y=\text{ }6\\25x+50y=200\end{array}$$   $$\displaystyle \begin{array}{l}\,\,\,\,\,\,\,\,\,A\,\,\,\,\,\,\,\times \,\,\,\,\,X\,\,\,=\,\,\,\,B\\\left[ {\begin{array}{*{20}{c}} 1 & 1 \\ {25} & {50} \end{array}} \right]\,\,\times \,\,\left[ {\begin{array}{*{20}{c}} x \\ y \end{array}} \right]\,\,=\,\,\left[ {\begin{array}{*{20}{c}} 6 \\ {200} \end{array}} \right]\end{array}$$   $$\displaystyle \left[ {\begin{array}{*{20}{c}} 1 & 1 \\ {25} & {50} \end{array}} \right]$$ is called the coefficient matrix, $$\displaystyle \left[ {\begin{array}{*{20}{c}} x \\ y \end{array}} \right]$$ is called the variable matrix, and $$\displaystyle \left[ {\begin{array}{*{20}{c}} 6 \\ {200} \end{array}} \right]$$ is called the constant matrix. \displaystyle \begin{align}\left[ {\begin{array}{*{20}{c}} x \\ y \end{array}} \right]&={{\left[ {\begin{array}{*{20}{c}} 1 & 1 \\ {25} & {50} \end{array}} \right]}^{{-1}}}\times \,\,\,\,\left[ {\begin{array}{*{20}{c}} 6 \\ {200} \end{array}} \right]\\\,\,&=\,\frac{1}{{25\,}}\left[ {\begin{array}{*{20}{c}} {50} & {-1} \\ {-25} & 1 \end{array}} \right]\times \,\left[ {\begin{array}{*{20}{c}} 6 \\ {200} \end{array}} \right]\\\,\,\,&=\left[ {\begin{array}{*{20}{c}} 2 & {-\frac{1}{{25}}} \\ {-1} & {\frac{1}{{25}}} \end{array}} \right]\times \,\left[ {\begin{array}{*{20}{c}} 6 \\ {200} \end{array}} \right]\\\,\,\,&=\left[ {\begin{array}{*{20}{c}} {(2\times 6)+(-\frac{1}{{25}}\times 200)} \\ {(-1\times 6)+(\frac{1}{{25}}\times 200)} \end{array}} \right]=\left[ {\begin{array}{*{20}{c}} 4 \\ 2 \end{array}} \right]\end{align} $$\displaystyle \,\left( {\det \,\left[ {\begin{array}{*{20}{c}} 1 & 1 \\ {25} & {50} \end{array}} \right]=25} \right)$$   Thus, $$x=4$$ and $$y=2$$. Put 2 by 2 matrix $$\displaystyle \left[ {\begin{array}{*{20}{c}} 1 & 1 \\ {25} & {50} \end{array}} \right]$$ in [A], and 2 by 1 matrix $$\displaystyle \left[ {\begin{array}{*{20}{c}} 6 \\ {200} \end{array}} \right]$$ in [B]. Type, ENTER for matrix [A] (or scroll to the matrix you want). Hitto get the inverse of [A].   Then hit, scroll down to matrix [B], and type ENTER. Then hit ENTER once more. Note that you don’t need a “times” sign between [A]-1  and [B].   You’ll see that $$x=4$$ and $$y=2$$.

(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. See below.)

# 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:

 Convert System to Matrices RREF in Calculator \displaystyle \begin{align}5x-6y-7z&=7\\6x-4y+10z&=-34\\2x+4y-3z&=29\end{align}     $$\displaystyle \begin{array}{l}\,\,\,\,\,\,\,\,\,\,\,\,A\,\,\,\,\,\,\,\,\,\,\times \,\,\,\,\,\,\,\,\,X\,\,\,\,=\,\,\,\,\,B\\\left[ {\begin{array}{*{20}{c}} 5 & {-6} & {-7} \\ 6 & {-4} & {10} \\ 2 & 4 & {-3} \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}} 7 \\ {-34} \\ {29} \end{array}} \right]\end{array}$$ Put 3 by 4 matrix $$\displaystyle \left[ {\begin{array}{*{20}{c}} 5 & {-6} & {-7} & 7 \\ 6 & {-4} & {10} & {-34} \\ 2 & 4 & {-3} & {29} \end{array}} \right]$$ in [A].   After you’ve stored the square matrix, hit, and hitonce so that MATH is highlighted. Hit  for B (without the ENTER), or scroll up or down to “rref(“ and hit ENTER.   Then type, and hit ENTER for matrix [A], or scroll to the matrix you want. Then hit ENTER once more and you’ll a matrix that looks like this:. Ignore the identity matrix; $$\left[ {\begin{array}{*{20}{c}} {2} \\ {4} \\ {-3} \end{array}} \right]$$ is the answer for $$\left[ {\begin{array}{*{20}{c}} x \\ y \\ z \end{array}} \right]$$ ($$x=2,y=4,z=-3$$).

A little easier, right?

# Solving Matrix Equations

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

 Matrix Problem Solution 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]$$. (a)  When we multiply a matrix by a scalar (number), we just multiply all elements in the matrix by that number. Thus, $$\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”: \begin{align}{{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]\end{align} (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). Use the 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]$$. 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): Add the second matrix to both sides, to get $$X$$ and its coefficient matrix alone by themselves. Then, “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} 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:
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 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. Thus, $$\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$$. Thus, $$\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. Thus, $$\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. Thus, 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 rows in the constant matrix will not be in this same proportion. Thus, 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 solve either of 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: .

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,3+.875z,z\}$$ (let $$z$$ be anything, and solve for $$x$$ and $$y$$ in terms of $$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; the most common is solving system of equations, as in the following problem:

 Matrix Systems Problem Solution 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? 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; 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). 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}$$. Then, 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. 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: The numbers are 5, 7, and 14. Much easier than figuring it out by hand!

## 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 try an example. 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 the plus and minus, but only take positive answer.)

 Use the Determinant to get Area of Triangle Solution Find the area of the triangle bounded by the points $$\left( {-1,3} \right),\left( {0,-5} \right)$$, and $$\left( {2,8} \right)$$. Graph: Use the equation above to find the area:   \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( {\left( {-5} \right)\cdot 1-1\cdot 8} \right)-3\left( {0\cdot 1-1\cdot 2} \right)+1\left( {0\cdot 8-\left( {-5} \right)\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 when Tables are Given

Here are some matrix multiplication applications:

Matrix Multiplication Word Problem Solution
The following matrices consist of a shoe store’s inventory of flip flops, clogs, and Mary Janes in sizes small, medium, and large:

 Small Medium Large Flip Flops 20 35 15 Clogs 15 42 24 Mary Janes 18 38 22
 Price Flip Flops $15 Clogs$20 Mary Janes $25 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? 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 (and these categories will disappear, which is OK). This way our dimensions will line up when combining the two tables. Our matrix multiplication will look like this, even though our tables look a little different. We end up with numbers that relate to small, medium, and large shoes, so we can add up the amount in inventory (done 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. 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, Mixture 1, consists of 6 cups of almonds, 3 cups of cashews, and 1 cup of pecans. Her second mixture, Mixture 2, consists of 3 cups of almonds, 6 cups of cashews, and 1 cup of pecans. Her third mixture, Mixture 3, 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. 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. Then, we get rid of the number of cups of Almonds, Cashews, and Pecans, which we don’t need. Here is the second table we get from the problem:  Mixture 1 Mixture 2 Mixture 3 Almonds (cups) 6 3 3 Cashews (cups) 3 6 1 Pecans (cups) 1 1 6 Total (cups) 10 10 10 Now we can multiply the matrices (using a graphing calculator) to end up with the amount of Protein, Carbs, and Fat (rows) in each of the mixtures (columns): $$\displaystyle \require{cancel} \begin{array}{l}\cancel{{\text{Almonds, Cashews and Pecans}}}\,\,\,\,\,\,\,\,\,\text{Mixture 1, Mixture 2, Mixture 3 }\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\text{Mixture 1, Mixture 2, Mixture 3}\\\,\,\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 matrix above). Also, notice how the cups unit “canceled out” when we did the matrix multiplication (grams/cup times 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:  Mixture 1 Mixture 2 Mixture 3 Protein (grams) 230.3/10 = 23.03 214.7/10 = 21.47 160.2/10 = 16.02 Carbs (grams) 389.9/10 = 38.99 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 Here are a few more matrix application problems that can get a little tricky:  Matrix Multiplication Word Problem when Table is not Given Solution Several years ago, an outbreak of Chicken Pox hit a local public schools. Approximately 15% of the male and female juniors and 25% of the male and female seniors were healthy, 35% of the male and female juniors and 30% of the male and female seniors were sick, and 50% of the male and female juniors and 45% of the male and female seniors were carriers of Chicken Pox. There were 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) were healthy, sick, and carriers. 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 there were, set up the following equation and do the calculation: $$.15(100)+.25(80)=35$$. Likewise, to find out how many females are carriers there were, calculate: $$.50(120)+.45(100)=105$$. We can tell that this looks like matrix multiplication. 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 (total number of male and female students in both classes). Since we don’t need the answers divided by class (juniors and seniors), we make those the middle buckets so they can be eliminated. 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{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 were 35 healthy males, 59 sick males, and 86 carrier males, 43 healthy females, 72 sick females, and 105 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’ 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. 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. ## 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]$$. $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.

## Matrix Encoding/Decoding (Matrix Encryption) Problem

Matrix Encryption is a fun and interesting application; it involves using matrices in cryptology, where a (“secret”) encoded message can be sent to someone else (along with a random matrix) and decoded on the other end. Here’s an example:

a) Using a mapping where the letters A-Z correspond to numbers 1-26, with 0 as space, encode the message “Math is Fun” using Matrix $$\displaystyle E=\left[ {\begin{array}{*{20}{c}} 2 & 4 & 1 \\ 3 & 9 & 5 \\ 6 & 8 & 0 \end{array}} \right]$$ as a matrix “pre-multiplier”. (Break up the numerical message into 3 rows of the same length, adding extra zeros if needed, before the matrix multiplication.)

b) Decode the message at the other side, using the inverse of the Matrix E as a “pre-multiplier”: $$\displaystyle {{E}^{{-1}}}={{\left[ {\begin{array}{*{20}{c}} 2 & 4 & 1 \\ 3 & 9 & 5 \\ 6 & 8 & 0 \end{array}} \right]}^{{-1}}}=\left[ {\begin{array}{*{20}{c}} {-4} & {.8} & {1.1} \\ 3 & {-.6} & {-.7} \\ {-3} & {.8} & {.6} \end{array}} \right]$$.

Solution:
Use the following table to convert letters to numbers:

 0 – space 1 – A 2 – B 3 – C 4 – D 5 – E 6 – F 7 – G 8 – H 9 – I 10 – J 11 – K 12 – L 13 – M 14 – N 15 – O 16 – P 17 – Q 18 – R 19 – S 20 – T 21 – U 22 – V 23 – W 24 – X 25 – Y 26 – Z

a) For “Math is Fun”, (using 0’s for spaces), we have $$13,1,20,8,0,9,19,0,6,21,14,0$$; create matrix $$\displaystyle M=\left[ {\begin{array}{*{20}{c}} {13} & 8 & {19} & {21} \\ 1 & 0 & 0 & {14} \\ {20} & 9 & 6 & 0 \end{array}} \right]$$ (go down columns first). To encode, multiply the given matrix E by matrix M:

$$\displaystyle EM=\left[ {\begin{array}{*{20}{c}} 2 & 4 & 1 \\ 3 & 9 & 5 \\ 6 & 8 & 0 \end{array}} \right]\times \left[ {\begin{array}{*{20}{c}} {13} & 8 & {19} & {21} \\ 1 & 0 & 0 & {14} \\ {20} & 9 & 6 & 0 \end{array}} \right]=\left[ {\begin{array}{*{20}{c}} {50} & {25} & {44} & {98} \\ {148} & {69} & {87} & {189} \\ {86} & {48} & {114} & {238} \end{array}} \right]$$

Send the message as $$50,148,86,25,69,48,44,87,114,98,189,238$$ (go down columns first).

b) To decode the message, put the numbers received in matrix N and then compute $${{E}^{{-1}}}N$$:

$$\displaystyle {{E}^{{-1}}}N=\left[ {\begin{array}{*{20}{c}} {-4} & {.8} & {1.1} \\ 3 & {-.6} & {-.7} \\ {-3} & {.8} & {.6} \end{array}} \right]\times \left[ {\begin{array}{*{20}{c}} {50} & {25} & {44} & {98} \\ {148} & {69} & {87} & {189} \\ {86} & {48} & {114} & {238} \end{array}} \right]=\left[ {\begin{array}{*{20}{c}} {13} & 8 & {19} & {21} \\ 1 & 0 & 0 & {14} \\ {20} & 9 & 6 & 0 \end{array}} \right]$$

Convert the numbers back into the letters (going down columns first) to get “Math is Fun”. Wow!

Learn these rules, and practice, practice, practice!

On to Introduction to Linear Programming  – you are ready!