Math Matters: Why Do I Need To Know This? 1

advertisement
Math Matters: Why Do I Need To Know This?
Bruce Kessler, Department of Mathematics
Western Kentucky University
Episode Thirteen
1
Matrix Multiplication – Complicated probabilities
Objective: To illustrate how matrix multiplication can turn extremely complicated real-world problems into very simple ones. We introduce the concepts of
stochastic matrices and using tree diagrams to calculate probabilities.
Hello and welcome to “Math Matters: Why Do I Need To Know This?” It’s a TV show
where we take a look at the entry-level mathematics being taught in our general ed. courses
and try to apply that to everyday life. I’ve got some cool stuff to show you today, and I want
to apologize to the 109 students, the general math students, because this is a more algebraic
show. Last time we started talking about matrix multiplication and all the things you could
do with that, and I gave one example, and I thought “Man, I could do so much more with
matrices and matrix multiplication,” so I’m going to revisit that topic today for a couple of
segments.
I’d like to talk about how we can use matrix multiplication to calculate probabilities. This
is a slightly different idea, and I have to go back and recap a little bit of this introduction
of what a matrix is. It’s just a rectangular set of values, its something along these lines.
I call that a matrix. And we consider the number of rows, the first dimension of this, the
number of columns the second dimension, and we would call that a 3 by 4 matrix. (Figure 1)
We multiply matrices in this fashion. The middle dimension here has to match up. And
it will generate in this case a 3 by 3 matrix in this fashion – it’s messy but I’ll explain it.
But here’s what’s happening, you get this first entry in the first row, first column. I look at
the first row of the first matrix and the first column of the second matrix and I take those
entries, multiply them and add them up. So 3 times 1 plus 1 times 2 gives me that entry.
(Figure 2) And to get the next one right here I take the first row, second column and do the
same stunt. (Figure 3) To get this one, I take the second row, first column and add those
things up. (Figure 4) And you just go through all nine of those entries and that’s how you
get the answer with matrix multiplication. (Figure 5)
Now, we showed that in the last episode, but I wanted to recap that because I’m getting
ready to use that trick again. And what I’d like to do is take a look at some very, very complicated probability situations, and show you how all that stuff built into matrix multiplication
takes care of all that stuff for you. Now, I’m going to throw a situation at you that’s fairly
contrived, but the way I’m going to solve it is to arrange probabilities in a matrix. So each
one of these would be probabilities and the first entry is going to be the probability that I go
from one state back into that state. Ok, I’m going to think about different places that I could
be in my problem. The second entry here will be from the first state to the second state and
the first state to the other states. And then from the second state to the first one and so
forth. I don’t mean the United States of America – I mean different places I could be in my
problem. (Figure 6)
1
Figure 1, Segment 1
Figure 2, Segment 1
2
Figure 3, Segment 1
Figure 4, Segment 1
3
Figure 5, Segment 1
Figure 6, Segment 1
4
I’ll give you an example, it’s a really contrived example, but it’s an easy example. And
that’s what I want to show you first, how you could use this in an easy example and then you
can adapt that if you’d like into tougher situations. Let’s take a look at this idea, I’ve got
three people, Amy, Brad, and Carol throwing a Frisbee to each other in the backyard. Now,
Amy shares the Frisbee equally with Brad and Carol, but Brad is kind of sweet on Carol, so
he throws her the Frisbee 90% of the time. And then Carol and Amy are buds, and Carol
doesn’t think too much of Brad, so she will typically throw the Frisbee to Amy about 75% of
the time. So let me ask a very complicated sort of question: if Brad is the first guy to hold
the Frisbee and they toss this thing around 12 times, what is the probability that each of these
people will have the Frisbee after those 12 tosses? (Figure 7)
Figure 7, Segment 1
Now there’s a hard way, and there’s an easy way. The hard way would be, and I’m just
going to look at 2 tosses, the hard way would be to list out all the different ways someone
could end up with the Frisbee. And I’ve done this for two tosses. Brad starts and he’s going
to throw it to either Amy or Carol, and then Amy is going to throw it to either Brad or
Carol, and Carol’s going to either throw it to Amy or Brad. You can put the probabilities on
this tree diagram, that’s what it’s called. For example, Brad kind of likes Carol, so there’s a
9
1
chance that he’ll throw the Frisbee to her, that means there’s a 10
chance that he’ll throw
10
the Frisbee to Amy, those have to add up to 1. And then with Amy, she shares the Frisbee
equally so that’s 12 and 12 . And then Carol 34 of the time will throw it to Amy, and that means
1
of the time she will throw it to Brad. (Figure 8)
4
So you can look then and calculate the probabilities for each of these paths. So Brad,
1
Amy, Brad would be the product of those probabilities – so 20
, and the probability that it ends
5
Figure 8, Segment 1
1
up in Carol’s hands like this is 20
. And the probability that it ends up in Amy’s hands in
9
27
. So
this fashion is 40 , and that it ends up in Brads hands going through Carol would be 40
27
the probability that it ends up in Amy’s hands after two tosses is just this one, so its 40 , the
1
probability that Carol has it is just this one, so its 20
. And then Brad, you’ve got to take
. Okay, I’m sorry I didn’t mean
both of these into account and add them together to get 11
40
to flash that away. So, that would be the answer for two tosses. To do this for twelve tosses,
you’d have to make your table that wide. You’d have to make a huge table. You’d have to
have all these probabilities listed, you’d have to multiply them all out. You’d have all these
things, its horrible. (Figure 8)
Now watch what I can do with a matrix. We create what’s called a transition matrix,
where I put the probabilities in. The probability that Amy throws to Amy is 0, she’s not
going to throw to herself, but she’s going to divide it equally between Brad and Carol, so I’ll
put those probabilities in – notice that the sum of those entries is one. Brad will not throw
the Frisbee to himself, there’s a 9 in 10 chance he’ll throw to carol and a 1 in 10 chance
he’ll throw to Amy. Notice again the sum of those entries in the column are one. Carol
will not throw the Frisbee to herself, there’s a 43 chance she’ll throw to Amy and a 14 chance
she’ll throw to Brad, the sum of those entries is 1. We call this a stochastic matrix where
all the entries are probabilities between 0 and 1, they could be 0 or 1, and then the sum of
the columns is 1. (Figure 9)
So to work the problem, after the first toss, what I would do, I would start with Brad
holding the Frisbee, that means a 100% chance that Brad has it and just multiply. That
1
9
gives me just really the middle column, there’s a 10
chance that Amy has the Frisbee, a 10
6
Figure 9, Segment 1
chance that Carol has it. After two tosses, well, I do this again, and really what I could do
to get this matrix, what I could do is, I multiply this by this. So I could square that one and
do it that way, but I’ll just go through, do the matrix multiplication, and that gives me the
probabilities. The easy way lies right here: to do this is so many tosses, I want to raise this
matrix to a power. (Figure 10) So to do this for twelve tosses what I would do I would put
this in my graphing calculator, I wouldn’t do it by hand – that’s horrible. But these graphing
calculators can do this kind of stuff for you, and I would raise that matrix to a power, which
is fairly messy thing, you can see it here, but then multiply by that original thing. Brad had
the Frisbee to start out with, so here are my probabilities, this middle column: 33% chance
that Amy has the Frisbee, 27% chance Brad has it, 40% chance Carol has it. And the cool
thing that you’ll notice is that each of these columns is pretty much the same, which indicates
that after a period of time, it really doesn’t matter who started with the Frisbee, there’s just
going to be a probability that you have the Frisbee in your hand. (Figure 11)
That would be a horrible problem without the matrices and you can adapt the situation to
business situations and things like that. I’ve got a couple pages that summarize what I just
said, I’m going to flash those up really quick and get ready for the next segment.
7
Figure 10, Segment 1
Figure 11, Segment 1
8
Summary page 1, Segment 1
Summary page 2, Segment 1
9
2
Matrix multiplication – Tracking populations by age
group
Objective: To illustrate how matrix multiplication can turn extremely complicated real-world problems into very simple ones. We introduce the concepts of
Leslie matrices and using matrices to track populations by age group.
I want to stay with this theme of matrix multiplication and show you another cool application for matrices and multiplying them and raising them to powers, which would be a horrible
thing to do by hand, but we are armed with technology today, boys and girls, we’ve got these
crazy things. And, using these things, we can solve some very complicated problems. And
the application I’d like to show you now is how to track populations through age groups.
Let’s say that you’re raising cattle and your herd of cattle, you’ve paid attention to the
age distribution throughout the years and you know the following facts about your group of
cattle. You know their birthrates going from one age group to another. Cattle of this age do
not actually have any cows of their own, but when they grow up, they’ll grow at a rate of fifty
percent, so however many are in this group, two years later, I’m doing things on a two year
cycle, half of that number will reappear in this group as being born into that group. So you
see as they get older they’re reproducing more and then as they get, and when they get very
old, their reproductive cycle kind of drops off. Also we have studied the survival rates, as
younglings there’s a slightly higher chance that they won’t survive, that means a lower rate
that they do survive, that’s the 0.7. And then about 0.9, there’s about a 100% chance that
they’ll survive to the next stage, there’s always sickness illnesses and these kind of things.
But then as they get older, they start to die of old age, so the survival rate goes down. And
then I’m assuming here that nothing will live past 12 years. There’s a 0% probability that
they will live past 12 years. (Figure 1)
So here’s my question: if I start with 40 head, and they’re all the same age, I go to
the stock yards and I buy 40 head of cattle, they’re all 2 years old, what would be the age
distribution of my herd in 30 years, okay? This could be important. Maybe I want to take
a certain set of those just like I had at the stock yards and sell them off. Maybe there’s
different things you can do with your animals at different age groups. So were just going to
try and track them, but were going to track them by groups, and were going to do this on 2
year cycles.
Well, let’s think about how you do this year to year, and I should say every 2 years to
2 years in my example. If I have a general kind of age distribution, so many in one group,
so many in another and so forth, and I think about how you get into that first age group –
those are the young ones, so they have to be born into that age group. So to get the total in
the next group, in the next cycle that are in that youngest age group, I look at the birth rates
for each of the groups and I multiply it by how many are in there. So 0 for the first one, 0.5
for the second, 1.1 and so on. And that’s a fairly messy calculation but I can clean it up a
little bit using matrices, watch this. I could say, just take your birth rates and put them in
a row in a matrix, take my age distribution, put that in a column and then all of a sudden,
that’s matrix multiplication. (Figure 2)
If I worry about how many survive to get into that second age group, well that’s the way
10
Figure 1, Segment 2
Figure 2, Segment 2
11
you get there, you’re not born into that second age group, you live to make it into that second
age group. And I know the survival rates, I know that 70% of those in the first age group
will then end up in the second age group after a 2 year cycle. And then I can phrase this,
now this looks messier then this, but I have a method to my madness. I’m going to take my
survival rate, fill in the rest with zeros and then I’ll do my matrix multiplication and that
gives me that result. (Figure 3) And then the third age group would be a similar thing, 0.9
of those survive from the second age group into the third age group, which I could phrase as
matrix multiplication. (Figure 4)
Figure 3, Segment 2
So the way I would do this in general would be that I would construct a 6 by 6 matrix,
if you have more age groups you’d have a bigger matrix, I have six age groups. And I’ll
put those birth rates across the top, and then when I multiply by my age distribution that
will give me that number in the first age group in the next cycle. And then 0.7 is the, now
these are survival rates so I take 70% of the first group, fill in with zeroes. To get the second
one I put 0’s here. You’ll notice that these are falling right below the main diagonal, okay?
So I can just fill in the rest of my matrix like that. We call this a Leslie matrix after the
mathematician who kind of developed this idea, you put the birth rates along the top and then
along that main diagonal you still have zeroes, you have zeroes everywhere else except along
that diagonal right below the main diagonal, you put in then the survival rates. And then I’ll
use that to show you how you can plot the number of animals in each age group. (Figure 5)
If I do this after one 2 year cycle what I’ll do is I’ll multiply this by my original distribution, which is right here. I have 40 in my second age group. And all that’s going to do is sort
of peel this part off right here and multiply by 40, right? Zero times this and all those is going
12
Figure 4, Segment 2
Figure 5, Segment 2
13
to be zero. But 0.5 times 40 will give me 20 and .9 times 40 will give me 36, so that’s how
many I would have in the age groups after the first 2 year cycle. (Figure 6) Then if I wanted
to do this after 4 years, that would be the second 2 year cycle. So again I would multiply by
this Leslie matrix, let me show you this times my original result – do the arithmetic. This is
just a little matrix multiplication. I’m not showing you the zero entries, the zero products.
And then, I’m starting to get fractional parts of cows, which is not always a good thing, but
you realize we’re going to have to do a little bit of rounding when were done. The quick way
to do this is not to do the multiplication 15 times, but to simply raise that Leslie matrix, if
you notice here, to get the answer, D1 , I got that by multiplying L times the original. So I
could raise L to the second power. And just like the problem before where I was dealing with
the probabilities and the transition matrices, that’s the quick way to do it. (Figure 7)
Figure 6, Segment 2
So to get the age distribution after 30 years, okay, that’s 15 two-year cycles, I would
just raise that matrix to the 15th power. And again that’s something we do on a graphing
calculator, we could use a computer algebra system to do that. And it’s fairly messy, but
what do I care? The calculators doing it, not me. Multiply that out and it gives me the age
distribution for each of the age groups. And as you can see here, things have grown very very
fast, and in fact I’ve got over a thousand cows now. That could be an issue. I may not have
enough grass and hay and corn and things to feed this many cows. So what you’d have to do
is go back and say, well, probably, I’m going to start selling some off and you’d reflect that
sell off in your survival rates. It’s not necessarily survival “Are they alive?”, it’s survival
“Do they make it to the next group?” And at some point there, you’d start selling them off
and that would lower the so-called “survival rate.” (Figure 8)
14
Figure 7, Segment 2
Figure 8, Segment 2
15
Okay, again I have a couple slides to show you kind of what we talked about, and we’ll
get ready for the next segment.
Summary page 1, Segment 2
16
Summary page 2, Segment 2
17
3
Population models – Unrestricted and restricted growth
models
Objective: To illustrate how we can use functions to model population growth,
and then use these models to predict future population sizes. We show examples
using the unrestricted exponential growth model, and the generally more realistic
restricted-growth logistic population model.
The last thing I’d like to talk to you today is exponential growth and how we model that
with a continuous model. What we’ve been using in the past two examples is really a discrete
model. We’re taking snippets of what happens at the end of a year cycle, a 2-year cycle
something like that. We can use functions and then a graphing calculator to draw the answer
and then realize that that’s an approximation of what’s going on. And what I’d like to talk
to you about is, okay, how do you really do that. If you’ve got some kind of population
growth, how do you do that, okay? And I want to talk about two situations, unrestricted and
restricted models.
What we just looked at with that Leslie matrix was an unrestricted growth model and it
was actually exponential growth because the rate of growth depended on how many cows or
whatever it was I had. And that’s what we call exponential growth. That’s what we have
when the rate of growth of an amount is proportional to how many you have. Now that kind
of situation, we’ve talked about before, can be modeled with an exponential function, A0 ekt ,
where k is the rate of growth and A0 is the initial amount that you start with. In fact, in a
previous episode, (Episode 1, Segment 3) we talked about how when your step gets smaller
and smaller and smaller you get this function ekt . So we have kind of talked about this in the
past, but the problem with this and I discussed it in the last example is that you’re assuming
here that they can grow without bounds, that I have unlimited resource for sustaining growth.
(Figure 1)
The model in Figure 1, which is stated without proof in many algebra texts, is actually
the solution of the differential equation mentioned in Figure 1:
dA
= kA, A(0) = A0 .
dt
The differential equation is separable, so we may integrate with respect to both variables:
Z
Z
dA
= k dt + C
A
ln |A| = kt + C
|A| = ekt+C = eC ekt .
By letting K = sign(A)eC , we may remove the absolute value signs, and our model becomes
A(t) = Kekt .
By letting t = 0 and using our initial condition A(0) = A0 , we see that K = A0 and the
given model is derived.
18
Figure 1, Segment 3
Now I just want to take a second and prove to you, show you that this model does what
I say it does. If I let the initial amount be 1 and the growth rate be 20% or 0.2, here is a
graph of that curve. You’ll notice that the initial amount is 1 and if I take little snippets,
if I take, the rate of change can be construed, and we’ve talked about this previously, as the
slope of a tangent line. So if I took the slope of the tangent line at this point, and I’m just
approximating it really, and then I took the slope of this, the slope at about this stage is 0.2,
and you can get this by taking 2 points on a curve and calculating the slope. And then if I
look at the function value, right there and I multiply it by this rate of growth, this k, well the
function value right there is one so sure enough these things are equal and that’s what I said
they should be. (Figure 2)
If I take the tangent line a little bit higher up, let’s say at when t = 6, the slope of that line
is almost 23 , 0.664 or so, and if I look at the function values right there and I say 0.2 times
that function value, sure enough I get 0.664. So they are matching up, that’s what’s supposed
to happen. Now, that’s a good financial model, we’ve used this when talking about money
and, boy, you like to think your money can grow without bounds. But it is a bad population
model as illustrated in the previous example. You can’t just assume that things can grow,
grow, grow, grow, grow, especially living things because they have to eat, they have to breath,
they have to drink, they have to have water, and they have to have medicine sometimes.
Things like this. So we need to look at a model where the resources are capped. You have
some kind of capacity for things living in an environment. (Figure 3)
So that’s the next example. That is, restricted exponential growth, that is where the
rate of growth of an amount is proportional to the product, you take them and multiply, its
19
Figure 2, Segment 3
Figure 3, Segment 3
20
proportional to the product of the amount and the amount less then the carrying capacity,
and I’ll use a capital K for that, because I didn’t want to use C, I guess. But there’s some
high number and I’ll say that’s the most you can have, that’s it. And after that things start
to starve to death and business like that, or die off in someway, die of disease or whatever
it is. Now the model for doing this is messy. Actually deriving that requires some calculus,
so I’m not going to get into the derivation of it, but it’s this kind of, there is this pattern
to what’s going on here. This is called the logistic equation, and this is something you’d be
given to use as a model in some type of situation. We just have to fill in the blanks. A0 is
our initial population, K is the carrying capacity, and this k is not the growth rate anymore
but it is some type of constant that we would need to solve for. (Figure 4)
Figure 4, Segment 3
The model in Figure 4, which is stated without proof in many algebra texts, is actually
the solution of the differential equation mentioned in Figure 4:
dA
= kA(K − A), A(0) = A0 ,
dt
with K > 0 and 0 ≤ A ≤ K. The differential equation is separable, so we may integrate
with respect to both variables:
Z
Z
dA
= k dt + C
A(K − A)
Z
Z
dA
dA
+
= kt + C
A
K −A
21
ln A − ln(K − A) = kt + C
ln
A
= kt + C
K −A
A
= ekt+C = eC ekt .
K −A
By letting M = eC , we may solve for A to get
A(t) =
KM ekt
KM
=
.
M ekt + 1
M + e−kt
By letting t = 0 and using our initial condition A(0) = A0 , we see that M =
K
A(t) =
A0
K−A0
A0
K−A0
A0
K−A0
and so
+ e−kt
=
KA0
.
A0 + (K − A0 )e−kt
So let me just convince you quickly that it does what I say it does. I’ll let the initial
amount be 1, k be 0.5, and the highest amount be 10. If you graph this, here’s 10, you’ll
notice that as it gets closer to this 10, it’s leveling off. I’ve filled in the blanks here, and
sure enough that curve is doing what I said it would do. In fact if I check the tangent lines,
the slopes here is about .45, this is when time is zero, and if I take the amounts, here’s the
amount, and here’s 10 minus the amount, that would be 1 times 9, solve for n is about .05.
(Figure 5) Now if I check at a different location, this is when time equals 6, the slope of this
line is a little over 1, if I say .05 times the amount of that curve, the y value of that curve,
and 10 minus the y value of that curve when time is equal to 6, sure enough I get the same
amount. So its doing what I said it would do, but what I’d really like it to do is show you
how that can give you a realistic model of populations. (Figure 6)
So let me give you an example. Let’s say you have 40 cows like in our previous example,
I’m not going to worry about tracking them by age group any more. I’m simply going to say,
alright I’ve got 40 cows, I have the capacity to feed and sustain 100, okay? That’s all the
pasture I’ve got, that’s all the feed I’ve got. And then I’d like to know, okay, I do want it to
grow, I do want my numbers to grow, so say if at the end of the year I have 44 cows, that’s
going to give me an indication of my growth rate, when can I expect that herd to grow to 80
in number? So we’re going to use this logistic equation to model the situation, and what I’m
going to do is I’m going to plug in the values, my initial population is 40, so 40 would go
there and there, etc. My carrying capacity is 100, so I’ll put 100 there and 100 there, and
I don’t know my growth rate, k, yet. So this actually works out to this, I’ve simplified it a
little bit. (Figure 7)
What you have to do is use that bit of information, okay, I had 44 at the end of the year,
to solve for k. And this is quickly just some solving of exponential equations, we do this in
college algebra, to kind of clean it up a bit. You can actually switch those out. Clean that
up and subtract the two from both sides. Go through then and divide by the 3. And then, to
solve for the k, you take the natural log of both sides, so you get − k equals this, and then
k would equal a negative logarithm, which just turns it upside down. That’s about 0.164303.
22
Figure 5, Segment 3
Figure 6, Segment 3
23
Figure 7, Segment 3
(Figure 8) And then you use that in your model and set you model equal to 80, and I know
I’m doing this very quickly, but you’ve seen this before. It’s the same step, you just take
things, swap them out, subtract 2 from both sides. you get this down to an exponential thing,
take the log of both sides, and you get time, t, to be about, this kind of messy thing, but its
about 10.9 years. And I’m relying on my calculator to get that. (Figure 9) And very quickly,
I’ll just show you the graph of things to convince you very quickly that that is the correct
answer. Here’s the curve that I graphed, here’s 80 and it does hit about at 10.9, right there.
(Figure 10)
Okay, a good example of how we can get a realistic model using exponential models. We’ve
got a few summary pages and well come back and wrap things up.
Closing
I hope you’ve enjoyed the example that I’ve shown you today. I have to admit, I went
off the deep end on algebra, and I realize that. Maybe I can make it up to the general math
students next time. But I’m really impressed by the power that you can access when you’re
using matrices and matrix multiplication. There’s a lot of powerful stuff that you can do
with algebra in general, and hopefully I’ve illustrated a few of those things. I did things very
quickly so if you want to download episodes of this, you can go to our web page and we’ll
flash that up in a minute. I’m done, thanks, and I’ll see you next week.
24
Figure 8, Segment 3
Figure 9, Segment 3
25
Figure 10, Segment 3
Summary page 1, Segment 3
26
Summary page 2, Segment 3
27
Download