WEBVTT mathematics/probability/murray
00:00:00.000 --> 00:00:05.800
Hi and welcome back to the probability lectures here on www.educator.com, my name is Will Murray.
00:00:05.800 --> 00:00:13.500
Today, we are going to talk about the expected value of a random variable which is also known as the mean of a random variable.
00:00:13.500 --> 00:00:16.600
Those two words or phrases mean exactly the same thing.
00:00:16.600 --> 00:00:20.500
Mean and expected value are used interchangeably.
00:00:20.500 --> 00:00:22.300
Let us learn what those mean.
00:00:22.300 --> 00:00:32.400
The way you calculate the expected value of a random variable is you find all the possible values of the random variable,
00:00:32.400 --> 00:00:44.500
you multiply each one by the probability that that value will come up and then you add those up.
00:00:44.500 --> 00:00:48.100
The notation that we use for that is actually a little confusing because
00:00:48.100 --> 00:00:52.400
they are 2 different notations that are used interchangeably there.
00:00:52.400 --> 00:01:01.600
E of Y means expected value and μ is the Greek letter μ and that stands for mean.
00:01:01.600 --> 00:01:06.400
Those mean exactly the same thing, we use those interchangeably.
00:01:06.400 --> 00:01:14.000
Remember from now, if we say the word mean, if we say the phrase expected value, those are exactly the same.
00:01:14.000 --> 00:01:19.000
They are both defined the same way, it means you look at all the possible values and
00:01:19.000 --> 00:01:23.200
the probability of each one, multiply those together and add them up.
00:01:23.200 --> 00:01:27.100
That is the definition, that is not the hugely illuminating.
00:01:27.100 --> 00:01:32.200
The intuition behind expected value is that you want a think of it
00:01:32.200 --> 00:01:40.800
as the average value of that random variable over the long run, if you repeat an experiment many times.
00:01:40.800 --> 00:01:50.500
If you do the experiment many times, on average the, random variable Y should be that value, the value of the mean.
00:01:50.500 --> 00:01:59.900
It does not mean it will ever be exactly equal to that value but in the long run, it will average out to that value.
00:01:59.900 --> 00:02:06.000
Another way to think about this is if you think of Y as being a payoff for a fair game.
00:02:06.000 --> 00:02:10.700
We talked about this a little bit in the previous lecture, when we first learn about random variables.
00:02:10.700 --> 00:02:16.600
We talked about how you some× want to think of the random variable as being a payoff on a game.
00:02:16.600 --> 00:02:21.100
We play a game, we do some kind of experiment, and then based on that experiment
00:02:21.100 --> 00:02:26.300
I pay you a certain amount of money and that amount of money is the value of Y.
00:02:26.300 --> 00:02:37.500
If you think of it that way and then if you want to make this game fair then the expected value is the amount that you should pay me, in order to play this game once.
00:02:37.500 --> 00:02:43.800
If you play this game many times, on the average, the amount you pay me to play and
00:02:43.800 --> 00:02:48.800
the amount I pay you will balance out and will be even.
00:02:48.800 --> 00:02:54.400
It is the amount that a game should cost, in order to make it a fair game.
00:02:54.400 --> 00:02:59.800
That is the intuitive idea of expected value or mean.
00:02:59.800 --> 00:03:03.000
We got several different notions we need to explore with this.
00:03:03.000 --> 00:03:07.000
The first one is indicator of random variables.
00:03:07.000 --> 00:03:11.500
Indicator random variables are very simple random variables.
00:03:11.500 --> 00:03:17.400
What an indicator random variable does is it just looks as particular event and
00:03:17.400 --> 00:03:24.800
it takes on the value 1 if that event is true and the value of 0 if that event is false.
00:03:24.800 --> 00:03:28.400
It is an indicator for whether that event happened.
00:03:28.400 --> 00:03:34.700
A very common example of an indicator random variable would be if you are flipping a coin a number of times
00:03:34.700 --> 00:03:42.400
and then you would set up an indicator random variable to indicate whether or not a particular flip was heads.
00:03:42.400 --> 00:03:45.800
That is a kind of an example of an indicator random variable.
00:03:45.800 --> 00:03:51.200
We will see in some of the problems later on in this lecture how you use indicator variables.
00:03:51.200 --> 00:03:54.500
We will use it for that example of flipping a coin many times.
00:03:54.500 --> 00:04:00.600
The important thing about an indicator random variable is the expected value of that
00:04:00.600 --> 00:04:06.000
indicator random variable is just the probability that that event is true.
00:04:06.000 --> 00:04:11.400
It is very easy to calculate the expected value of an indicator random variable.
00:04:11.400 --> 00:04:15.300
You just calculate the probability of that event being true.
00:04:15.300 --> 00:04:22.500
For example, if you are flipping a coin many × and you have an indicator random variable for the first flip being heads,
00:04:22.500 --> 00:04:27.600
if it is a fair coin, there are is 50-50 chance that that first flip is going to be a head.
00:04:27.600 --> 00:04:33.500
The expected value of that indicator random variable is just ½.
00:04:33.500 --> 00:04:37.800
Let me show you a little more about how we are going to use these ideas.
00:04:37.800 --> 00:04:47.700
A very key notion with expected values that is very useful in probability is this notion of linearity of expectation
00:04:47.700 --> 00:04:53.500
The idea there is that you can combine random variables and you can break them apart.
00:04:53.500 --> 00:04:58.500
The expected value is preserved across those kinds of combinations.
00:04:58.500 --> 00:05:07.500
If you have 2 random variables Y1 and Y2, or if you have constants A and B,
00:05:07.500 --> 00:05:19.600
the expected value of this combination just breaks apart linearly into A × the expected value of Y1 + B × the expected value of Y2.
00:05:19.600 --> 00:05:28.000
A very key formula there, we usually use it to break apart complicated random variables into simple random variables.
00:05:28.000 --> 00:05:36.100
The most common use of that is to break apart a variable into indicator variables
00:05:36.100 --> 00:05:41.200
because it is very easy to calculate the expected value of indicator variables.
00:05:41.200 --> 00:05:43.200
This is all a bit theoretical right now.
00:05:43.200 --> 00:05:46.600
We are going to get some nice examples in just a couple of moments.
00:05:46.600 --> 00:05:51.800
You will get to see how a complicated variable splits up into indicator variables and
00:05:51.800 --> 00:05:58.100
it makes the expected value much easier to calculate.
00:05:58.100 --> 00:06:03.500
There is one more notion that we need to explore before we jump into the examples
00:06:03.500 --> 00:06:08.000
which is the expected value of a function of a random variable.
00:06:08.000 --> 00:06:13.600
Instead of just looking around the variable by itself, we will look at some function G of Y.
00:06:13.600 --> 00:06:19.400
Probably the most common example for G of Y will be Y², that is very common example there.
00:06:19.400 --> 00:06:29.400
The expected value of functional random variables is defined very similarly to how the expected value of the original variable was.
00:06:29.400 --> 00:06:34.100
Let me just remind you how we define the expected value of the original variable.
00:06:34.100 --> 00:06:46.000
E of Y was the sum overall real number, of all possible real numbers of P of Y × Y.
00:06:46.000 --> 00:06:49.200
That was the expected value of Y.
00:06:49.200 --> 00:06:53.900
That Y on the right there came from that Y in there.
00:06:53.900 --> 00:06:57.100
That is what we are finding the expected value.
00:06:57.100 --> 00:07:00.900
Here we are finding the expected value of a function G of Y.
00:07:00.900 --> 00:07:07.900
We replace that Y on the right with G of Y.
00:07:07.900 --> 00:07:13.300
We replace that Y on the right, instead of just having P of Y × Y.
00:07:13.300 --> 00:07:17.800
We did P of Y × G of Y and then we calculate that sum.
00:07:17.800 --> 00:07:21.400
Often, it will be Y², we will see some examples of that.
00:07:21.400 --> 00:07:28.100
I think this is a bit abstract but after we do some examples then it will make a lot more sense.
00:07:28.100 --> 00:07:31.500
Let us work through some of these examples together.
00:07:31.500 --> 00:07:36.900
First example here, this is actually the same experiment that we had back in the previous lecture
00:07:36.900 --> 00:07:43.000
but we are going to calculate the expected value now.
00:07:43.000 --> 00:07:48.200
The example is that you are going to draw a card from a standard 52 card deck.
00:07:48.200 --> 00:07:51.100
If it is ace through 9, I pay you that amount.
00:07:51.100 --> 00:07:53.400
If you draw an ace, I will pay you $1.00.
00:07:53.400 --> 00:07:55.600
If you draw a 2, I will pay $2.00.
00:07:55.600 --> 00:07:57.900
If you draw a 9, I will pay you $9.00.
00:07:57.900 --> 00:08:01.200
If it is a 10 though, you have to pay me $10.00.
00:08:01.200 --> 00:08:08.700
If it is any face card, a jack, queen, or king, then you have to pay me $10.00 for that privilege.
00:08:08.700 --> 00:08:14.700
I want to figure out what is the expected value for you for this random variable.
00:08:14.700 --> 00:08:17.200
Let us calculate that out together.
00:08:17.200 --> 00:08:29.600
Remember, the expected value of a random variable just by definition is the sum of all possible values of Y , of P of Y,
00:08:29.600 --> 00:08:33.800
the probability of that particular value × the value itself Y.
00:08:33.800 --> 00:08:38.600
Let us think about the different values that this game could take for you.
00:08:38.600 --> 00:08:40.600
It could end up winning $1.00.
00:08:40.600 --> 00:08:46.900
If you win $1.00 from this game that is if you get an ace.
00:08:46.900 --> 00:08:50.100
There are 4 ways you can get an ace out of 52 cards.
00:08:50.100 --> 00:08:57.500
You have a 1/13, that is 4/52, 1/13 chance of winning exactly $1.00.
00:08:57.500 --> 00:09:02.400
By the way, we calculated this probability distribution as an example in the previous lecture.
00:09:02.400 --> 00:09:05.600
If this is completely mysterious, you may want to go back and
00:09:05.600 --> 00:09:13.900
watch that example in the previous lecture then this one will make a little more sense.
00:09:13.900 --> 00:09:17.900
What else could you make, you could make $2.00 out of this experiment.
00:09:17.900 --> 00:09:29.000
There is a 1/13 chance that you are going to make $2.00 because there are 4 cards out of the possible 52 that will give you $2.00.
00:09:29.000 --> 00:09:38.000
1/13 chance you are going to make $3.00 because there are 4 cards, there are 4 3’s in the deck out of 52 cards.
00:09:38.000 --> 00:09:47.900
All the way on up to you can make $9.00 and there is a 1/13 chance that you can make $9.00.
00:09:47.900 --> 00:09:51.000
You could also end up losing money on this experiment.
00:09:51.000 --> 00:09:55.600
If you get a 10, jack, queen, or king, you pay me $10.00.
00:09:55.600 --> 00:10:03.000
For you, that is a -$10.00 difference.
00:10:03.000 --> 00:10:08.400
The odds of getting that were 16 out of 52, we calculated that last time.
00:10:08.400 --> 00:10:17.200
There are 16 cards out of 52 possible that count as 10, jacks, queens, or kings.
00:10:17.200 --> 00:10:21.200
16 out of 52 reduce to 4 out of 13.
00:10:21.200 --> 00:10:25.500
That is the probability that you will end up paying me $10.00.
00:10:25.500 --> 00:10:28.900
Let us calculate this together.
00:10:28.900 --> 00:10:38.600
You see you got a 1/13 everywhere, if we factor out that 1/13 and then I will just have 1 + 2 + 3
00:10:38.600 --> 00:10:51.400
up to 9 -4 × 10 because I factor out the denominator of 13, so 4 × 10 there.
00:10:51.400 --> 00:11:08.700
1 + 2 + 3 + 4, 5, 6, 7, 8, 9, that turned up to be 45 - 4 × 10 is 40 which is 5/13.
00:11:08.700 --> 00:11:16.200
What that means is that is the expected value of a random variable, it is also the mean.
00:11:16.200 --> 00:11:21.100
Remember, the mean and expected value are exactly the same thing, so use those interchangeably.
00:11:21.100 --> 00:11:26.300
Μ and E of Y, you want to get use to using those interchangeably.
00:11:26.300 --> 00:11:31.900
What that means, I guess 5/13 is a little bit less than ½.
00:11:31.900 --> 00:11:43.200
In the long run, if we play this game many times, on the average you are going to make about 5/13 for a dollar per game.
00:11:43.200 --> 00:11:51.900
Obviously, in each game, you will never make exactly 5/13 because we are only trading back and forth a whole dollar here.
00:11:51.900 --> 00:12:06.100
But it means that in the long run, every time we play 13 games, you should expect to make about $5.00 on average.
00:12:06.100 --> 00:12:12.000
You, if we are going to make this a fair game, you should pay me for the privilege of paying.
00:12:12.000 --> 00:12:15.800
Because on the average, I’m going to end up paying you a little bit per game.
00:12:15.800 --> 00:12:29.500
You should pay 5/13 for a dollar to make it a fair game.
00:12:29.500 --> 00:12:36.300
If I'm going to open a casino then I will probably round that up to 50¢.
00:12:36.300 --> 00:12:42.800
I will make you pay 50¢ to play this game because I want to make sure that I will make a profit in the long run.
00:12:42.800 --> 00:12:46.900
If I’m in a casino, I have to charge a little bit more than 5/13 for a dollar,
00:12:46.900 --> 00:12:53.400
in order to guarantee that I will make a profit in the run long and cover my other expenses.
00:12:53.400 --> 00:12:57.900
Maybe I will charge you 50¢, maybe I will charge you an even dollar to play this game but
00:12:57.900 --> 00:13:02.600
I have to charge you more than 5/13 for the dollar or else I’m going to lose in the long run and
00:13:02.600 --> 00:13:07.400
you will take money away from me by playing this game multiple times.
00:13:07.400 --> 00:13:09.400
Just to remind you where everything came from here.
00:13:09.400 --> 00:13:17.700
We are calculating the expected value of a random variable, that means we look at all the possible values and the probability of each one.
00:13:17.700 --> 00:13:26.100
Those possible values, you can make $1.00, $2.00, $3.00, up to $9.00, or you could end up having to pay me $10.00.
00:13:26.100 --> 00:13:28.700
And then, we calculated the probabilities of each one.
00:13:28.700 --> 00:13:38.600
We did this example in the previous lecture but those probabilities just depend on how many cards give you those particular payoffs.
00:13:38.600 --> 00:13:48.800
We figure out those probabilities and then this just was a fairly easy set of fractions to simplify down to 5/13 for the dollar.
00:13:48.800 --> 00:13:53.500
That is the expected value which is the same as the mean of this game.
00:13:53.500 --> 00:13:58.200
That means that if we are going to make it a fair game, a game that in the long run
00:13:58.200 --> 00:14:03.200
there is no winning or losing between us, you should pay me 5/13 for the dollar.
00:14:03.200 --> 00:14:07.700
If I want to make a profit off this, if I'm running a casino, of course, I want to make a profit.
00:14:07.700 --> 00:14:16.700
I’m going to charge you a little bit more than 5/13 for the dollar, maybe 50¢, maybe a whole dollar to play this game.
00:14:16.700 --> 00:14:21.400
Example 2 here, it is the same example as above, at least in the beginning.
00:14:21.400 --> 00:14:24.800
You are going to draw a card from a standard 52 card deck.
00:14:24.800 --> 00:14:27.200
If it is an ace through 9, I pay you that amount.
00:14:27.200 --> 00:14:29.900
If it is a 10 or a face card, you pay me $10.00.
00:14:29.900 --> 00:14:34.200
That part is the same, let Y be the amount that I pay you.
00:14:34.200 --> 00:14:37.600
What is the expected value for Y²?
00:14:37.600 --> 00:14:42.300
That is the new part, we are looking at Y² instead of Y.
00:14:42.300 --> 00:14:45.500
The difference between this example and the previous one.
00:14:45.500 --> 00:14:54.200
If this were a casino game and the casino promise to pay you Y², how much Y would the casino charge you to play?
00:14:54.200 --> 00:15:00.600
What we are really doing here is we are looking at the expected value of a function of a random variable.
00:15:00.600 --> 00:15:06.000
We are trying to find the expected value of Y².
00:15:06.000 --> 00:15:10.200
Remember, the expected value of a function of a random variable,
00:15:10.200 --> 00:15:14.700
let me show you up here the formula that we learned earlier.
00:15:14.700 --> 00:15:27.800
It is the sum over all the possible values in the variable of the probability of each one × that function applied to the value.
00:15:27.800 --> 00:15:33.600
The difference there is instead of having Y by itself, you put G of in here.
00:15:33.600 --> 00:15:43.500
I will add up all the probabilities and all the Y values, except instead of putting in the Y values, I’m going to put in Y² each time now.
00:15:43.500 --> 00:15:53.500
Our probabilities are 1/13, the Y is going to be 1.
00:15:53.500 --> 00:15:58.200
Let me actually write the sum generically first, just to make it a little more clear here.
00:15:58.200 --> 00:16:11.000
We are going to find the sum of Y/Y × P of Y × GL of Y, that is the sum on Y of P of y.
00:16:11.000 --> 00:16:16.400
G of Y, that is this function right here, it is Y².
00:16:16.400 --> 00:16:24.300
Our probabilities were 1/13 and our first value was 1, but we are going to square it, 1/13.
00:16:24.300 --> 00:16:36.900
The next value was 2² 1/13, 3², up to 1/13 × 9².
00:16:36.900 --> 00:16:47.500
Finally, the last value we could get was our probability 4/13 and it was -10 then we have to square that.
00:16:47.500 --> 00:16:50.200
Now, we have to do some arithmetic to simplify this.
00:16:50.200 --> 00:16:54.300
Again, I still see that I have a 1/13 everywhere.
00:16:54.300 --> 00:17:05.700
1/13 × 1 + 2² is 4, 3² is 9, and so on, up to 9² is 81.
00:17:05.700 --> 00:17:09.800
We have this last value of 4 × -10².
00:17:09.800 --> 00:17:17.900
Squaring it makes it positive, + 4 × 100.
00:17:17.900 --> 00:17:20.600
It is just some arithmetic to simplify that.
00:17:20.600 --> 00:17:23.900
There is a formula, by the way, for adding up the sum of cubes.
00:17:23.900 --> 00:17:31.800
It is a clever formula, I did not bring that in here because it is not really relevant to what I'm trying to teach you today.
00:17:31.800 --> 00:17:34.700
I will just to add up those numbers quickly.
00:17:34.700 --> 00:17:44.400
1 + 4 + 9 up to 81 + 400 turns out to be 685.
00:17:44.400 --> 00:17:54.800
Our real answer there is 685/13, that is our exact answer.
00:17:54.800 --> 00:17:58.800
If we are in a casino, you do not to deal in 13 for the dollar.
00:17:58.800 --> 00:18:10.700
That is a little bit around $53.00, I round it out there to $53.00.
00:18:10.700 --> 00:18:17.000
That means if you play this game, on the average, on the long run, you can make about $53.00.
00:18:17.000 --> 00:18:21.300
Of course, you will not make exactly $53.00, you will make one of these values.
00:18:21.300 --> 00:18:26.000
You either make $1.00 or $4.00, or $9.00.
00:18:26.000 --> 00:18:29.700
You might make $81.00, you might make $100.
00:18:29.700 --> 00:18:36.000
You are going to make one of those values but in the long run, on the average, you are going to make about $53.00.
00:18:36.000 --> 00:18:45.600
If I'm the casino running this game, I had a 100,000 people play it on a given night then
00:18:45.600 --> 00:18:51.200
I'm going to expect to pay out about $53.00 per customer on average.
00:18:51.200 --> 00:18:59.300
That means, I will payout about $5,300,000 to people playing this game on any given night.
00:18:59.300 --> 00:19:02.700
That is a lot of money.
00:19:02.700 --> 00:19:08.100
If I'm the casino then I want to make sure I get a profit on this game.
00:19:08.100 --> 00:19:17.800
A casino would have to charge a little more than $53.00, in order to make sure that
00:19:17.800 --> 00:19:23.400
they make a profit in the long run on this game.
00:19:23.400 --> 00:19:33.300
They might charge, if we are going to run this casino, my charge maybe $60.00 to play.
00:19:33.300 --> 00:19:38.500
That means on every customer that plays this game, on average,
00:19:38.500 --> 00:19:43.500
we expect to make $7.00 off this customer and in the long run we will make a nice, healthy profit.
00:19:43.500 --> 00:19:51.100
In the short run, we might to lose money because certain customers are going to win $80.00 or $81.00.
00:19:51.100 --> 00:19:54.700
Certain customers are going to win $100 from their $60.00 play.
00:19:54.700 --> 00:19:58.800
In the long run, we will make about $7.00 from each game.
00:19:58.800 --> 00:20:05.300
We will be happy as a casino even if we lose a few games in the meantime.
00:20:05.300 --> 00:20:07.100
Let me recap what we are doing here.
00:20:07.100 --> 00:20:12.300
We are really finding the expected value of the function of a random variable here.
00:20:12.300 --> 00:20:19.500
I’m using this formula that was given on one of the early slides of this lecture, the third or fourth slide.
00:20:19.500 --> 00:20:24.900
I think it is the 4th slide of this lecture, the expected value of a function of a random variable.
00:20:24.900 --> 00:20:29.400
What you do is you look at all the possible values in the random variable,
00:20:29.400 --> 00:20:34.800
the probability of each one, and you multiply it by that function of that value.
00:20:34.800 --> 00:20:37.000
In this case, the function is Y².
00:20:37.000 --> 00:20:44.900
Instead of having P of Y × Y, the way we had in the previous example, we have P of Y × Y square.
00:20:44.900 --> 00:20:54.800
We do the same calculations before except the new element here is I’m squaring each of the Y before I run through the calculation.
00:20:54.800 --> 00:21:00.000
The most notable change there is that makes that -10, makes it positive.
00:21:00.000 --> 00:21:05.400
We now get 4 × 100, instead of 4 × -10.
00:21:05.400 --> 00:21:14.600
The arithmetic there comes out to be about $53.00 which means if the casinos can offer you Y², then on average,
00:21:14.600 --> 00:21:17.500
you are going to make about $53.00 per game.
00:21:17.500 --> 00:21:23.400
If the casino wants to make sure that they make a profit, they will charge a little more than $50.00,
00:21:23.400 --> 00:21:30.800
maybe $60.00 would be enough to guarantee them that they are going to make about $7.00 per game.
00:21:30.800 --> 00:21:37.100
You are going to make more money on some games and lose some money on some games but make about $7.00 per game.
00:21:37.100 --> 00:21:43.600
It is a nice, healthy profit for the casino.
00:21:43.600 --> 00:21:52.000
The next example here, I want to flip a coin 3× and we are going to calculate the expected number of heads.
00:21:52.000 --> 00:21:59.400
The second part of this problem, we are going to flip a coin 100× and calculate the expected number of heads.
00:21:59.400 --> 00:22:02.500
We are going to use two different strategies to think about this problem and
00:22:02.500 --> 00:22:07.300
I'm sort of trying to illustrate the principle of linearity of expectations.
00:22:07.300 --> 00:22:16.100
We are getting to that in a few minutes but let me start out just by calculating the answer to the first problem directly.
00:22:16.100 --> 00:22:19.000
We are going to set up our random variable first.
00:22:19.000 --> 00:22:31.400
Let Y, we are going to define Y to be rows columns equals and it is defined to be the total number of heads.
00:22:31.400 --> 00:22:41.700
That is the random variable that I'm going to keep track of here, the total number of heads.
00:22:41.700 --> 00:22:51.600
I want to think about all the possible outcomes of this experiment and then what the value of Y would be for each one.
00:22:51.600 --> 00:22:57.200
Let us think about all the possible things that can happen, when you flip a coin 3×.
00:22:57.200 --> 00:23:05.500
You could get head-head-head, you could get head-head- tail, could get head-tail-head.
00:23:05.500 --> 00:23:11.800
I’m sort of running them through in a binary fashion here, head-tail-tail.
00:23:11.800 --> 00:23:25.500
I’m imagining myself counting in binary, tail-head-head, tail-head-tail, tail-tail-head, and tail-tail-tail.
00:23:25.500 --> 00:23:26.700
There should be 8 outcomes total.
00:23:26.700 --> 00:23:33.900
Let me make sure I have got them all, 1, 2, 3, 4, 5, 6, 7, 8 outcomes total.
00:23:33.900 --> 00:23:38.100
Let us think about what the value of Y would be for each one of those.
00:23:38.100 --> 00:23:49.600
The total number of heads, in the first one we got 3 heads, then 2 heads, 2 heads, 1 head, 2 heads, 1 head, 1 head, and 0 heads.
00:23:49.600 --> 00:23:53.700
Those where the values of Y for each one there.
00:23:53.700 --> 00:24:00.700
Let me calculate the expectation of that random variable, the mean of that random variable.
00:24:00.700 --> 00:24:11.600
I’m just going to use the basic formula which was the sum/all possible values of Y of P of Y × Y.
00:24:11.600 --> 00:24:17.300
I’m just using the basic definition of expectation of the mean of the random variable.
00:24:17.300 --> 00:24:20.400
Remember, expected value and mean are the same thing.
00:24:20.400 --> 00:24:23.400
Those are just absolutely synonymous expressions.
00:24:23.400 --> 00:24:29.700
You use them interchangeably that you do not get any different information from one as from the other.
00:24:29.700 --> 00:24:37.300
The probability of each one of these outcomes is 1/8.
00:24:37.300 --> 00:24:47.400
It is 1/8 × 3 + 1/8 × 2 +, there is going to a 1/8 on all of these.
00:24:47.400 --> 00:24:53.500
Let me just factor out the 1/8 and add up all the values of Y there.
00:24:53.500 --> 00:25:04.600
It is a 3 + 2 + 2 + 1 + 2 + 1 + 1 + 0.
00:25:04.600 --> 00:25:17.200
Let us see, 3 + 2 is 5 + 2 is 7 + 1 is 8 + 2 is 10 + 1 is 11 + 1 is 12, this is 12/8.
00:25:17.200 --> 00:25:23.900
Of course, that simplifies down to 3/2, that is the expected number of heads.
00:25:23.900 --> 00:25:28.900
It is a little curious there, if you flip a coin 3 ×, there is no way you can get 3/2 heads.
00:25:28.900 --> 00:25:34.000
You are either going to get 0 heads, or 1 head, or 2 heads, or 3 heads.
00:25:34.000 --> 00:25:39.800
It is not saying we expect to get 3/2 of a head because we cannot get 3/2 of a head.
00:25:39.800 --> 00:25:50.900
What it is really saying is if you do this experiment many times, on the average, you will get 3/2 heads per experiment.
00:25:50.900 --> 00:26:00.800
If you do this experiment, for example 8 ×, you would probably expect to see about 12 heads in total because 12/8 is 3/2.
00:26:00.800 --> 00:26:04.200
That is what this number is saying.
00:26:04.200 --> 00:26:08.000
That was a bit of computation in order to find that.
00:26:08.000 --> 00:26:12.500
Let me show you another way to calculate this and I think it is a better way.
00:26:12.500 --> 00:26:19.200
We are going to use linearity of expectation and we are going to use indicator variables.
00:26:19.200 --> 00:26:28.900
Here is a better way to calculate this expected value.
00:26:28.900 --> 00:26:39.900
We are going to define the indicator variables.
00:26:39.900 --> 00:26:44.700
Remember, indicator variables are variables that just take the value of 1 or 0
00:26:44.700 --> 00:26:47.600
depending on whether some event is true or false.
00:26:47.600 --> 00:26:53.400
I have talked about indicator variables on one of the early slides back in the beginning of the same lecture.
00:26:53.400 --> 00:26:59.100
You can just scroll back and check that out, if you do not remember what the indicator variable is.
00:26:59.100 --> 00:27:06.500
In this case, I would define y1 to be the indicator variable for the first flip being heads.
00:27:06.500 --> 00:27:22.300
Y1is going to be 1 if the first flip is a head and it is going to be 0 if the first flip is a tail.
00:27:22.300 --> 00:27:26.100
Y2 is very much the same thing.
00:27:26.100 --> 00:27:38.200
It is going to be 1 if the second flip is a head and 0 if it is a tail.
00:27:38.200 --> 00:27:42.800
Y3 is the same thing for the third flip.
00:27:42.800 --> 00:27:48.900
If the third flip is a head and 0 if it is a tail.
00:27:48.900 --> 00:27:54.400
The point of that is that y1is just an indicator variable for the first flip being a head.
00:27:54.400 --> 00:27:57.800
Y2 is an indicator variable for the second flip being a head.
00:27:57.800 --> 00:28:04.600
Y3 is an indicator for the third flip being a head.
00:28:04.600 --> 00:28:14.500
Let us think about y1by itself, the expected value of Y1.
00:28:14.500 --> 00:28:22.800
The expected value of y1is just the probability that the first flip is a head.
00:28:22.800 --> 00:28:35.000
The first flip is a head, that was what we learn about indicator variables in an early slide for this lecture.
00:28:35.000 --> 00:28:41.500
It is very easy to calculate the expected value of an indicator variable.
00:28:41.500 --> 00:28:44.000
It is just the probability that that event is true.
00:28:44.000 --> 00:28:50.300
What is the probability that the first flip is a head, that of course is ½.
00:28:50.300 --> 00:29:01.800
And then, we can find the expected value of Y2 the same way is also ½ and the expected value of Y3 is also ½.
00:29:01.800 --> 00:29:04.200
Here is the beauty of this system.
00:29:04.200 --> 00:29:11.900
Y is our total number of heads.
00:29:11.900 --> 00:29:16.700
Our total number of heads is going to be the number of heads you get on the first flip +
00:29:16.700 --> 00:29:23.200
the number of heads you get on the second flip + the number of heads you get on the third flip.
00:29:23.200 --> 00:29:29.100
Y breaks down into a sum of these 3 indicator variables.
00:29:29.100 --> 00:29:43.900
What we can use now is the beautiful linearity of expectation.
00:29:43.900 --> 00:29:57.200
Linearity of expectation says the expected value of Y is equal to the expected value of Y1+, let me put them all together here.
00:29:57.200 --> 00:30:04.800
Y is the same as Y1+ Y2 + Y3, the total number of heads is equal to the number heads you get on each flip.
00:30:04.800 --> 00:30:16.500
The expected value of Y1, now we are using linearity + expected value of Y2 + the expected value of Y3.
00:30:16.500 --> 00:30:24.600
But we figure all those out that is just ½ + ½ + ½ which is 3/2.
00:30:24.600 --> 00:30:28.200
That is the same answer we got before but the advantage of that is,
00:30:28.200 --> 00:30:35.900
we did not have to scroll down through all these 8 different possible outcomes.
00:30:35.900 --> 00:30:39.700
That is a good way of calculating our answer to part A.
00:30:39.700 --> 00:30:44.000
All those was just in the service of calculator answer to part A.
00:30:44.000 --> 00:30:48.500
Let us think about part B now, I have not left myself much space here.
00:30:48.500 --> 00:31:06.000
If we want to answer part B by listing all the outcomes, we would need to list 2 ⁺100 outcomes because we are flipping a coin 100 ×.
00:31:06.000 --> 00:31:09.400
Each time we flip it, there are 2 possible things that can happen.
00:31:09.400 --> 00:31:16.400
There are a string of 100 heads and tails for each possible outcome and there is 2 ⁺100,
00:31:16.400 --> 00:31:21.600
2 × 2 × 2 a hundred × possible outcomes.
00:31:21.600 --> 00:31:24.000
There is no way we can list that many outcomes.
00:31:24.000 --> 00:31:27.900
I certainly do not have time on this video and you do not want to watch all of that.
00:31:27.900 --> 00:31:33.500
There is really no way we can do this problem using the first method that I taught you for part A here.
00:31:33.500 --> 00:31:41.100
We are pretty much stuck until we learn about linearity of expectation.
00:31:41.100 --> 00:31:46.800
Instead, use linearity.
00:31:46.800 --> 00:32:06.600
If you break it up the exact same way we broke up the first one, E of Y is equal to E of Y1 up to E of Y100.
00:32:06.600 --> 00:32:10.600
We have broken it up into 100 little indicator variables and
00:32:10.600 --> 00:32:32.400
the expected value of each one of those little indicator variables is just the same as the variables before, that is ½ + ½, 100 × over,
00:32:32.400 --> 00:32:37.800
We are adding up a hundred ½ here and the expected number of heads,
00:32:37.800 --> 00:32:44.500
the average number of heads, this is not too surprising, in a hundred flips is 50.
00:32:44.500 --> 00:32:48.800
We are really depending heavily on that linearity of expectation,
00:32:48.800 --> 00:33:00.300
in order to simplify a problem from having to write out 2 ⁺100 possible outcomes down into just adding up a bunch of ½.
00:33:00.300 --> 00:33:08.800
That is really showing the power of linearity of expectation there for larger experiment.
00:33:08.800 --> 00:33:10.100
Let me recap here.
00:33:10.100 --> 00:33:13.300
We cannot do this, the first part of this problem 2 different ways.
00:33:13.300 --> 00:33:22.300
First way, we just listed all the outcomes here, all the possible things that can happen when you flip a coin 3 ×.
00:33:22.300 --> 00:33:27.300
All the possible strings that can happen, head-head-head, head-head-tail, and so on.
00:33:27.300 --> 00:33:33.600
For each one of those, we wrote down how many different heads were listed in the string
00:33:33.600 --> 00:33:41.200
and then we added up the probability of each one which is 1/8 × the number of heads we saw each time.
00:33:41.200 --> 00:33:45.900
This set of numbers comes from this set right here.
00:33:45.900 --> 00:33:49.800
If you just do the arithmetic there, it all simplifies down to 3/2.
00:33:49.800 --> 00:33:57.400
In the long run, we expect to see 3/2 heads when you do this experiment, on average.
00:33:57.400 --> 00:34:02.200
You will never see exactly 3/2 heads because there is no way to have half of the head.
00:34:02.200 --> 00:34:12.100
What this means is that the long run, on average, will be that you will see 3/2 heads per experiment.
00:34:12.100 --> 00:34:16.100
That was sort of the first way to do it but then I said there is a much better way
00:34:16.100 --> 00:34:24.000
which is to set up these indicator variables which keep track of each flip, the first flip, the second flip, the third flip.
00:34:24.000 --> 00:34:27.400
It is just 1 if that flip is a head and 0 otherwise.
00:34:27.400 --> 00:34:31.400
It is the number of heads you see on the first flip.
00:34:31.400 --> 00:34:34.100
You either see 1 or 0.
00:34:34.100 --> 00:34:42.200
The expected value for each one of these indicator variables, the expected value of any indicator variable is the probability that
00:34:42.200 --> 00:34:48.300
that event is true which in this case, what is the probability that the first flip is a head, its ½.
00:34:48.300 --> 00:34:52.400
For each one of the other flips, the probability is ½.
00:34:52.400 --> 00:34:58.200
Y is the total number of heads which breaks down into the number of heads on the first flip +
00:34:58.200 --> 00:35:01.800
the number heads on the second flip + the number of heads in the third flip.
00:35:01.800 --> 00:35:05.400
Here is where we invoke linearity of expectation.
00:35:05.400 --> 00:35:12.400
The expected value of Y turns to be the expected value of Y1+ Y2 + Y3 and that breaks up.
00:35:12.400 --> 00:35:21.200
Here is the linearity right here, that breaks up into the expected value of the individual random variables
00:35:21.200 --> 00:35:26.600
which we already calculated to be ½ each so we get 3/2.
00:35:26.600 --> 00:35:35.400
That may not seem much better on this small example A here but when we get to part B, we have a hundred flips.
00:35:35.400 --> 00:35:42.300
The number of outcomes we would have to list would be 2⁺100 because it is 2 × 2 × 2 a hundred ×.
00:35:42.300 --> 00:35:44.100
There is no way we can list that.
00:35:44.100 --> 00:35:48.200
There is no way we can use that first method to solve that one.
00:35:48.200 --> 00:35:57.000
But instead, if we use linearity, it breaks up very easy way into 100 little indicator variables.
00:35:57.000 --> 00:36:05.100
Each one has expected value ½ and if you just add up a ½ a hundred ×, we get 50 which is a very easy answer.
00:36:05.100 --> 00:36:12.500
It is not surprising that if you flip a coin 100 ×, on average, you expect to see 50 heads.
00:36:12.500 --> 00:36:17.200
It does not mean that it is very likely that you will see exactly 50 heads.
00:36:17.200 --> 00:36:28.100
It means that in the long run, if you do this experiment many times, you should see an average of 50 heads per experiment.
00:36:28.100 --> 00:36:34.800
This one was all about the power of linearity of expectation and indicator variables.
00:36:34.800 --> 00:36:42.000
That is the point that I was trying to drive home with this example.
00:36:42.000 --> 00:36:48.600
In example 4, we are going to calculate your average grade in your probability class.
00:36:48.600 --> 00:36:54.900
In your class, you are going to take 2 midterm exams and they are 25% each of your semester grade.
00:36:54.900 --> 00:37:00.500
The final exam counts for 30%, that is a little bigger there and the homework counts for 20%.
00:37:00.500 --> 00:37:02.700
That is where your grades is based on.
00:37:02.700 --> 00:37:13.100
What your scores are 60 and 80 on each of the midterms, you score an 80 on the final, and then you score 100 on the homework.
00:37:13.100 --> 00:37:15.600
The question is, what is your semester average?
00:37:15.600 --> 00:37:18.900
This might not seem like an expected value problem.
00:37:18.900 --> 00:37:25.000
Remember, another word for unexpected value is mean and mean really does mean average.
00:37:25.000 --> 00:37:30.700
I will show you how this breaks down exactly into an expected value problem.
00:37:30.700 --> 00:37:37.400
The μ, here I’m going to use the Greek letter μ for expected value.
00:37:37.400 --> 00:37:40.800
Let me remind you what the formula is for expected value.
00:37:40.800 --> 00:37:52.500
It is the sum over all possible values in the variable of the probability of each value × that value.
00:37:52.500 --> 00:37:56.500
Let us think about all the possible scores you can get.
00:37:56.500 --> 00:38:06.900
You scored 60 on 1 midterm, you scored 80 on something else, a couple of things, and you scored 100 on something.
00:38:06.900 --> 00:38:11.600
Those are the possible Y values that we can see and we want to figure out how much weighting,
00:38:11.600 --> 00:38:15.900
how much probability is attached to each one of those Y values.
00:38:15.900 --> 00:38:19.300
Let us figure out the probability of each one of those Y values.
00:38:19.300 --> 00:38:26.000
Think of that as the weight on each of those Y values.
00:38:26.000 --> 00:38:32.100
We are going to find the probability for each one of those or weight of each of those.
00:38:32.100 --> 00:38:34.500
How much weight did you score 60 on?
00:38:34.500 --> 00:38:38.400
60 was on the first midterm, that was 25%.
00:38:38.400 --> 00:38:45.100
I will put a 25/100 here, 25% there.
00:38:45.100 --> 00:38:46.500
Where did you score 80 on?
00:38:46.500 --> 00:38:53.000
You scored 80 on the midterm and then 80 on the final, that is 80.
00:38:53.000 --> 00:39:05.800
The second midterm was 25/100 + the final is 30/100.
00:39:05.800 --> 00:39:19.100
That is how much of weighting you scored on and 100 on the homework which was 20%, so 20/100.
00:39:19.100 --> 00:39:23.400
You scored 100% on that part of the class.
00:39:23.400 --> 00:39:31.700
I’m really using the formula for expected value to calculate your mean for the class or your average for the class.
00:39:31.700 --> 00:39:36.000
This is a fairly easy thing to simplify here.
00:39:36.000 --> 00:39:41.400
In fact, I did not bother to write down the intermediate steps.
00:39:41.400 --> 00:39:45.000
I’m just going to calculate this all together.
00:39:45.000 --> 00:40:00.700
If you calculate this all together, it turns out to simplify down to exactly 79.
00:40:00.700 --> 00:40:07.700
That is your mean for the class, that is your average for the semester.
00:40:07.700 --> 00:40:18.100
If you have a particular grading scale, you would se that to determine your grade for the semester.
00:40:18.100 --> 00:40:26.900
Let me show you how what seem like a problem of calculating your semester average in class turned out to be an expected value problem.
00:40:26.900 --> 00:40:28.000
We are calculating your μ.
00:40:28.000 --> 00:40:33.400
Remember, μ is always the same as E of Y, it means mean or expected value.
00:40:33.400 --> 00:40:35.200
Those are the same concept.
00:40:35.200 --> 00:40:42.400
The way you calculate it is you look at all the possible things you could have scored and then you multiply each one by,
00:40:42.400 --> 00:40:48.500
we said the probability but it is really the weight attached to each one of those items.
00:40:48.500 --> 00:40:53.900
When I have looked at all the scores, I saw 60, 80, and 100.
00:40:53.900 --> 00:41:00.600
I put a weighting on each one, 25% for the 60, 20% for the 100, and the 80 was a little complicated
00:41:00.600 --> 00:41:03.300
because there were 2 different items that gave me an 80.
00:41:03.300 --> 00:41:11.600
I had to put a weighting, sort of an extra weighting 25 out of 100 for the second midterm
00:41:11.600 --> 00:41:15.000
and then 30 out of 100 for the final exam.
00:41:15.000 --> 00:41:22.800
When I added all those things together and I simplify the arithmetic, simplify it down to exactly 79,
00:41:22.800 --> 00:41:30.900
that is your semester average in your probability class.
00:41:30.900 --> 00:41:38.600
In example 5 here, we are going to roll one dice and let Y be the number showing on the dice.
00:41:38.600 --> 00:41:43.500
We are going to calculate E not of Y but E of Y².
00:41:43.500 --> 00:41:51.800
This is another test of finding the expected value of a function of a random variable.
00:41:51.800 --> 00:41:54.000
Let me remind you of the formula for that.
00:41:54.000 --> 00:41:58.300
The expected value of the function of a random variable,
00:41:58.300 --> 00:42:04.400
you calculate it quite similarly to expected value for the random variable itself.
00:42:04.400 --> 00:42:09.300
It is P of Y, the variable itself, you just have a Y here.
00:42:09.300 --> 00:42:13.800
Since, there is a function of the random variable, you run it through G of Y.
00:42:13.800 --> 00:42:23.500
In this case, our function is exactly Y² and we are going to add up all the possible values
00:42:23.500 --> 00:42:32.900
that could be showing in the probability of each one × Y² for each one.
00:42:32.900 --> 00:42:37.200
If we are just finding the mean or the expected value of the variable itself,
00:42:37.200 --> 00:42:43.100
that would just be a Y but now it is Y² because of what the problem is asking us.
00:42:43.100 --> 00:42:46.700
Let us go ahead and think about all the possible values you can have.
00:42:46.700 --> 00:42:53.900
The possible values when you roll a dice are 1, 2, 3, 4, 5, and 6.
00:42:53.900 --> 00:42:57.700
If we want each one through the function that means we square each one.
00:42:57.700 --> 00:43:01.100
Let me go ahead and square each one here.
00:43:01.100 --> 00:43:03.600
Let me put a probability on each one.
00:43:03.600 --> 00:43:24.900
1/6 × 1² + 1/6 × 2² + 1/6 + 1/6, and I did not give myself enough space here, + 1/6 × 6².
00:43:24.900 --> 00:43:27.900
Of course, it is easier there to factor out the 1/6.
00:43:27.900 --> 00:43:31.200
I will put a 1/6 on the outside here.
00:43:31.200 --> 00:43:42.300
1² is 1 + 2² is 4, 3² is 9, 4² is 16, 5² is 25, and 6² is 36.
00:43:42.300 --> 00:43:54.900
If you add those up, 36 + 25 is 61, 16 is 77, 9 is 86, 4 is 90, 1 is 91.
00:43:54.900 --> 00:44:08.800
I get 91/6 as my expected value of Y² or my μ for Y².
00:44:08.800 --> 00:44:12.400
That is the end of that problem but let me recap the steps here.
00:44:12.400 --> 00:44:17.200
We are using the formula for the expected value of a function of a random variable.
00:44:17.200 --> 00:44:22.300
I gave you that formula back on one of the early slides in this lecture.
00:44:22.300 --> 00:44:24.100
You can go back and check that out.
00:44:24.100 --> 00:44:28.400
The difference between calculating the expected value of a function and
00:44:28.400 --> 00:44:37.400
the expected value of the original random variable means instead of Y here, you just change it to G of Y.
00:44:37.400 --> 00:44:44.600
You are no longer talking about Y, you are talking about G of Y which means that you are adding up the probabilities ×,
00:44:44.600 --> 00:44:47.000
in this case we have our function is Y².
00:44:47.000 --> 00:44:51.900
That is the most common function we are going to be looking at.
00:44:51.900 --> 00:44:55.300
In this case, we have Y² here.
00:44:55.300 --> 00:44:59.700
We take all of our values and we square each one, 1², 2², 3².
00:44:59.700 --> 00:45:04.200
These are all the values you can get by rolling one dice, 5², 6².
00:45:04.200 --> 00:45:09.000
The probability of each one of those is 1/6, we will multiply by 1/6.
00:45:09.000 --> 00:45:10.900
Now, we just simplify the arithmetic.
00:45:10.900 --> 00:45:16.100
Square all those numbers, multiply it by 1/6, and we get 91/6.
00:45:16.100 --> 00:45:21.300
This is a kind of an early preview of something we are going to be doing in the next lecture.
00:45:21.300 --> 00:45:25.100
We are going to be looking at variance and standard deviation.
00:45:25.100 --> 00:45:33.000
In order to calculate that, it is going to be very useful to calculate the expected value of Y² for our random variable.
00:45:33.000 --> 00:45:38.600
That is why I'm giving you several examples this time of calculating the expected value of Y²
00:45:38.600 --> 00:45:43.600
because we are going to be using that very often in the next lecture.
00:45:43.600 --> 00:45:48.500
I hope this made sense to you, if it did not, you might want to work it through a couple more times,
00:45:48.500 --> 00:45:52.800
before you go on to the next lecture and learn about variance and standard deviation
00:45:52.800 --> 00:45:59.300
because you really want to understand how to find the expected value of Y² first.
00:45:59.300 --> 00:46:04.700
That is the last example for this lecture on expected values and means.
00:46:04.700 --> 00:46:07.800
Of course, expected values and means are the same thing.
00:46:07.800 --> 00:46:11.800
You are all watching the probability lectures here on www.educator.com.
00:46:11.800 --> 00:46:14.000
My name is Will Murray, thanks for watching, bye.