Download Chapter 2 Systems of Linear Equations and Matrices

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Signal-flow graph wikipedia , lookup

Quadratic form wikipedia , lookup

System of polynomial equations wikipedia , lookup

History of algebra wikipedia , lookup

Linear algebra wikipedia , lookup

Jordan normal form wikipedia , lookup

Eigenvalues and eigenvectors wikipedia , lookup

Equation wikipedia , lookup

Determinant wikipedia , lookup

Four-vector wikipedia , lookup

Singular-value decomposition wikipedia , lookup

Matrix (mathematics) wikipedia , lookup

Non-negative matrix factorization wikipedia , lookup

Perron–Frobenius theorem wikipedia , lookup

Orthogonal matrix wikipedia , lookup

Matrix calculus wikipedia , lookup

Cayley–Hamilton theorem wikipedia , lookup

System of linear equations wikipedia , lookup

Matrix multiplication wikipedia , lookup

Transcript
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:
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.
x
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
2.1 Systems of Linear Equations - Introduction
2
we can start by solving the first equation for x and find x = −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 equation
so we have only one piece of information. The solution to the system is every point on the line. We can also
rewrite the equations in slope-intercept form and see they are both y = −1/2 − x/2. This system is called
dependent. While you can’t find a point, you can find the value of one variable in terms of another. This is called
a parametric solution. We can consider x as a parameter, and when we are given the value for x we can find the y
value that goes with it. We can write the solution as a pair of points, (x, −1/2 − x/2). Sometimes the book likes
to give the parameter the name t, 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 form x = −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). Here y (or t) is the parameter. BOTH SOLUTIONS ARE CORRECT. Each way gives points along
the single line that is the solution. Notice each way of writing has only one parameter as there is only one piece of
information needed to determine a point. You may find in larger systems that there are two or more parameters. If
x and y are the only variables, please use y as the parameter. If we have x, y and z, please use z 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 for x, → 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 true
at the same time and so there is NO SOLUTION. A way to check these equations is to write them both in slopeintercept form. The first equation is y = .5x − 1/2 and the second equation is y = .5x + 2 You will find that
they have the same slope (here .5) and different intercepts (here -1/2 and 2) therefore they are parallel and never
intersect.
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 system
is the single point of intersection.
2.1 Systems of Linear Equations - Introduction
3
2. The three planes intersect along a line. There are an infinite
number of solutions for the system corresponding to the line where
they intersect. We could also have all three planes the same and then
all 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 for
problems that we will solve later.
Example - An apartment complex is being developed that has one-, two- and three-bedroom units. The developer
has decided that there will be a total of 192 units. The number of family units (two and three bedrooms) will equal
the number of one-bedroom units. Finally, the number of one-bedroom units will be three times the number of
three-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 find
how many units of each type. Next you want to define a set of variables that will answer the question. Here we
will 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.
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 of
equation is called a RATIO equation and they can be tricky to figure out. You know that the 3 goes on one side
or the other - but which side?? The best thing to do is look at the English and decide which quantity is larger by
the way it reads. From the question I read that there are more one-bedroom units than three bedroom units. Next
I will try a sample case to see if that is what my equation is saying. I would expect that if the complex had 1
three-bedroom unit, it would have 3 one-bedroom units. Let’s check if I use z = 1 (1 three-bedroom unit) what
comes out for x: 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 of
equations 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 all
the equations to a system that looks like x = a, y = b, etc.
It can get quite tedious to write x, y, +, −, =, etc. each time you rewrite the equations. So we will agree to always
have x in the first position and y in the second position and the constants in the last position and then we can write
the system of equations in an augmented matrix:
2x − y = 6
2 −1 | 6
→
x + 2y = −2
1 2 | −2
Each line of the matrix represents and equation and the vertical line is the equals sign. The first column has the x
coefficients, the y is in the second column and the last column is the constants. We can now take our three rules
for 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 equivalent
system (i.e., same solution) that looks nice, like
x = c1
y = c2
In matrix form this would be
1 0 | c1
0 1 | c2
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 1
in the upper left position (x has a coefficient of 1) and no other variables in the top row (equations). Then we will
want a 1 in the second row, second column (y has a coefficient of 1) and zeros for the rest of the variables. The
systematic 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 (the
reciprical of the upper left element - if the upper left element is a zero, you will have to swap it with another
row to get started). Here we have a 2 in the upper left corner, so I will multiply the top row by (1/2). We
can do these row operations in the calculator using the ROWOPS program. Start by putting the matrix in as
matrix [A] in the calculator. Notice it is a 2 × 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 the
name of the matrix you want. You will then be in the edit mode. You put in the size of the matrix (rows
first). Here we have a 3 × 2. Do 3 enter then 2 enter and you find it makes you a matrix of zeros that we
will over write. You then enter the data. If you hit enter, the cursor moves to the right and then at the end
of the row it moves to the next row. However, you can use the arrow buttons to move wherever you wish in
the matrix. Just in case I have an accident, I will save the matrix in matrix [B] before I get started changing
matrix [A].
Now run ROWOPS by going to PRGM and hitting the number for program ROWOPS. This will put you
back on the home screen and then hit ENTER to run the program. You are given a choice of which matrix
to operate on. We have our matrix in [A], so I will hit enter. You can see then if that is the correct matrix
and 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)
2.2 Solving Systems of Linear Equations I
6
Now we have a 1 in the upper left corner.
2. We now want to eliminate x from the other equation. That means we want a 0’s in the rest of the first
column. 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 eliminated x from the second row (equation).
3. Now we want y to have a coefficient of 1 in the second equation. This means we want the number 1 in the
second 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 you
are trying to change. Choose the *row option:
We now have a coefficient of 1 for the y (and in fact we now know that y = −2)
4. Finally we need to eliminate y 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:
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 you
make 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 the
matrix in RREF. When a matrix is in RREF that is as far as Gauss-Jordan can take you and you must write out the
equations and see what you have.
1 0 | 2
0 1 | −2
→
1x + 0y = 2
0x + 1y = −2
Or, the solution is x = 2 and y = −2. We can automate this somewhat with a button on the ti-83. Under the
MATRX 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 number
of columns. That is, rref( worked on our 2 × 3 matrix, but it will not work on a 3 × 2 matrix.
You should be sure you can recognize a matrix when it is in RREF form. In RREF form the matrix follows these
rules:
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 the
upper 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 the
gauss-jordan method on any calculator. The student calculator manual and pp 96- 97 in the book will give you
some 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:
2.3 Solving Systems of Linear Equations II
8


x + 2y + z
= −2
1
2
1 | −2
−2x − 3y − z = 1 → −2 −3 −1 | 1 
2x + 4y + 2z = −4
2
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 of
rules:
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 each
of the variables like we did in the last section!


1 0 −1 | 4
x + 0y − z
=4
0 1 1 | −3 → 0x + y + z = −3
0 0 0 | 0
0x + 0y + 0z = 0
What does this mean?? The last statement is 0 = 0 which is true, so we can ignore it. The other two equations say
x−z =4
y + z = −3
We had two equations and three variables - we didn’t have enough data to get a single value for each variable. The
solution is PARAMETRIC. We need to let one of the variables be our parameter and solve the system in terms of
the parameter (like the case where we had a single line). The convention is that the variable in the last column
(here that is z) will be our parameter. We solve for the other variables in terms of this last one:
x =4+z
y = −3 − z
Now for any value you pick for z we can find values for x and y. 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)
2.3 Solving Systems of Linear Equations II
9
Example:


x + y − 2z = −3
1 1 −2 | −3
2x − y + 3z = 7 → 2 −1 3 | 7 
x − 2y + 5z = 0
1 −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 of
rule:
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
x + 0y + 1/3z = 0
0 1 −7/3 | 0 → 0x + y − 7/3z = 0
0 0
0
| 1
0x + 0y + 0z = 1
What does this mean?? The last statement is 0 = 1 which is FALSE, so the answer is NO SOLUTION. So when
your RREF matrix has 0’s on one side and a non-zero number on the other, you can straightaway say there is no
solution.
Now we can do some examples where the coefficient matrix is not square. When the matrix of coefficents is
square we have the same number of variables as equations. When the number of variables is more or less than the
number 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 of
the 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.
2.3 Solving Systems of Linear Equations II
10
Example: Solve the following system (more variables than equations):
x1 + 2x2 + 4x3 = 2
x1 + x2 + 2x3 = 1
Answer: This is like case 2 - we can have no solution or a parametric solution, but there is not enough information
to 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 is x3 ) be the parameter, so solve
x2 = 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 = 8
3x − 2y = −7
x + 3y
=5
2x + 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, but
it 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 put
a 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 front
of the x.
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 the x column
and we want x to only be in the first equation. Looking at the second row it has a 3 in the first column. We can
multiply 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. We
can 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 it
to row 4:
Now we have the first column just the way we want it.
3. We now want y to have a coefficient of 1 in the second row. You always work down and to the right and so we
work 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 the y column be zeros (so we have y only in the second
equation). 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 to
row 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:
2.3 Solving Systems of Linear Equations II
12
Now we write out the equations:
x = −1
y =2
0 =0
0 =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 the x, 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 single
solution, 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 into
RREF form by hand. Then write out the equations as above.
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 as M or A. A matrix
has m rows and n columns and is called an m × n matrix. Notice that the row dimension is first. Some sample
matrices are
 
1
−1 is a 3 × 1 matrix. A 1 × 3 matrix looks like 1 −1 2 These two matrices are NOT EQUAL. Even if two
2
matrices have the same numbers in them, they are not equal unless the arrangement of the numbers is identical.
Amatrix
is called square if it has the same number of rows and columns. Here A is a 2 × 2 square matrix A
1 2
=
3 4
We can specify the location of a single element in the matrix by it’s row and column number. Element aij is the
element in the ith row and jth column of matrix A. Notice again that the row number is first. So in our matrix A
we have a11 = 1 (this is NOT element eleven!!!), a12 = 2, a21 = 3 and a22 = 4
When we use a matrix to hold real data, we want to be sure to LABEL the rows and columns so that we know
what 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 of
peanut 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 of
peanut butter and 50 pounds of cold cuts. Organize this data in a 3 × 4 matrix.
answer - we are told to make the matrix 3 × 4. That means that each of the three rows will be a store and each of
the four columns will be a food item. You are sometimes given the dimensions, in which case be sure to size it
right (remember - rows first), or you have to determine the dimensions yourself.
bread
store I
88

store II
105
store III
60

milk
48
72
40
p.b.
16
21
0
c.c.

112
147 
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.
a −1
1 b
=
example - Find the values of a, b, c, d given
c d
3 0
answer - since we are told the matrices are equal, we can match the elements and find a = 1, b = −1, c = 3 and
d = 0.
Addition - two matrices are added by adding the pairs of elements in each location. We can do this on the
calculator or by hand.
2.4 Matrices
example - find A + B where
14


2 −3
5
A= 0
.25 6


−.25 7
B =  −3 1.5
9
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 the
answer, not save it for later use). To save a matrix you go to STO and then you put in a matrix name by going to
MATRX 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 calculator
can do this under the matrix math menu.
2 0 .25
T
A =
−3 5 6
Scalar multiplication - A scalar is a number (as opposed to a matrix). You can multiply a matrix by a scalar by
multiplying 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 multiplication:
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 will
do the bulk of the arithmetic; however, you MUST understand what and why it is doing what it does. Let us start
with 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 using
matrices.
Answer - We will express the number of flowers in a 1 × 3 matrix:
A = number
roses carnations
96
250
daisies
130
We can think of this as a number × type matrix. Next express the price as a 3 × 1 matrix:
price

roses
2
B = carnations  1 
daisies
.50

We can think of this as a type × 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 the
kinds of flowers:
R =
=
=
=
96 · 2 + 250 · 1 + 130 · .50
a11 · b11 + a12 · b21 + a13 · b31
A·B
192 + 250 + 65 = 507
In general, if A is 1 × n (that is, has one row and n columns) and B is n × 1 (one column and n rows) the product
of these two matrices is
 
b11

b

 21 
AB = a11 a12 . . . a1n ·  ..  = a11 b11 + a12 b21 + . . . + a1n bn1
 . 
bn1
The answer is a 1 × 1 matrix (a single number). You can see that the number of columns in the left matrix has to
be the same as the number of rows in the right side matrix or we would run out of numbers to multiply together
before being added. This kind of rule holds for larger matrices too.
If A is a m × n matrix and B is a n × p matrix, then the product matrix AB = C is m × p. In general, your
calculator will tell you DIM MISMATCH if you try to multiply incorrectly. You should still be aware that the
number 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, that AB 6= BA (there are some exceptions we
will discuss). Let’s take a look at how this will work.
2.5 Multiplication of Matrices
16
1 0
−1 2
Example - Let A =
and B =
. Find the products AB and BA. Are they the same?
−2 3
0 −3
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 that
was not relevent to finding the revenue.
One special matrix is called the identity matrix, I.
elsewhere,

1
0


I = 0
 ..
.
0
It is a square matrix with 1’s on the diagonal and zeros
0
1
0
..
.
0 ...
0 ...
1 ...
.. . .
.
.
0 0 ...

0
0

0

.. 
.
1
The notation I2 is a 2 × 2 identity matrix and In is an n × n identity matrix. It has the property that if it can be
multiplied by a matrix A (of course A has the correct dimensions for the multiplication), it returns the matrix A.
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 by I.
Answer - [A] is 2 × 2 and so our identity matrix will be 2 × 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 this
case 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 the
product that gives you the correct upper left element. To find this element, you multiply across the top row of the
left matrix times the left column of the right matrix and add the products:
2.5 Multiplication of Matrices

a11
a21

..
.
17


b11
a12 . . . a1n  b
 21
a22
... 
 ·  ..
 .
..
.
...
bn1

b12 . . .
"
#
b22 . . . 
a
b
+
a
b
+
.
.
.
+
a
b
.
.
.
11
11
12
21
1n
n1

..  =
..
..
.
...
.
.
..
.
...
So (ab)11 = a11 b11 + a12 b21 + . . . + a1n bn1 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 of A and down the left side
of B to find the upper left element of the product AB.
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), Mexico
City (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 mucho
mocha requires .4 kg of sugar and .3 kg of chocolate. Each kilogram of almond delight requires .3 kg of sugar
and .3 kg of chocolate. Put this in a 2 × 3 matrix with labels.
A=
sugar
choc.
cc
.5
.2
mm
.4
.3
ad
.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 it
an ingredient × 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 of
chocolate is $3 in San Diego, $3 in Mexico City and $4 in Managua. Put this information into a matrix in such a
way that when it is multiplied by the matrix in part (a) it will tell us the cost of producing each kind of candy in
each city.
We have a 2 × 3 matrix with the ingredients × type and we want to end up with a cost × type which will be
3 × 3. So we need to write a 3 × 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 you
have to know how to check it!
su ch

cc
cost in SD
3
3
sugar .5
cost in MC  2
3 ·
choc. .2
cost in Ma
1
4

mm
.4
.3
cc

ad
SD 2.1
.3
= MC  1.6
.3
Ma 1.3
mm
2.1
1.7
1.6
ad

1.8
1.5 
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 cheery
cherry in San Diego?? I could have multiplied the matrices in the other order and then the calculator would have
done it and given me some sort of 2 × 2 matrix. So let us check that top left matrix element in the product matrix
and see what it is.
I will multiply across the top row of left matrix and down the left column of the right matrix:
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 chocolate
per 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
x
6
·
=
−1 2
y
4
You can check the top element and see that it works.
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 number r the reciprocal is
1/r or r −1 and it has the property that r · 1/r = r · r −1 1 = the multiplicative identity. So for a matrix A we are
looking for another matrix called A−1 that when we multiply it by A we get the multiplicative identity, I. That is
we want to findA−1 where
A · A−1 = I = A−1 A
Any matrix A−1 which has this property is the inverse of A. Not all matrices have inverses (just like the real
number 0 does not have an inverse). A matrix with no inverse is called singular. However, if a matrix has an
inverse, the inverse is unique. We will find matrix inverses on the calculator. You can read how to do it by hand if
you wish, but we will always find the inverse on the calculator in this class.
Example - find the inverse of


1 0 1
A = 0 −1 0
2 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 the x−1 and hit enter:
Matrix inverses can be used to solve matrix equations. One example of a matrix equation we have seen is the
equation for a linear system:
AX = B. Left multiply both sides by A−1 ,
A−1 AX = A−1 B. Use the properties of inverses,
IX = A−1 B. Use the properties of the identity matrix,
X = A−1 B. This is the solution to the system. see an example
Find the solution of the system:
2x
+ 4z = −8
3x + y + 5z =
2
−x + y − 2z =
4
We cam write the system as a matrix equation AX = B:
2.6 The Inverse of a Square Matrix
20

   
2 0 4
x
−8
 3 1 5  y  =  2 
−1 1 −2
z
4
solve this using matrix inverses, X = A−1 B. that is left multiply by the inverse so that
  

−1   
x
−8
24
2 0 4
y  =  3 1 5   2  =  0 
4
z
−14
−1 1 −2
which says that x = 24 and y = 0 and z = −14. What if we try this method and matrix A doesn’t have an
inverse? 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 form
we 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
x
192
−1 1 1  y  =  0 
1 0 −3
z
0
Now solve with the inverse matrix,
  
−1    
192
96
x
1 1 1
y  = −1 1 1   0  = 64
0
32
z
1
−3
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 to
the 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 for X:
2.6 The Inverse of a Square Matrix
D = X − AX
D = IX − AX = (I − A)X
(I − A)−1 D = (I − A)−1 (I − A)X
(I − A)−1 D = IX = X
X = (I − A)−1 D
Be careful with left/right multiplication and factoring!
21