Main content

## Binomial random variables

Current time:0:00Total duration:9:27

# Visualizing a binomial distribution

## Video transcript

- [Voiceover] In the last video, we set up a random variable x, which was defined as the number of heads from flipping a fair coin five times, and then we figured out the probability that our random variable
could take on the value zero, one, two, three, four, or five, and just to visualize that, in this video, we will actually plot these, and we'll get a sense of this random variable's
probability distribution. So let's do that. Actually, maybe I'll do it like this, so that we can see the probabilities. Actually, let me erase this
business right over here. Whoops, that's not working. Here, that might work. Let me erase this real fast, these little scribbles
that I had off-screen, and then we can actually
plot the distribution. Alright, so at one axis, I'm gonna put all of
the different outcomes. So let me... That looks like a pretty straight line, and then at this axis, I'm
going to plot the probabilities. And that looks like a
pretty straight line, and let's see what the probabilities are. We have, let's see, it's all gonna be in terms of 32nds, and we get as high as 10/32, so let's say this right over here is 10/32, half-way up there, we have two 5/32, so let's see, that looks like about half, that right over there is 5/32, and then 1/32 would be about this, that's one, two, let's see... If I were to split it
up, one, two, three... Actually let me do it a little bit... One, two, three, four, five. Alright, so let's say this
is 1/32 right over here, and our probabilities,
so this right over here, probability, so this is the values that the random variable could take on, so I'll just make a little histogram here, so x equals zero, and the probability there, and actually since I
want to do a histogram, it will look like this, so let me do it a little bit different. So, put it right here, so x is equal to zero. Right there, the probability is 1/32, and I can shade that in. Now, over the probability
that x equals one, x equals one is 5/32, so let me draw that, so 5/32, so, put the bar there, so let me shade that in, so this right over here is the probability that x is equal to one, that we get one, that one, exactly one, out of the five flips result in heads. Now we have the probability x equals two. x equals two is 10/32, so that's going to look like this. Alright, my best attempt
at hand-drawing it. Somehow I like the aesthetics
of hand-drawn things more. Sometimes if you just get
a computer to graph it, I don't know, sometimes, it loses a little bit of its personality. Alright, so that right over
there is the probability that our random variable
x is equal to two. Then we have the probability
that x equals three, which is also 10/32. So that is also 10/32, so let me draw that. So this is also 10/32, shade this in. Dum-de-dum-de-dum, alright. I find this strangely
therapeutic. (chuckling) Alright, so this is the probability that x is equal to three. Now x equals four, that's 5/32. So we go back right over here, and that's 5/32. So, shade that one in. So this right over here
is x is equal to four, and then finally, the probability that x equals five is 1/32 again. Same level as this right over here, shade it in, so this right over here is, our random variable x equaling five. And so, when you visually show this probability distribution,
it's important to realize, this is a discrete
probability distribution. This is a discrete random variable. It can only take on a finite number of values. Actually, I should say it's a finite discrete random variable. You could have something that
takes on discrete values, but in theory, it could take on an infinite number of discrete values. You could just keep counting
higher and higher and higher. But this is discrete, in that it's these whole, these particular values. It can't take on any value in between, and it's also finite. It can only take on x
equals zero, x equals one, x equals two, x equals
three, x equals four, or x equals five, and you see when you plot
its probability distribution, this discrete probability distribution, it starts at 1/32, it goes up,
and then it comes back down, and it has this symmetry, and a distribution like
this, this right over here, a discrete distribution like this, we call this a binomial distribution, and we'll talk in the future about why it's called a
binomial distribution, but a big clue... Actually, I'll tell you why it's called a binomial distribution, is that these probabilities, you can get them using
binomial coefficients, using combinatorics. In another video, we'll talk about, especially when we talk
about the binomial theorem, why we even call those
things binomial coefficients. It's really based on taking
powers of binomials in algebra, but this is a very, very, very,
very important distribution. It's very important in statistics, because for a lot of discrete processes, one might assume that the
underlying distribution is a binomial distribution,
and when we get further into statistics, we'll talk why people do that. Now, if you were to have much more than five cases here, if, instead of saying
that the number of heads from flipping a coin five times, you said, x is equal to the number of heads of flipping a coin five million times, then, you can imagine,
you'd have much, much... The bars would get narrower and narrower relative to the whole hump,
and what it would start to do, it would start to approach
something that looks really, something that looks
really like a bell curve. I think I'm gonna do that in a color that you can see better,
that I haven't used yet. So, it would start to look... So if you had more and more of these, if you had more and more
of these possibilities, it's going to start approaching what looks like a bell curve, and you've probably heard
the notion of a bell curve, and the bell curve is
a normal distribution. So one way to think about it,
is the normal distribution is a probability density function. It's a continuous case. So, the yellow one, that we're approaching
a normal distribution, and a normal distribution, in
kind of the classical sense, is going to keep going on and on, normal distribution, and
it's related to the binomial. You know, a lot of times in statistics, people will assume a normal distribution, because you can say, okay,
it's the product of kind of an almost an infinite number
of random processes happening. Here, we're taking a coin, and
we're flipping it five times, but if you imagine molecules interacting, or humans interacting, you're saying, oh, there's almost an infinite
number of interactions, and then that's going to result
in a normal distribution, which is very, very important
in science and statistics. Binomial distribution is the
discrete version of that, and one little point of notion, these are where the distributions are, this is where they come from, this is how they're related. If you kind of think about as
you get more and more trials, the binomial distribution
is going to really approach the normal distribution, but it's really important to think about where these things come from, and we'll talk about it
much more in a statistics, because it is reasonable to assume an underlying binomial distribution, or normal distribution, for a lot of different types of processes, but sometimes it's not, and
even in things like economics, sometimes people assume
a normal distribution when it's actually much more likely that the things on the
ends are going to happen, which might lead to things
like economic crises, or whatever else. But anyway, I don't want to get off-topic. The whole point here
is just to appreciate, hey, we started with this random variable, the number of heads from
flipping a coin five times, and we plotted it, and
we were able to see, we were able to visualize
this binomial distribution, and I'm kind of telling you, I haven't really shown you, that if you were to have
many, many more flips, and you defined the random
variable in a similar way, then this histogram, this bar chart, is gonna look a lot
more like a bell curve, and if you had essentially
an infinite number of them, you would start having a continuous probability distribution, or, I should say,
probability density function, and that would get us closer
to a normal distribution.