Current time:0:00Total duration:16:55

0 energy points

# Expected value of binomial distribution

Video transcript

In the last video we learned a
little bit about what the expected value of random
variable is, and we saw that it was really just the population
mean-- the same thing. But with a random variable,
since the population is infinite, you can't take
up all of the terms and then average them out. What you have to do is say OK,
each of these terms occur with some frequency or with some
probability, and you kind of just take a probability
weighted sum. Which we saw in the last video
was the exact same thing as adding everything together and
dividing by the number of numbers, except that that
method worked with an infinite number of an infinite
population what the random variable is. Because you can just keep on
performing the experiment that generates the random variable. And then, we actually
calculated the expected value for the particular binomial
distributions that we studied, especially the one with the
flipping of the coin. In this video we'll find a
general formula for the mean, or actually, for the expected
value of a binomial distribution. So if we say that the random
variable, x, is equal to the number of-- we could
call it successes. The number of successes with
probability p after n trials. So I'm being a little
bit generally here. I mean I could have said the
number of successful heads, which have a probability
of 0.5 after 10 flips. That's the same thing is this,
I'm just being a little bit more general here. And now, we'll actually
figure out what the expected value of this is. And we saw if you actually
figured out the probability distribution for this random
variable you get that nice binomial distribution that
looks a little bit like a bell curve. And we'll study more
about bell curves later. And before I actually
show it to you I'll give you the answer. Because the answer, to
some degree, is actually pretty intuitive. The expected value of this
random variable is n times p, or sometimes people
will write p times n. Let me make that a little
bit more tangible for you. So if I said that x is-- let me
do it in a different color. Let's see, x is equal to the
number of baskets I make. Where I'm talking about
basketball, not basket weaving. Number of baskets I make after
10 shots where I have the probability of me making any 1
shot is-- I don't know-- 40%. We know that the expected
number of baskets I make after 10 shots. So we know that the expected
number of baskets I make after 10 shots, where each of my
shots is 40%-- all I have to do is multiply the probability
times the number of baskets I'm taking. So I multiply probability times
the number of baskets or the number of shots I'm taking,
which should be equal to 4. So I know I said-- and you
really shouldn't necessarily strictly view expected value as
the number of shots you should expect to make because
sometimes probability distributions can
be kind of weird. But in the binomial
distribution you can kind of view it that way. That this is the number of
shots you would expect to make. Or you can kind of view it
as the most likely outcome. That if you have a 40% shot
percentage, and you takes 10 shots, the most likely outcome
is that you'll make 4 shots. You still might make 6 shots or
3 shots, but this is going to be the most likely outcome. and in my head, the way I think
about, the way it makes intuitive sense is that every
time you shoot you have a 40% chance of making the shot. So you could say that you
always make 40% of a shot. And if you take 10 shots you're
going to make 4 whole shots. So that's one way to think
about it and why this might make a little intuitive sense. But now, let's prove it to
ourselves that this is really true for any a random variable
that's described by a binomial distribution. So in a binomial distribution
what is the probability-- so if I say, what is the probability
that X is equal to k? And I know it just gets a
little complicated sometimes. But I'm just saying, what's
the probability say in this basketball analogy. Would be you know, what's the
probability that I make-- k could be 3 shots or
something like that. So that's what we're
talking about. And that we learned was, if
we're taking n shots we're going to choose k of them. And we did that several times
in the last couple of videos. And then we multiply that times
the probability of any one of those particular occurrences. So if I'm making k shots, it'll
be the probability of me making any one shot, Which is
p to the kth power. p times itself k times. That's the probability
of me making k shots. And then the rest of the
shots I have to miss. So the probability of
a miss is 1 minus p. And then how many shots? If I've made k shots, the rest
of the shots I have to miss. So I'm going to miss
n minus k shots. So in any binomial distribution
this is a probability that you get k successes. Now we know that the expected
value, the way you calculate an expected value of a random
variable is you just take the probability weighted sum. I don't want to confuse you
too much and if you main take away from this video is just
this, that's good enough. You should feel good. Now it'll get a little
technical, but it'll hopefully make you a little bit more
comfortable with sigma and sum notation as well. It'll make you a little
bit more comfortable with binomial coefficients
and things like that. But just going back, the
expected value is a a probability weighted
sum of each of these. So what you want to do is you
want to take the probability that X is equal to k, times
k, and then add that up for each of the possible k's. So how would I write that? So the expected value of X, the
expected value of our random variable that's being described
as binomial distribution-- it's equal to the sum. And we're going to sum all of
the values that k can take on. So k can start at 0-- in the
basketball version, I make no shots-- all the way to n,
which means I make n shots. And for each of them you want
to multiply k, so the outcome, so I made k shots, times the
probability that I make k shots. Well, what was the probability
that I make k shots? That was this right here. So it'd be k times n choose
k times p to the k times 1 minus p to the n minus k. And now we're just going
to do some algebra, some sigma algebra I guess
you could call it. So the first simplification
we can make is we're summing from k equals 0 to n. So the first term here is going
to have a k equals 0 here. This is going to be 0
in the first term. So this first term is 0, then
this whole thing is going to be 0, and the k equals 0 term
won't contribute to the sum because this whole
thing will be 0. Let me that write because I
think it's-- so this sum could be written as 0 times n choose
0 times p to the 0 times 1 minus p to the n minus 0. Plus 1 times n choose 1 times
p to the 1 times 1 minus p to the n minus 1. And then you keep adding,
all the way until you get to k is equal to n. So it'd be n times n choose
n times p to the n, times 1 minus p, n minus n. This is just another way of
writing this sum up here. And what I just said is the
first term, which is this term, is going to be equal to 0
because k is equal to 0. 0 times any thing is 0. So we can ignore that term and
we can rewrite this sum as essentially this
sum right here. And so if we were to do that
we're essentially just rewrite this thing up here. So the expected value
of our random variable is equal to the sum. And we don't have to go
from k equal 0, we could start at k equal 1 now. From k equals 1 to n of the
same thing. k times n choose k times p to the k, times
1 minus p, n minus k. Let's see what we
can do from here. All we did so far is we got rid
of that first term because that's kind of the trick we'll
use to simplify this eventually to the result that
we want to have. So let's write out the binomial
coefficient and see if we can do something there. Oh, look at this. My iPod wants to sync. Let me get rid of that. All right, so then,
where was I? OK, so then this is equal to--
I'm just going to write out the binomial coefficient. k equals 1 to n. k times-- this right here is
n factorial over k factorial over n minus k factorial. Times p to the k times 1
minus p to the n minus k. And here we can make a little
bit of a simplification because what's k
divided by k factorial? Maybe I could rewrite it a
different way. k factorial is k times k minus 1 times k minus
2, and so forth, all the way until you get to 1. This is k factorial. So k factorial could be written
as k times k minus 1 factorial. It's k times, and then the
number 1 smaller then k times all the numbers below it. So let me rewrite. So this could be rewritten as
k times k minus 1 factorial. And the whole reason why I
did that is so I can cancel this k out with that k. So if I cancel that out I
think this warrants rewriting the whole thing again. So now, I guess you could argue
simplified it to, it equals the sum from k is equal to 1 to n
of n factorial over k minus 1 factorial. Times n minus k factorial times
p to the k times 1 minus p to the n minus k. And let's do another
simplification. Now, what I want to do and
we kind of know where we're heading, right? This should simplify
to n times p. So let's see if we can factor
out an n times p and then let's see if we can turn everything
else into a 1, and then we would be done. So we could rewrite n factorial
using the same trick up here. n factorial can be rewritten as
n times n minus 1 factorial by the same logic. And then p to they k could
be rewritten as p times p to the k minus 1. And then we can factor out this
n and this p and we'll get it's equal to np times the sum from
k is equal to 1 to n of-- let's see. We factored that n and p out. n minus 1 factorial over k
minus one factorial times n minus k factorial. Times p to the k minus 1. That's not in the denominator. This is just a regular-- times
1 minus p to the n minus k. And we're close. Remember, we want the result
that the expected value of our variable, and that's what
we were doing before. That this should
be equal to this. So we'll be done if we can
just show that this whole thing here equals 1. And to do that I'll make a
simplifying substitution. Let me make the substitution--
I don't know-- let's say that a is equal to k minus 1. And that b is equal
to n minus 1. And then what would
n minus k equal to? Let's see. If a is equal to k minus 1
then a plus 1 is equal to k. And then here, b plus 1 is
equal to n, so then n minus k would be equal to this,
a plus 1 minus this. Minus b minus 1, these
would cancel out. Which would equal a minus b. And let's see if we
can simplify this. So this whole sum will then
turn into np times the sum from-- OK, when k is equal to
1, that's the same thing-- when k is equal to 1,
what is a equal to? a is equal to 0. From a equal to 0 to-- now
when k is equal to n, what will a be equal to? If this is equal to n,
if k is n, then a is equal to n minus 1. So we have a equal to a
to a equals n minus 1. But n minus 1 is the
same thing as b. So we could rewrite
the sum there. That's always a
little confusing. You might want to pause and
think about that a little bit. But I realize I'm already
over time, so I'll just keep moving forward. And then we had b is
equal to n minus 1. So that'll be b factorial
over k minus 1 , we made the definition that
that's equal to a. So that's a factorial. And then over here, n
minus k should be a-- oh, you know what? I reversed this. n minus
ok should be b minus a. n minus k-- right. n is b plus 1, so it's b
plus 1 minus a plus 1. Minus a, minus 1. So the 1's cancel out
and you get b minus a. So the n minus k will become
b minus a factorial. And then p to the k minus 1--
k minus 1 is p to the a. And then times 1 minus
p to the n minus k. We already showed that
n minus k is the same things as b minus a. And then here, and we're
pretty much done now-- this right here, what is this? This is the probability
of-- well, let me rewrite it a simpler way. This is equal to np times the
sum from a is equal to 0 to b. What is this? This is b choose a. I have b things and I want to
choose a things from them, how many different ways can I--
times p to the a times 1 minus p to the b minus a. What is this thing here? This is you're taking every
term of the binomial distribution. So you're saying, what
is the probability when a is equal to 0? This is the probability for
each of the a's, right? And you're summing up over all
of the a's you can achieve. So if I were to draw a quick
dirty distribution like this, if a is equal to 0 you have
a certain probability. Then a certain probability for
a equals 1. and then another probability, and
it goes higher. Then it's like a bell curve,
something like that. This term right here
is each of these. Each of these boxes you
could say represents one of these terms. When a equals 0 it's this term. When a equals 1 it's this term. When a equals 2 it's this
term, all the way to b terms. But we're summing them
up, so we're summing all of the probabilities. We're summing over all
of the values that our random variable can take. So if we solved all the
probabilities that a random variable can take, or we're
summing over all of the values, this is going to sum up to 1. This is like saying that this
is the probability of heads plus the probability of tails. Or you could say in the
flipping of a coin analogy, this is the probability that I
have one heads plus the probability I have 2 heads,
plus the probability I have 3 heads, plus the probability I
have 4 heads, all the way to the probability I have b heads. So it's pretty much every
circumstance that can occur. So this is the sum over
the entire probability distribution, and so that
is going to be equal to 1. And so, we're left with
the expected value of our random variable, X, is
equal to n times p. Where n is the number of trials
and p is the probability of success on each trial. And this is true only for
binomial distributions. It isn't true for any
random variable, X. Only true for random variable,
X, whose probability distribution is the
binomial distribution. Anyway, I'm all out of time. I'll see you in the next video.