Top Banner
Chapter 2 Systems of Linear Equations and Matrices 2.1 Systems of Linear Equations - Introduction We have already solved a small system of linear equations when we found the intersection point of two lines. This is a linear system with two equations and two unknowns. Let’s go over all the possibilities of a system of two equations and two unknowns: x y 1. The two lines intersect. The solution of the system is the single point of intersection. x y 2. The two lines are the same. There are an infinite number of solutions for the system. x y 3. The two lines are parallel. There is no solution to the system. We have already solved systems like the first one in section 1.4. How about one like the second kind? example - find the solution to the system of equations: x +2y = -1 2x +4y = -2 0 c Janice Epstein 1998, 1999, 2000. These notes may not be distributed for profit
21

Chapter 2 Systems of Linear Equations and Matricesjanice.epstein/141/notes/chap2.pdf · Chapter 2 Systems of Linear Equations and Matrices 2.1 Systems of Linear Equations - Introduction

Jan 08, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Chapter 2 Systems of Linear Equations and Matricesjanice.epstein/141/notes/chap2.pdf · Chapter 2 Systems of Linear Equations and Matrices 2.1 Systems of Linear Equations - Introduction

Chapter 2

Systems of Linear Equations and Matrices

2.1 Systems of Linear Equations - Introduction

We have already solved a small system of linear equations when we found the intersection point of two lines. Thisis a linear system with two equations and two unknowns. Let’s go over all the possibilities of a system of twoequations and two unknowns:

x

y

1. The two lines intersect. The solution of the system is the singlepoint of intersection.

x

y

2. The two lines are the same. There are an infinite number ofsolutions for the system.

x

y

3. The two lines are parallel. There is no solution to the system.

We have already solved systems like the first one in section 1.4. How about one like the second kind?

example - find the solution to the system of equations:

x + 2y = −1

2x + 4y = −2

0 c©Janice Epstein 1998, 1999, 2000. These notes may not be distributed for profit

Page 2: Chapter 2 Systems of Linear Equations and Matricesjanice.epstein/141/notes/chap2.pdf · Chapter 2 Systems of Linear Equations and Matrices 2.1 Systems of Linear Equations - Introduction

2.1 Systems of Linear Equations - Introduction 2

we can start by solving the first equation forx and findx = −1− 2y. Put this into the second equation and find:

2(−1− 2y) + 4y = −2 → −4y + 4y = −2 + 2 → 0 = 0

This is TRUE, not very helpful, but it is true. When that happens it means that there was really only one equationso we have only one piece of information. The solution to the system is every point on the line. We can alsorewrite the equations in slope-intercept form and see they are bothy = −1/2 − x/2. This system is calleddependent. While you can’t find a point, you can find the value of one variable in terms of another. This is calledaparametric solution. We can considerx as aparameter, and when we are given the value forx we can find theyvalue that goes with it. We can write the solution as a pair of points,(x,−1/2− x/2). Sometimes the book likesto give the parameter the namet, in which case our solution would look like(t,−1/2− t/2).

There is not a unique way of writing the solution. If I had written the equation in the formx = −1 − 2y(say because I hate fractions I thought this looked prettier), then the solution would look like(−1 − 2y, y) or(−1− 2t, t). Herey (or t) is the parameter. BOTH SOLUTIONS ARE CORRECT. Each way gives points alongthe single line that is the solution. Notice each way of writing has only one parameter as there is only one piece ofinformation needed to determine a point. You may find in larger systems that there are two or more parameters. Ifx andy are the only variables, please usey as the parameter. If we havex, y andz, please usez as the parameter.

An example of the third kind of system is

x− 2y = 1

−x + 2y = 4

Take the first equation and solve it forx,→ x = 1 + 2y, and then put this back into the second equation,

−(1 + 2y) + 2y = 4 → −2y + 2y = 4 + 1 → 0 = 5

This is a FALSE statement. When you get a false statement, that means that both of the equations can’t be trueat the same time and so there is NO SOLUTION. A way to check these equations is to write them both in slope-intercept form. The first equation isy = .5x − 1/2 and the second equation isy = .5x + 2 You will find thatthey have the same slope (here .5) and different intercepts (here -1/2 and 2) therefore they are parallel and neverintersect.

When we have 3 linear equations with 3 unknowns the graphs are planes. Again we can have three different cases:

1. The three planes intersect at a point. The solution of the systemis the single point of intersection.

Page 3: Chapter 2 Systems of Linear Equations and Matricesjanice.epstein/141/notes/chap2.pdf · Chapter 2 Systems of Linear Equations and Matrices 2.1 Systems of Linear Equations - Introduction

2.1 Systems of Linear Equations - Introduction 3

2. The three planes intersect along a line. There are an infinitenumber of solutions for the system corresponding to the line wherethey intersect. We could also have all three planes the same and thenall the points on the plane would be the solution.

3. The three planes are parallel. There is no solution to the system.

An important aspect of this chapter is WORD PROBLEMS. In this section we will be setting up the equations forproblems that we will solve later.

Example - An apartment complex is being developed that has one-, two- and three-bedroom units. The developerhas decided that there will be a total of 192 units. The number of family units (two and three bedrooms) will equalthe number of one-bedroom units. Finally, the number of one-bedroom units will be three times the number ofthree-bedroom units. How many units of each type will there be?

Answer - The first step in any word problem is to decide what it is you are trying to find. Here we want to findhow many units of each type. Next you want to define a set of variables that will answer the question. Here wewill choose

x = number of one-bedroom units

y = number of two-bedroom units

z = number of three-bedroom units

This is the MOST IMPORTANT step - DEFINE YOUR VARIABLES!!!!!!!!!

Next we will change the sentences into equations:

x + y + z = 192 This is the total number of units.

y + z = x The number of family units equals the number of one-bedroom units.

x = 3z Ratio equation.

Page 4: Chapter 2 Systems of Linear Equations and Matricesjanice.epstein/141/notes/chap2.pdf · Chapter 2 Systems of Linear Equations and Matrices 2.1 Systems of Linear Equations - Introduction

2.2 Solving Systems of Linear Equations I 4

The number of one-bedroom units is three times as many as the number of three-bedroom units. This kind ofequation is called a RATIO equation and they can be tricky to figure out. You know that the 3 goes on one sideor the other - but which side?? The best thing to do is look at the English and decide which quantity is larger bythe way it reads. From the question I read that there are more one-bedroom units than three bedroom units. NextI will try a sample case to see if that is what my equation is saying. I would expect that if the complex had 1three-bedroom unit, it would have 3 one-bedroom units. Let’s check if I usez = 1 (1 three-bedroom unit) whatcomes out forx: x = 3z = 3 · 1 = 3. So it works.

2.2 Solving Systems of Linear Equations I

When you want to solve a system of linear equations there are three operations you can perform on the system ofequations that does not change the answer to the system (it is an equivalent system). You may:

1. Interchange any of the two equations.

2. Multiply an equation by a non-zero constant.

3. Add a multiple of one equation to another.

As long as we follow these three rules we can try to change the system from one which has lots variables in allthe equations to a system that looks likex = a, y = b, etc.

It can get quite tedious to writex, y, +,−, =, etc. each time you rewrite the equations. So we will agree to alwayshavex in the first position andy in the second position and the constants in the last position and then we can writethe system of equations in anaugmented matrix:

2x− y = 6x + 2y = −2

→[2 −1 | 61 2 | −2

]

Each line of the matrix represents and equation and the vertical line is the equals sign. The first column has thexcoefficients, they is in the second column and the last column is the constants. We can now take our three rulesfor finding an equivalent system and restate them in terms of rows of the augmented matrix.

1. Any two rows may be interchanged.

2. A row may be multiplied by a non-zero constant.

3. A multiple of one row may be added to another row.

So what we want to use these rules for is to change a system from the way it looks initially (messy) to an equivalentsystem (i.e., same solution) that looks nice, like

x = c1

y = c2

In matrix form this would be [1 0 | c1

0 1 | c2

]

Page 5: Chapter 2 Systems of Linear Equations and Matricesjanice.epstein/141/notes/chap2.pdf · Chapter 2 Systems of Linear Equations and Matrices 2.1 Systems of Linear Equations - Introduction

2.2 Solving Systems of Linear Equations I 5

This form of the augmented matrix is called row-reduced echelon form (RREF). The idea is we want to have a 1in the upper left position (x has a coefficient of 1) and no other variables in the top row (equations). Then we willwant a 1 in the second row, second column (y has a coefficient of 1) and zeros for the rest of the variables. Thesystematic reduction of the initial (messy) augmented matrix to the nice neat final matrix is called Gauss-Jordan(G-J).

Example - find the solution to the system above using the Gauss-Jordan elimination method:

1. Start by making the upper left coefficient equal to 1 by multiplying the top row by the necessary factor (thereciprical of the upper left element - if the upper left element is a zero, you will have to swap it with anotherrow to get started). Here we have a 2 in the upper left corner, so I will multiply the top row by (1/2). Wecan do these row operations in the calculator using the ROWOPS program. Start by putting the matrix in asmatrix [A] in the calculator. Notice it is a2× 3 matrix because the constants make the final column.

To put a matrix into the calculator you go to the MATRX button and over to the edit menu. Then select thename of the matrix you want. You will then be in the edit mode. You put in the size of the matrix (rowsfirst). Here we have a3 × 2. Do 3 enter then 2 enter and you find it makes you a matrix of zeros that wewill over write. You then enter the data. If you hit enter, the cursor moves to the right and then at the endof the row it moves to the next row. However, you can use the arrow buttons to move wherever you wish inthe matrix. Just in case I have an accident, I will save the matrix in matrix [B] before I get started changingmatrix [A].

Now run ROWOPS by going to PRGM and hitting the number for program ROWOPS. This will put youback on the home screen and then hit ENTER to run the program. You are given a choice of which matrixto operate on. We have our matrix in [A], so I will hit enter. You can see then if that is the correct matrixand then choose your operation. Notice these are all allowed operation according to our list of rules.

I will choose *row as I want to multiply row 1 by (1/2)

Page 6: Chapter 2 Systems of Linear Equations and Matricesjanice.epstein/141/notes/chap2.pdf · Chapter 2 Systems of Linear Equations and Matrices 2.1 Systems of Linear Equations - Introduction

2.2 Solving Systems of Linear Equations I 6

Now we have a 1 in the upper left corner.

2. We now want to eliminatex from the other equation. That means we want a 0’s in the rest of the firstcolumn. To change that 1 in the lower left corner to a zero I must multiply row 1 by−1 and add it to row 2.So this time the operation I will do is *row+. This multiplies a row by a number and adds it to another row.The program prompts you for which row and what factor:

We have now eliminatedx from the second row (equation).

3. Now we wanty to have a coefficient of 1 in the second equation. This means we want the number 1 in thesecond row, second column. It currently has a (5/2), so if we multiply row 2 by (2/5) we will have a 1 there.The calculator program takes care of all the row arithmetic - you just need to look at the one element youare trying to change. Choose the *row option:

We now have a coefficient of 1 for they (and in fact we now know thaty = −2)

4. Finally we need to eliminatey from the top row (equation). To do this we need to multiply row 2 by (1/2)and add it to row 1. This will change the -1/2 to 0. Choose the *row+ option:

Page 7: Chapter 2 Systems of Linear Equations and Matricesjanice.epstein/141/notes/chap2.pdf · Chapter 2 Systems of Linear Equations and Matrices 2.1 Systems of Linear Equations - Introduction

2.3 Solving Systems of Linear Equations II 7

The process we just went thru can also be called PIVOTING. When you PIVOT on an element in a matrix youmake that element a 1 and the rest of the column that the element is in is changed to zeros using row operations.You can pivot on any element in a matrix. The Gauss-Jordan process requires you to pivot on elements to put thematrix in RREF. When a matrix is in RREF that is as far as Gauss-Jordan can take you and you must write out theequations and see what you have.

[1 0 | 20 1 | −2

]→ 1x + 0y = 2

0x + 1y = −2

Or, the solution isx = 2 andy = −2. We can automate this somewhat with a button on the ti-83. Under theMATRX MATH menu, way way down there is a button called rref(:

There are some restrictions to the rref( function on the ti-83. The number of rows must be smaller than the numberof columns. That is, rref( worked on our2× 3 matrix, but it will not work on a3× 2 matrix.

You should be sure you can recognize a matrix when it is in RREF form. In RREF form the matrix follows theserules:

1. Each row consisting entirely of zeros lies below any row with non-zero entries.

2. The first non-zero entry in any row is a 1 (called a leading 1).

3. In any two successive non-zero rows, the leading 1 in the lower row lies to the right of the leading 1 in theupper row.

4. If a column contains a leading 1 then the other entries in that column are zero.

You need to recognize if a matrix is in RREF form (follows the listed rules). Also, you need to be able to do thegauss-jordan method on any calculator. The student calculator manual and pp 96- 97 in the book will give yousome help if you don’t have a ti-83.

2.3 Solving Systems of Linear Equations II

Here we will continue to use the Gauss-Jordan method.

Example:

Page 8: Chapter 2 Systems of Linear Equations and Matricesjanice.epstein/141/notes/chap2.pdf · Chapter 2 Systems of Linear Equations and Matrices 2.1 Systems of Linear Equations - Introduction

2.3 Solving Systems of Linear Equations II 8

x + 2y + z = −2−2x− 3y − z = 12x + 4y + 2z = −4

→ 1 2 1 | −2−2 −3 −1 | 12 4 2 | −4

Enter the augmented matrix and put it in RREF:

Now check is this in RREF? (This is just for practice, I know the calculator did it right.). Go through our list ofrules:

1. yes, the rows of all zeros is below the non-zero rows.

2. yes, the first non-zero entry in any row is a 1.

3. yes, the leading 1’s go down in a diagonal.

4. yes, if a column has a leading 1 then the rest of the column is zero.

Next step is writing out the equations to see what we have. We are not going to have a numerical value for eachof the variables like we did in the last section!

1 0 −1 | 4

0 1 1 | −30 0 0 | 0

x + 0y − z = 40x + y + z = −3

0x + 0y + 0z = 0

What does this mean?? The last statement is0 = 0 which is true, so we can ignore it. The other two equations say

x− z = 4y + z = −3

We had two equations and three variables - we didn’t have enough data to get a single value for each variable. Thesolution is PARAMETRIC. We need to let one of the variables be our parameter and solve the system in terms ofthe parameter (like the case where we had a single line). The convention is that the variable in the last column(here that isz) will be our parameter. We solve for the other variables in terms of this last one:

x = 4 + zy = −3− z

Now for any value you pick forz we can find values forx andy. We always state our answer in the form(x, y, z),so in this case the answer looks like

(4 + z,−3− z, z) or (4 + t,−3− t, t)

Page 9: Chapter 2 Systems of Linear Equations and Matricesjanice.epstein/141/notes/chap2.pdf · Chapter 2 Systems of Linear Equations and Matrices 2.1 Systems of Linear Equations - Introduction

2.3 Solving Systems of Linear Equations II 9

Example:

x + y − 2z = −32x− y + 3z = 7x− 2y + 5z = 0

→1 1 −2 | −3

2 −1 3 | 71 −2 5 | 0

Enter the augmented matrix and put it in RREF,

Now check is this in RREF? (This is just for practice, I know the calculator did it right.). Go through our list ofrule:

1. yes, the rows of all zeros is below the non-zero rows.

2. yes, the first non-zero entry in any row is a 1.

3. yes, the leading 1’s go down in a diagonal.

4. yes, if a column has a leading 1 then the rest of the column is zero.

So we are left with writing out the equations to see what we have.1 0 1/3 | 0

0 1 −7/3 | 00 0 0 | 1

x + 0y + 1/3z = 00x + y − 7/3z = 00x + 0y + 0z = 1

What does this mean?? The last statement is0 = 1 which is FALSE, so the answer is NO SOLUTION. So whenyour RREF matrix has 0’s on one side and a non-zero number on the other, you can straightaway say there is nosolution.

Now we can do some examples where the coefficient matrix is not square. When the matrix of coefficents issquare we have the same number of variables as equations. When the number of variables is more or less than thenumber of equations we have a theorem to help us out:

1. If the number of equations is greater than or equal to the number of variables in a linear system then one ofthe following is true:

• The system has no solution

• The system has exactly one solution

• The system has infinitely many solutions

2. If there are fewer equations than variables then the system has no solution or infinitely many solutions.

Page 10: Chapter 2 Systems of Linear Equations and Matricesjanice.epstein/141/notes/chap2.pdf · Chapter 2 Systems of Linear Equations and Matrices 2.1 Systems of Linear Equations - Introduction

2.3 Solving Systems of Linear Equations II 10

Example: Solve the following system (more variables than equations):

x1 + 2x2 + 4x3 = 2x1 + x2 + 2x3 = 1

Answer: This is like case 2 - we can have no solution or a parametric solution, but there is not enough informationto get a single numerical value for each variable. Put this matrix in as matrix [A] and use the RREF button to find:

This is as far as RREF can take us. We write out the equations that we have:

x1 = 0 from the top row

x2 + 2x3 = 1 from the bottom row. We will let the last variable (here it isx3) be the parameter, so solvex2 = 1− 2x3. Now express the answer as a triplet,

(x1, x2, x3) = (0, 1− 2x3, x3)

Example: Solve the following system (more equations than variables):

4x + 6y = 83x− 2y = −7x + 3y = 52x + 6y = 10

Put into the calculator and do RREF:

It failed. When there are more rows than columns you cannot use the RREF button. It doesn’t happen often, butit does happen. In that case, you must do the steps of G-J by hand (GJ program):

1. Make the top left element of the augmented matrix a 1. If there is a 0 in this spot, you must use rowswap to puta non-zero element in the upper left position. Here we have 4, so I need to multiply by 1/4 to change this into a 1.Remember, we are multiplying the whole row (equation) by 1/4 with the goal of having a coefficient of 1 in frontof thex.

Page 11: Chapter 2 Systems of Linear Equations and Matricesjanice.epstein/141/notes/chap2.pdf · Chapter 2 Systems of Linear Equations and Matrices 2.1 Systems of Linear Equations - Introduction

2.3 Solving Systems of Linear Equations II 11

2. Now use that 1 to eliminate the other numbers in the first column. Remember, the first column is thex columnand we wantx to only be in the first equation. Looking at the second row it has a 3 in the first column. We canmultiply row 1 by -3 and add it to row 2. This fixes the second row. The third row has a 1 in the first column. Wecan multiply row 1 by -1 and add it to row 3. Finally, the fourth row has a 2, so we multiply row 1 by 2 and add itto row 4:

Now we have the first column just the way we want it.

3. We now wanty to have a coefficient of 1 in the second row. You always work down and to the right and so wework on the second row, second column number. Multiply row 2 by -2/13:

4. Now use the 1 in row 2 column 2 to make the rest of they column be zeros (so we havey only in the secondequation). Do row 1 first - multiply row 2 by -3/2 and add it to row 1. Then multiply row 2 by -3/2 and add it torow 3. Finally multiply row 2 by -3 and add it to row 4:

So now we have gone as far as possible and it is in RREF:

Page 12: Chapter 2 Systems of Linear Equations and Matricesjanice.epstein/141/notes/chap2.pdf · Chapter 2 Systems of Linear Equations and Matrices 2.1 Systems of Linear Equations - Introduction

2.3 Solving Systems of Linear Equations II 12

Now we write out the equations:

x = −1y = 20 = 00 = 0

So this one had a solution!!

So when you have a system of equations to solve, look at the following list:

1. Set up the system with thex, y, z, . . . and constants all lined up in columns.

2. Put the augmented matrix in to the calculator as matrix [A]

3. Use RREF. If RREF works, write out the matrix as equations and see what you have (can have a singlesolution, parametric solution or no solution).

4. If RREF fails on the calculator, you must do Gauss-Jordan by using the GJ program to get the matrix intoRREF form by hand. Then write out the equations as above.

Page 13: Chapter 2 Systems of Linear Equations and Matricesjanice.epstein/141/notes/chap2.pdf · Chapter 2 Systems of Linear Equations and Matrices 2.1 Systems of Linear Equations - Introduction

2.4 Matrices 13

2.4 Matrices

A matrix is a compact way of organizing and displaying data. Matrices will also help us to solve linear equations(that why they are in the same chapter!). A matrix is often denoted by a capital letter such asM or A. A matrixhasm rows andn columns and is called anm × n matrix. Notice that therow dimension is first. Some samplematrices are 1−12

is a3× 1 matrix. A1× 3 matrix looks like

[1 −1 2

]These two matrices are NOT EQUAL. Even if two

matrices have the same numbers in them, they are not equal unless the arrangement of the numbers is identical.

A matrix is calledsquareif it has the same number of rows and columns. HereA is a 2 × 2 square matrixA

=

[1 23 4

]

We can specify the location of a single element in the matrix by it’s row and column number. Elementaij is theelement in theith row andjth column of matrixA. Notice again that the row number is first. So in our matrixAwe havea11 = 1 (this is NOT element eleven!!!),a12 = 2, a21 = 3 anda22 = 4

When we use a matrix to hold real data, we want to be sure to LABEL the rows and columns so that we knowwhat we are reading.

Example - There are three stores. In the first week store I sold 88 loaves of bread, 48 quarts of milk, 16 jars ofpeanut butter and 112 pounds of cold cuts. At the same time, store II sold 105 loaves of bread, 72 quarts of milk,21 jars of peanut butter and 147 pounds of cold cuts. Store III sold 60 loaves of bread, 40 quarts of milk, 0 jars ofpeanut butter and 50 pounds of cold cuts. Organize this data in a3× 4 matrix.

answer - we are told to make the matrix3× 4. That means that each of the three rows will be a store and each ofthe four columns will be a food item. You are sometimes given the dimensions, in which case be sure to size itright (remember - rows first), or you have to determine the dimensions yourself.

bread milk p.b. c.c.

store I 88 48 16 112store II 105 72 21 147store III 60 40 0 50

MATRIX ALGEBRA

We will need to do some algebra with our matrices. Most of the rules here are very straightforward:

Equality - two matrices are equal if and only if each pair of corresponding elements are equal.

example - Find the values ofa, b, c, d given

[1 b3 0

]=

[a −1c d

]

answer - since we are told the matrices are equal, we can match the elements and finda = 1, b = −1, c = 3 andd = 0.

Addition - two matrices are added by adding the pairs of elements in each location. We can do this on thecalculator or by hand.

Page 14: Chapter 2 Systems of Linear Equations and Matricesjanice.epstein/141/notes/chap2.pdf · Chapter 2 Systems of Linear Equations and Matrices 2.1 Systems of Linear Equations - Introduction

2.4 Matrices 14

example - findA + B where

A =

2 −3

0 5.25 6

B =

−.25 7−3 1.59 2

To add matrices, them must be the same size! We can return to the home screen and look at matrix [A] + [B].There is no key on the calculator for the matrix, we must go to MATRX then we choose the NAME of the matrix.

If you want to save this matrix, you must do so now or it will get lost. (often you just need to write down theanswer, not save it for later use). To save a matrix you go to STO and then you put in a matrix name by going toMATRX NAME. I picked [C]. Then hit enter and it will be stored into matrix [C].

Transpose - The transpose of a matrix is found by switching the rows and columns of the matrix. The calculatorcan do this under the matrix math menu.

AT =

[2 0 .25−3 5 6

]

Scalar multiplication - A scalar is a number (as opposed to a matrix). You can multiply a matrix by a scalar bymultiplying every element in the matrix by the scalar.

Example - find−2 ∗ A.

Answer - we can simply multiply each element in matrix [A] by -2, or we can let the calculator do the multiplica-tion:

Page 15: Chapter 2 Systems of Linear Equations and Matricesjanice.epstein/141/notes/chap2.pdf · Chapter 2 Systems of Linear Equations and Matrices 2.1 Systems of Linear Equations - Introduction

2.5 Multiplication of Matrices 15

2.5 Multiplication of Matrices

To multiply two matrices is somewhat more difficult than multiplying a matrix by a constant. The calculator willdo the bulk of the arithmetic; however, you MUST understand what and why it is doing what it does. Let us startwith an example:

Example - Say a flower shop sells 96 roses, 250 carnations and 130 daisies in a week. The roses sell for $2 each,the carnations for $1 each and the daisies for $.50 each. Find the revenue of the shop during the week usingmatrices.

Answer - We will express the number of flowers in a1× 3 matrix:

A =[ roses carnations daisies

number 96 250 130]

We can think of this as anumber × type matrix. Next express the price as a3× 1 matrix:

B =

price

roses 2carnations 1daisies .50

We can think of this as atype× price matrix.

To find the revenue we would multiply the number of a kind of flower by it’s price each and then add up all thekinds of flowers:

R = 96 · 2 + 250 · 1 + 130 · .50

= a11 · b11 + a12 · b21 + a13 · b31

= A · B= 192 + 250 + 65 = 507

In general, ifA is 1× n (that is, has one row andn columns) andB is n× 1 (one column andn rows) the productof these two matrices is

AB =[a11 a12 . . . a1n

] ·

b11

b21...

bn1

= a11b11 + a12b21 + . . . + a1nbn1

The answer is a1× 1 matrix (a single number). You can see that the number of columns in the left matrix has tobe the same as the number of rows in the right side matrix or we would run out of numbers to multiply togetherbefore being added. This kind of rule holds for larger matrices too.

If A is am × n matrix andB is an × p matrix, then the product matrixAB = C is m × p. In general, yourcalculator will tell you DIM MISMATCH if you try to multiply incorrectly. You should still be aware that thenumber of columns in the left-side matrix has to be the same as the number of rows in the right-side matrix.

Matrix multiplication is not commutative. That means, in general, thatAB 6= BA (there are some exceptions wewill discuss). Let’s take a look at how this will work.

Page 16: Chapter 2 Systems of Linear Equations and Matricesjanice.epstein/141/notes/chap2.pdf · Chapter 2 Systems of Linear Equations and Matrices 2.1 Systems of Linear Equations - Introduction

2.5 Multiplication of Matrices 16

Example - LetA =

[1 0−2 3

]andB =

[−1 20 −3

]. Find the productsAB andBA. Are they the same?

Answer - Put these in as [A] and [B] in your calculator. In the home screen, do the products:

If you look back at the flower problem, if we had multiplied in the other order, we would have a 3×3 matrix thatwas not relevent to finding the revenue.

One special matrix is called theidentity matrix, I. It is a square matrix with 1’s on the diagonal and zeroselsewhere,

I =

1 0 0 . . . 00 1 0 . . . 00 0 1 . . . 0...

......

......

0 0 0 . . . 1

The notationI2 is a2 × 2 identity matrix andIn is ann × n identity matrix. It has the property that if it can bemultiplied by a matrixA (of courseA has the correct dimensions for the multiplication), it returns the matrixA.In this way it is like multiplying a number by the number 1.

A · I = A = I · A

Example - multiply our [A] from the last example byI.

Answer - [A] is2× 2 and so our identity matrix will be2× 2 and I will put it into [C],

Sometimes in a matrix word problem there is more than one way to set it up or to multiply the matrices. In thiscase we will need to check if our multiplication is doing what we want. Remember the flower shop example?The matrix multiplication was doing exactly the multiplying and adding we wanted to do to get the total revenue.You will not have to multiply all of both matrices to see if what you are doing is right - you need only check theproduct that gives you the correct upper left element. To find this element, you multiply across the top row of theleft matrix times the left column of the right matrix and add the products:

Page 17: Chapter 2 Systems of Linear Equations and Matricesjanice.epstein/141/notes/chap2.pdf · Chapter 2 Systems of Linear Equations and Matrices 2.1 Systems of Linear Equations - Introduction

2.5 Multiplication of Matrices 17

a11 a12 . . . a1n

a21 a22 . . .... . . .

...

·

b11 b12 . . .b21 b22 . . .... . . .

...

bn1 . . ....

=

[a11b11 + a12b21 + . . . + a1nbn1 . . .

......

]

So(ab)11 = a11b11 + a12b21 + . . . + a1nbn1 and that is the element that you need to write out to see if it is correct.Let’s do an example. It is really easier to use than it looks. You go across the top row ofA and down the left sideof B to find the upper left element of the productAB.

Example - Cost Analysis - The Mundo Candy Company makes three types of chocolate candy: cheery cherry(cc), mucho mocha (mm) and almond delight (ad). The company produces its candy in San Diego (SD), MexicoCity (MC) and Managua (Ma) using two main ingredients, sugar (su) and chocolate (choc).

(a) Each kilogram (kg) of cheery cherry requires .5 kg of sugar and .2 kg of chocolate. Each kilogram of muchomocha requires .4 kg of sugar and .3 kg of chocolate. Each kilogram of almond delight requires .3 kg of sugarand .3 kg of chocolate. Put this in a2× 3 matrix with labels.

A =

[ cc mm ad

sugar .5 .4 .3choc. .2 .3 .3

]

This matrix has the rows for how much of the ingredients and the columns for the type of candy, so I could call itaningredient× type matrix.

(b) The cost of 1 kg of sugar is $3 in San Diego, $2 in Mexico City and $1 in Managua. The cost of 1 kg ofchocolate is $3 in San Diego, $3 in Mexico City and $4 in Managua. Put this information into a matrix in such away that when it is multiplied by the matrix in part (a) it will tell us the cost of producing each kind of candy ineach city.

We have a2 × 3 matrix with theingredients × type and we want to end up with acost × type which will be3 × 3. So we need to write a3 × 2 matrix with cost × ingredient information. Let’s try it and see if it works.Sometimes it takes a try or two to get the matrix that will give us the information that we want - that is why youhave to know how to check it!

su ch

cost in SD 3 3cost in MC 2 3cost in Ma 1 4

·

[ cc mm ad

sugar .5 .4 .3choc. .2 .3 .3

]=

cc mm ad

SD 2.1 2.1 1.8MC 1.6 1.7 1.5Ma 1.3 1.6 1.5

I multiplied these in the calculator, so I know the values are right, but is it really telling me the cost to make cheerycherry in San Diego?? I could have multiplied the matrices in the other order and then the calculator would havedone it and given me some sort of2× 2 matrix. So let us check that top left matrix element in the product matrixand see what it is.

I will multiply across the top row of left matrix and down the left column of the right matrix:

Page 18: Chapter 2 Systems of Linear Equations and Matricesjanice.epstein/141/notes/chap2.pdf · Chapter 2 Systems of Linear Equations and Matrices 2.1 Systems of Linear Equations - Introduction

2.5 Multiplication of Matrices 18

(ab)11 = 3× .5 + 3 × .2 = the cost of sugar per kg in san diego× the kg of sugar in cc+ the cost of chocolateper kg in san diego× the kg of chocolate in cc = total cost to make cc in San Diego. So it is right!!

Matrix multiplication and linear equations: We can express a system of linear equations as a matrix product,AX = B.

Consider the system

2x− 3y = 6

−x + 2y = 4

In matrix form this looks like

[2 −3−1 2

]·[xy

]=

[64

]

You can check the top element and see that it works.

Page 19: Chapter 2 Systems of Linear Equations and Matricesjanice.epstein/141/notes/chap2.pdf · Chapter 2 Systems of Linear Equations and Matrices 2.1 Systems of Linear Equations - Introduction

2.6 The Inverse of a Square Matrix 19

2.6 The Inverse of a Square Matrix

The inverse of a square matrix is similar to the reciprocal of a real number. For a real numberr the reciprocal is1/r or r−1 and it has the property thatr · 1/r = r · r−11 = the multiplicative identity. So for a matrixA we arelooking for another matrix calledA−1 that when we multiply it byA we get the multiplicative identity,I. That iswe want to findA−1 where

A · A−1 = I = A−1A

Any matrix A−1 which has this property is the inverse ofA. Not all matrices have inverses (just like the realnumber 0 does not have an inverse). A matrix with no inverse is calledsingular. However, if a matrix has aninverse, the inverse is unique. We will find matrix inverses on the calculator. You can read how to do it by hand ifyou wish, but we will always find the inverse on the calculator in this class.

Example - find the inverse of

A =

1 0 1

0 −1 02 1 1

Answer: put the matrix in the calculator, say as matrix [A]. Then go to the home screen and put up matrix name[A] and then use thex−1 and hit enter:

Matrix inverses can be used to solve matrix equations. One example of a matrix equation we have seen is theequation for a linear system:

AX = B. Left multiply both sides byA−1,

A−1AX = A−1B. Use the properties of inverses,

IX = A−1B. Use the properties of the identity matrix,

X = A−1B. This is the solution to the system. see an example

Find the solution of the system:

2x + 4z = −83x + y + 5z = 2−x + y − 2z = 4

We cam write the system as a matrix equationAX = B:

Page 20: Chapter 2 Systems of Linear Equations and Matricesjanice.epstein/141/notes/chap2.pdf · Chapter 2 Systems of Linear Equations and Matrices 2.1 Systems of Linear Equations - Introduction

2.6 The Inverse of a Square Matrix 20

2 0 4

3 1 5−1 1 −2

x

yz

=

−8

24

solve this using matrix inverses,X = A−1B. that is left multiply by the inverse so that

x

yz

=

2 0 4

3 1 5−1 1 −2

−1

−824

=

24

0−14

which says thatx = 24 andy = 0 andz = −14. What if we try this method and matrixA doesn’t have aninverse? It could mean that the system is parametric or has no solution. We must use the Gauss-Jordan method(RREF) to be sure.

Example - building apartments. We had found a system of equations. Before we can write them in matrix formwe need to have all the variables on the left side of the =’s and all the numbers on the right side. Doing so we find

x + y + z = 192−x + y + z = 0

x − 3z = 0

Now write as a matrix equation,AX = B: 1 1 1−1 1 11 0 −3

x

yz

=

192

00

Now solve with the inverse matrix,x

yz

=

1 1 1−1 1 11 −3

−1

19200

=

96

6432

This means that

x = 96 = number of one-bedroom units

y = 64 = number of two-bedroom units

z = 32 = number of three-bedroom units

Does this answer fit our initial problems? yes, here are 192 units in all. Yes, the number of family units is equal tothe number of one-bedroom units. yes, there are three times as many one-bedroom units as three-bedroom units.Our answer is right and we write the solution,

Make 96 one-bedroom units, 64 two-bedroom units and 32 three-bedroom units.

We can solve other matrix equations using the inverse. For example, solve the equation below forX:

Page 21: Chapter 2 Systems of Linear Equations and Matricesjanice.epstein/141/notes/chap2.pdf · Chapter 2 Systems of Linear Equations and Matrices 2.1 Systems of Linear Equations - Introduction

2.6 The Inverse of a Square Matrix 21

D = X −AX

D = IX −AX = (I − A)X

(I − A)−1D = (I −A)−1(I −A)X

(I − A)−1D = IX = X

X = (I − A)−1D

Be careful with left/right multiplication and factoring!