This section covers:

**Introduction to the Matrix****Adding and Subtracting Matrices****Multiplying Matrices****Matrices in the Graphing Calculator****Determinants, the Matrix Inverse, and the Identity Matrix****Solving Systems with Matrices****Solving Word Problems with Matrices****Cramer’s Rule****Number of Solutions when Solving Systems with Matrices****More Practice**

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

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, “Brett” would be identified as , since it’s on the 2^{nd} row and it’s the 1^{st }entry.

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

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:

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

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

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

**So 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**: . 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: . 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 . Here is why, if you’re interested in the “theory” (the column on the right provides an example with “regular” multiplication). (** I** is the identity matrix.)

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

Oh, and there’s another way to solve these in your calculator, but your teacher may not tell you. I’m not going to go into the details, but it’s using a method called **reduced row echelon form**, where we can put everything in one matrix (called an **augmented matrix**). Let’s try this for the following matrix:

# Solving Word Problems With Matrices

Now that we know how to solve systems using matrices, we can solve them so much faster! Let’s do a couple of pure matrices problems, and then more systems problems :).

## Matrix Multiplication Problem

**Solutions:**

(a) When we multiply a matrix by a scalar (number), we just multiply all elements in the matrix by that number. So 2P =

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

(c) Since , we have . Let’s use our calculator to put * P* in [A] and in [B]. Then .

## 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** (

**will be a matrix):**

*X***Solution:**

Let’s add the second matrix to both sides, to get ** X** and it’s coefficient matrix alone by themselves. Then we’ll “divide” by the matrix in front of

**. Watch the order when we multiply by the inverse (matrix multiplication is not commutative), and thank goodness for the calculator!**

*X*We can check it back: . It works!

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

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

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

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. So 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**:

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

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

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

So we can come up with the following matrix multiplication:

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

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 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,

**= the second number, and**

*y***= the third number. So here are the three equations:**

*z*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:

So 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: and in matrix form:

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,

**= the number of tulips, and**

*t***= the number of lilies. So let’s put the money terms together, and also the counting terms together:**

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

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

So for one bouquet, we’ll have 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,

**for manufacturing), 40 percent of it, or .40**

*y**x*pays to produce internal energy, and 25 percent of it, or .25

*x*pays for internal manufacturing. Of the value of the manufacturing produced, .25

*y*pays for its internal energy and .10

*y*pays for manufacturing consumed internally. The inputs are the amount used in production, and the outputs are the amounts produced.

(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 . 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): . To get , we can use the formula . So the two industries must produce $17.7 million worth of energy and $10.5 million worth of manufacturing, respectively.

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

To solve for ** x**,

**, and**

*y***, we need to get the determinants of**

*z***four**matrices, the first one being the 3 by 3 matrix that holds the coefficients of

**,**

*x***, and**

*y***. Let’s call this first determinant**

*z***;**

*D*Now we’ll get a matrix called , which is obtained by “throwing away” the first (** x**) column, and replacing the numbers with the “answer” or constant column. So

You can probably guess what the next determinant we need is: , 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

**. So Similarly,**

*x*OK, now for the fun and easy part! To get the ** x**,

**, and**

*y***answers to the system, you simply divide the determinants So Now we know that**

*z***= 5,**

*x***= 1, and**

*y***= –2.**

*z*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 solution**s (called **dependen**t 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:

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:

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

**and**

*x***in terms of**

*y***: This would look like so the solution set for {**

*z***,**

*x***,**

*y***} is {5 – .375**

*z***, 3 + .875**

*z***,**

*z***}. (This may be a little advanced for high school 🙂 )**

*z*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:

**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!