st101 » week-4 »

18.  Binomial Distribution

These are draft notes extracted from subtitles. Feel free to improve them. Contributions are most welcome. Thank you!
Please check the wiki guide for some tips on wiki editing.


01 Binomial

So we talked about coin flips, and we flipped some coins.Now, I want to flip many coins including this 2-dollar coin whose country of origin I just don't remember.Perhaps you can post on the forum where this 2-dollar coin might be from.So let's ask an easy quiz. Suppose we do 2 coin flips.I would like to know how many outcomes of these 2 coin flips are there and which number of heads equals the number of tails which in this example means you would have head exactly once and tails exactly once.Give me that number.


02 Binomial Solution

And the answer is 2. If you look at the truth table—head-head, head-tail, tail-head, and tail-tail—these are the four possible outcomes.Those two outcomes over here yield an equal number of heads and tails.

03 Heads Tails

Let's now go to 4 coins and ask the same question.

unnamed (1).jpg

04 Heads Tails Solution

In going through the truth table, there's a bit more info. So let's find the one where the number of heads and tails are the same.Those three on the left side and those three on the right side for a total of 6.

05 Heads Tails 2

Now. Let's go to 5 coin flips.How many outcomes have the same number of heads and tails? This is a trick question.

unnamed (2).jpg

06 Heads Tails 2 Solution

And the answer is 0. With an odd number of coin flips, one has to be more than the other.There's no other way. Okay. I tricked you a little bit.

07 5 Flips 1 Head

With 5 coin flips, how many outcomes will have exactly 1 heads, hence 4 tails.

unnamed (3).jpg

08 5 Flips 1 Head Solution

The answer is 5. There's 5 different ways in these 5 outcomes. To place heads--could be first, second, third, fourth or fifth. So these are 5 different ways.

09 5 Flips 2 Heads

Let's now make you think really hard. In 5 coin flips, how many outcomes will you have 2 heads.This is a serious and non-trivial question.

unnamed (4).jpg

10 5 Flips 2 Heads Solution

And the answer is 10 and this is a non-trivial answer.So you could go and place the first heads anywhere in these five elements--say here--and there's five different ways to place heads.You can now place the second heads among the remaining four--for example, you could place it over here and it gives you a factor of four different ways of placing the second heads.But again you do this, you over count--you over count exactly by a factor of 2 in the business.You place the first heads over here, the second over here, but if it was chosen to place the first head on the right side and the second head over here on the left side,and the outcome would've been exactly the same, so you counted the one twice which means we have to divide it by 2--5 times 4/2 is 10

11 5 Flips 3 Heads

Let's now go to 3 heads if you think the result is no.

unnamed (5).jpg

12 5 Flips 3 Heads Solution

And the log is 10 again. There's two proofs.One is I can just flip heads into heads.  So three heads means two tails.I can give the exact same game as before where I placed tails as opposed to heads and it gives me the same equation as before, but let's do it the new way, three heads.I can place 543--the first heads, the second and the third.For the first, I have five positions, for the second--four, and for the third--three are left.This gives me the common networks for those heads, but now I'm over counting.How much am I over counting?Well, suppose I'm committed to put the three heads into the three slots over here and that's not given.And I just wonder in which order I've put them in,so I might put the first one here, the first one here, the first one here.Then for the first one placed in here, there's now three different ways of placing it.For the second one, there's two different ways of placing it.For the third one, it's not deterministic--there's just one slot left.So I over count this by a factor of 6--there are 6 different ways of placing these three heads into these three slots, so the result is 543/321 producing the 52=10.And that is insightful.

13 10 Flips 5 Heads

Let's say I have 10 coins. You just get 10 of these shiny silver coins here. So we got 10 coins.And I got about 4 heads in these 10 coins, and just apply the same logic to find an answer.The first time I'll do it for you.I can place those heads in 10987 different slots if they were counted.Now that I'm committed to having chosen these slots, the implementations of those are 4321.That gives me 5,040/24, also known as 210, so that's 210 outcomes out of 2 to 10th outcomes which is 1024 in which exactly 4 heads are observed and 5 tails.Now it's your turn. 5 heads out of 10 coins. One of them coming up to heads.

unnamed (6).jpg

14 10 Flips 5 Heads Solution

I was given 109876 which is 30,240 whereas in picking those five headsand we're over counting by 54321 which is 120 and this gives us as a quotient 252.

15 Formula

So let me give you the mathematical formula that you might be familiar with.n! for any number n is the same as n(n-1)(n-2) all the way to times 1.Let's call it factorial. So 10 factorial for example will be 109876 and so on.If you look at this equation over here, I'll give you a couple of choices how to write it.It could be n!; it could be n!/k! where this over here is k which is 5and this over here is n.It could be n!/k!k! or it could be n!/k!(n-k)!These are four choices. One of this is actually correct for the formula that we've computed before.Pick the correct one.

unnamed (7).jpg

16 Formula Solution

And this one is the correct one and I have to admit I must like you a little bit by taking a symmetric example where k is exactly half of n.

17 Arrangements

The key observation is that this thing over here is n!/(n-k)!and to see this let's go back to the case where we had 4 heads.In the 4 heads case, we multiplied all the way to times 5 over here.We only multiplied all the way to 7. These are the 4 heads that we placed.So n! goes from 10 all the way to 1. (n-k)! goes from 10-4 and that's 6 all the way to 1.So this blue expression over here will go from 10 x 9 x 8 and so on all the way to 1 over now n-k, 10-4 is 6. 654 and so on.When you look at this, the 654 occurs on top as well.So we can cut those out and what remains is 10987. This one over here.Now once we place these 4 heads, we have to divide by a 4 factorial which is different ways of placing those 4 points into the predefined bins.So put differently, this is k! so if we put all this together you get n!/(n-k)!k!This is the expression over here. Let's practice this one last time.Say you have 125 coins and you ask how many ways exists in which 3 coins come up heads.What is the resulting outcome? Be careful when you use your calculator.It might result in an overflow, but the answer is easy to compute.

unnamed (8).jpg

18 Arrangements Solution

So, I get 317,750, and the logic is I just plug in these numbers, 125!/122! 3!. When I evaluate this, I find that these guys can be easily reduced to 125124123.From 122 on, these factors exactly cancel. 3 expands to 321 also known as 6.When you divide these two things, you get 317,750.

19 Binomial 1

And let's really ask about probabilities.Let's say for now, we have a fair coin with a probability of heads is 0.5.If I flip a coin five times, what's the probability the number of heads is exactly 1.You should be able to compute this.

unnamed (9).jpg

20 Binomial 1 Solution

Now, we know from our previous consideration that there are five ways in which the number of heads could be one. 5!/4! 1! happens to be 5.We also know that there are 32 possible outcomes. It is 2⁵=32 outcomes.This is the size of a truth table. So, 5 out of 32 outcomes has exactly 1 head.So, I would suggest that the answer is 5/32, and my calculator tells me this is 0.15625.So, that is actually interesting.If you flip a coin five times, there's a chance that it only comes at head exactly once and that is the probability 0.15625.

21 Binomial 2

Let's now modify it and ask, what are the chances it becomes a head three times? What's the probability for that to happen?

unnamed (10).jpg

22 Binomial 2 Solution

And the answer is 5!/5-3 is 2!/3! and that gives us 10. 10/32 gives us the probability of 0.3125.

23 Binomial 3

Now, I'm going to make it really difficult.  I'm going to give you a coin--let's call it loaded.So, the probability for heads will now be 0.8 and therefore the probability for tails is 0.2.To make it easier, assume only a 3 coin flips and ask the probability of heads coming up exactly once.What is that probability for the loaded coin without giving you a head.I recommend answering it using a truth table.

unnamed (11).jpg

24 Binomial 3 Solution

So here is my truth table of these eight different outcomes.The ones that has head exactly once are this one, this one, and this one,but they're not all equally likely.Heads, heads, heads is much more likely than say tails, tails, tails because heads has a probability of 0.8.This one here has an outcome probability of 0.8³ while this one has an outcome probability of 0.2³.All of the green once have the same outcome probability.They all have exactly one head 0.8 and two tails.So as before, we took the probability to be one of these has the truth table.This time each of those has a probability of 0.032. That's each amount of the three.Now, we have to consider all of these three outcomes, which means you're going to add 0.032 for each one of those three guys over here and this gives me as an answer 0.096.That's a nontrivial question.

25 Binomial 4

Let's now say for the same loaded coin, we flip that coin five times with that same load of probability over here and the key about the out of five times heads comes exactly four times.Now, I want you to compute this probability over here, It's a completely nontrivial question.If it's too hard, hit the next button.

unnamed (12).jpg

26 Binomial 4 Solution

So interestingly enough, we can do the trick as before 5!/4!1!,which is the number of outcomes at exactly 4 heads and we know that's 5.Four heads means one tails. There's five ways took place and one tails and this one over here.The question now what's the probability of those?Well, they have heads four times, (0.8)⁴ and tail once to (0.2)¹.So we do is we multiply the total number of outcomes that have this property with each of probability, which happens to be the same because we get exactly four times heads and 1 times tail and multiplying these things together gives us 0.4096.This over here is indeed 0.4096 and the 50.2 cancels the others out,so that's the result in this specific case.The cancellation doesn't always happen. It's a rare circumstance.

27 Binomial 5

So, this does not go and get the same for 3 heads. I leave this here, but obviously, the numbers aren't correct anymore.

unnamed (13).jpg

28 Binomial 5 Solution

And here is my answer 5!/3!2! is 10, and we have 3 heads, so we put 3 in here and 2 tails, so we put 2 in here.Putting these all together gives us 0.2048, which is half the probability of the previous question.

29 Binomial 6

Now, you're ready for the real challenge.You flip the coin 12 times in the care about how likely it is to get heads 9 times out of the 12.This is not a trivia question, but you should be able to get it right.

unnamed (14).jpg

30 Binomial 6 Solution

And the approximate answer is 0.236.That's the probability of exactly 9 heads out of 12 coin flips for this heavily loaded coin that mostly gives you heads.And again, the answer is 12!/12-9. This is 3! 9!.Then we have to compute the probabilities being (0.8)⁹and 1-0.8 is 0.2³ and that is the number over here.

31 Conclusion

What have you learned? Well, to flip a coin n times one for k small or equal to n.We ask the probability--what are the chance it comes up heads k times.For any coin, with the probability of heads equals to all caps P,.we now get the following formula: n!/(n-k)!k!.These are the total number of outcomes that have this property.And then this one has the following probability:P to the k, this was the (0.8)⁹ before times (1-p) to the n-k,which is the remaining 3 over here in this example.So, this formula is the probability of what's call the binomial distribution and really was this is the accumulated outcome of many identical coin flips,and it leads us beautifully to our next lesson when we talk about very large experiments and the normal distribution.What you should have learned and understand now is you can take very large experiments with large numbers of coin flips and compute the probability that heads comes a certain number of times using the formula that you should now fully and wholly understand.