Main content

## Statistics and probability

### Course: Statistics and probability > Unit 8

Lesson 4: Combinatorics and probability- Probability using combinations
- Probability & combinations (2 of 2)
- Example: Different ways to pick officers
- Example: Combinatorics and probability
- Getting exactly two heads (combinatorics)
- Exactly three heads in five flips
- Generalizing with binomial coefficients (bit advanced)
- Example: Lottery probability
- Probability with permutations and combinations
- Conditional probability and combinations
- Mega millions jackpot probability
- Birthday probability problem

© 2023 Khan AcademyTerms of usePrivacy PolicyCookie Notice

# Probability using combinations

CCSS.Math:

Probability of getting exactly 3 heads in 8 flips of a fair coin. Created by Sal Khan.

## Want to join the conversation?

- Around the 5 minute mark, he starts talking about factorials. What's a factorial?(2 votes)
- I believe a factorial of a number is its product with all positive integers below. For example: 5! = 5 x 4 x 3 x 2 x 1(30 votes)

- why can't I use this method in the last numerical (previous module: "probability & combination (part 2) where we have to calculate the probability of 3 basket in 5 free throws P(3/5) given that free throw % is 80%

total outcome= 2^5=32 (since every throw might be basket or a miss, 2 possibility for every throw).

combination of choosing 3 out of 5= 5!/3!2!= 10

total probability = 10/32=31.25% but the answer is 20.48%....does it have to do something odds of scoring a basket or missing is not equal.(6 votes)- It works only if the probability of missing or hitting would be 0.5 instead of 0.8.

Deciding the probability that something will happen by doing`(number of outcomes where it does happen) / (number of total outcomes)`

only works if all outcomes have an equal probability of happening.

For example, if I have an unfair die that lands half of the time on 6 then the chance of getting 6 is 1/2 and not 1/6 even though there is only 1 out of 6 possible ways where this would happen.(11 votes)

- I am a bit confused here, Why aren't we considering probability of a coin flip (i.e a single event occurring viz 50% or 1/2) while approaching the problem ?

I understand that the probability of getting a heads or tails is same but shouldn't it be considered while performing the calculations !

The solution is directly obtained by putting numbers 8 & 3 where we are not even considering what is heads and what is tails :/ The number 3 can refer to either heads or tails.(10 votes)- I'm pretty sure the "1/2" probability is considered a part of the total outcomes (2^8) which shows that there are only 2 options, and since there are no further calculations, it can be assumed that each option is equally likely. Since the problem is asking for the probability of 3 heads, anyone looking at the problem can consider your answer/work through the context of the question. (However, you are right: the same question asking for the probability of 3/8 tails would also have the same answer.) Hope this helps!(2 votes)

- Is there such thing as a negative factorial, like "-1!" or "-7!"?(3 votes)
- No there aren't. The factorials of negative integers are undefined.

To see why, consider that (n-1)! = n!/n. So 0! = 1!/1 = 1. However (-1)! = 0!/0 = 1/0, and division by zero is undefined. And, since (-1)! is undefined, it follows that factorials of the other negative integers are also undefined.(12 votes)

- Why does he divide all COMBINATIONS of getting 3/8 heads by the total possible PERMUTATIONS? Why doesn't he divide correct permutations by total permutations? (that is, shouldn't he omit the 3! in the denominator at4:44?)(2 votes)
- He doesn't divide by the total number of permutations, he's dividing by the total number of possible outcomes which is 2^8. To find the number of outcomes out of these 2^8 possible outcomes that have exactly 3 heads we need to figure out how many ways we can choose exactly 3 heads in 8 flips. Since one "heads" is exactly the same as another, the ordering of these 3 heads does not matter, hence the number of ways is 8C3.

Let me try and illustrate this through a smaller example, suppose we were dealing with the probability of getting exactly 2 heads in 3 flips. Here the total number of outcomes is 2^3 = 8. Let the flips be numbered 1, 2 and 3. Now if we had to choose 2 flips out of these 3 to have heads, in how many ways could we choose them? Let's call these two flips flipHeadsA and flipHeadsB. We have a total of 3 flips to choose from initially, so for flipHeadsA we have 3 options, and now we have only 2 options left for flipHeadsB. Hence there are 6 permutations for flipHeadsA and flipHeadsB. I'll list them out:

heads A on flip 1, heads B on flip 2

heads A on flip 1, heads B on flip 3

heads A on flip 2, heads B on flip 1

heads A on flip 2, heads B on flip 3

heads A on flip 3, heads B on flip 1

heads A on flip 3, heads B on flip 2

But as you can see, this means we are differentiating between heads A and heads B, which is unnecessary. If heads A was obtained on flip 1 and heads B was obtained on flip 3, this is equivalent to heads B being obtained on flip 1 and heads A being obtained on flip 3 since they are both heads, so we are overcounting if we use permutations. So we divide by the number of ways the heads can be arranged among themselves (2! in this example) to get the actual number of events that will satisfy the condition exactly 2 heads in 3 flips. Hence, the number of ways to get exactly 2 heads in 3 flips is 3C2 and not 3P2.(11 votes)

- If it needs to be exactly 3 heads and not more, don't we need to remove the cases where there may be more than 3 heads in the numerator?(5 votes)
- Yes (you could show that), but in turn, you would also have to remove all of the cases where there may be less than 3 heads in the numerator as well. If you do that, you would get the same answer, but you'd end up doing more work. Sal calculated the EXACT number of heads, and since he didn't include anything else in the numerator, we can consider this as the same as removing all of the unwanted outcomes.

P(3 H) = 0.21

OR

P(3 H) = 1-P(not 3 H) = 1-0.79 = 0.21

Hope this helps! (I know you asked this 8 years ago, but for anyone else who has the same question as you!!)(7 votes)

- I am still struggling to get my head around the intuition on this one; in particular the concept that 3 chosen variables occuring in any order out of 8
**unkown**variables (outcomes of coin flips) is the same concept as 3 chosen variables arising in any order (e.g.: three people sitting together in any order) out of 8**known**variables (e.g.: eight people). Is the unkown nature of the variables irrelevant for the calculation of the combinations? Does this also extend to situations with more unknown variables?

For example if we have a fruit machine with 8 spinning wheels, there are 10 items on each wheel 1 of those 10 is a bell and we say we want to calculate the permutations where there will be 3 of the 8 wheels showing a bell? Would this situation still be 8!/(3!*(8-3)!)?(4 votes)- The coins and the people aren't really that different.

Each coin has two possible outcomes, Heads or Tails, and each person also has two possible outcomes, sitting or standing.

The difference is that for the 8 people we are asked the number of ways that we can choose which 3 are sitting, while for the 8 coins we are asked the probability that 3 are Heads and the others are Tails.

However, since each coin is equally likely to land Heads as to land Tails, then each sequence of 8 coins is also equally likely to occur, and thereby the probability that 3 coins are Heads is equal to the number of sequences that consist of 3 Heads and 5 Tails, divided by the total number of possible sequences.

So, we want to know in how many ways we can choose which 3 coins are Heads, which of course must be the exact same as the number of ways we can choose which 3 people are sitting.

– – –

In the case with the fruit machine, each wheel can be seen as having two possible outcomes, Bell or No Bell.

However, now the two possibilities have different probabilities:

P(Bell) = 1∕10

P(No Bell) = 9∕10

This means that the probability of a certain sequence depends on the number of Bells that are in the sequence.

A sequence containing 3 Bells has the probability

(1∕10)³ ∙ (9∕10)⁵

But now that we have that probability, all we need to do is multiply it by the number of sequences containing 3 Bells, which again is the same as the number of ways we can choose which 3 wheels are Bells = 8!∕(3! ∙ 5!)(4 votes)

- What is the number of outcomes when a coin is tossed and then a die is rolled only in case a head is shown on the coin?(1 vote)
- There number of possible outcomes is six. There's only one way to get heads in a coin flip and six possibilities for the faces of the die.(7 votes)

- Does n C k = n C (n-k) ? (n C k is other way of writting binomial coffiecient)(1 vote)
- Yep, that's correct. Let's take some examples:
`16C3 = 560 = 16C13`

(n = 16, k = 3)`22C14 = 319770 = 22C8`

(n = 22, k = 14)

More academic proof: Let's call`m = n - k`

, therefore`k = n - m`

.`nCk = n! / [k! * (n - k)!]`

nCk = n! / [(n - m)! * m!]

nCk = nCm(7 votes)

- For me it is a little puzzling that the probabilility of getting 2 heads flipping 4 coins IS NOT 50%.(3 votes)
- That is because in this example, it is an
*exact*number of heads, not just a quantity.(1 vote)

## Video transcript

So you might be wondering why I
went off into permutations and combinations in the probability
playlist, and I think you'll learn in this video. So let's say I want to figure
out the probability-- I'm going to flip a coin eight times
and it's a fair coin. And I want to figure out
the probability of getting exactly 3 out of 8 heads. So I say 3/8 heads, but 3 of my
flips are going to be heads and the rest are going to be tails. So how do I think about that? Well, let's go back to one
of the early definitions we used for probability. And that says, the probability
of anything happening is the probability of the number of
equally probable events into which what we're
stating is true. So in which the number of
events-- I guess trials or situations-- in which we
get 3 heads, and exactly 3 heads, we're not saying
greater than 3 heads. So 4 heads won't count and 2
heads won't count, 5 heads won't-- only 3 heads. And then, over the total number
of equally probable trials-- not trials, total number of
equally possible outcomes. I should be using
the word outcomes. So just with the word outcomes
it should be the total number of outcomes in which what
we're saying happens. So we get 3 heads over the
total possible outcomes. So let's do the
bottom part first. What are the total possible
outcomes if I'm flipping a fair coin eight times? Well, the first time I flip
it I either get heads or tails, so I get 2 outcomes. And then when I flip it
again I get 2 more come for the second one. And then, how many
total outcomes? Well, that's 2 times 2 because
I could have got 2 in the first, 2 in the second flip. And then essentially we
would multiply 2 times the number of flips. So that's 5, 6, 7, 8, and
that equals 2 to the eighth. So the number of outcomes is
just going to be 2 to the total number of flips. And hopefully that
make sense to you. If not, you might want
to re-watch some of the earlier videos. But that's the easy part. So there's 2 to the eighth
possible outcomes when you flip a fair coin eight times. So how many of those outcomes
are going to result in exactly 3 heads? Let's think of it this way. Let's give a name to
each of our flips. Let's give a name to them. So let me make a little column,
we'll call these the flips. This is my flips column. And I could name them anything. I could name them
Larry, Curly, Moe. I could name them-- well, I
would need 5 more names for them, but I could name them the
7 dwarfs or the 8 dwarfs really because I have 8 flips. I'll number the flips. Flip 1, 2, 3, 4, 5, 6, 7, 8. And I'm the god of probability. And essentially, I need to just
pick 3 of these flips that are going to result in heads. So another way to think about
it is, these could be 8 people and I could pick which of
these-- how many ways can I pick 3 of these people
to put into the car? How many ways can I pick 3 of
these people to sit in chairs. And it doesn't matter the
order that I pick them in. It doesn't matter if I say the
people that are going to get in the car are going to
be people 1, 2, 3 3. Or if I say 3, 2, and 1,
or if I say 2, 3, and 1. Those are all the
same combination. So similarly, if I'm just
picking flips and I have to say, OK, 3 of these
flips are going to get into the heads car. Heads is like they're sitting,
they're people sitting down. I don't want to
confuse you too much. But essentially I'm
just going to choose 3 things out of the 8. So I'm essentially just saying,
how many combinations can I get where I pick 3 out of these 8. And so that should immediately
ring a bell that we're essentially saying, out of 8
things we're going to choose 3. How many combinations of 3
can we pick of 8 and that we went over in the last video. And let's do it with
the formula first. So let me write the formula up
here just so you remember it, but I also want to give you the
intuition again, for the formula. So in general, we said, n
choose k, that is equal to n factorial over k factorial
times n minus k factorial. So in this situation that
would equal 8 factorial over 3 factorial times what? 8 minus k-- times 5 factorial. Or another way of writing this,
this would be 8 times 7 times 6 times 5 times 4 times 3 times 2
times 1 over-- I'll just write 3 factorial for a second. Then times 5 times 4
times 3 times 2 times 1. And of course, that and that
cancel out and all you're left with is 8 times 7
time 6 over 3 factorial. And I did this for reason
because I want you to re-get the intuition at least for
this part of the formula. That's essentially just saying,
how many permutations can I-- how many ways can I pick
3 things out of 8? And that's essentially saying,
well, before I pick anything I could pick 1 of 8. Then I have 7 left to pick
from for the second spot. And then I have 6 left to
pick for the third spot. And so that's essentially
the number of permutations. But since we don't care what
order we picked them in, we need to divide by the number of
ways we can rearrange 3 things, and that's where the 3
factorial comes from. And so hopefully I didn't
confuse you, but if I did you can go back to this formula
for the binomial coefficient. But it's good to
have the intuition. And then once we're
at this point we can just calculate this. Well, what's this? This is 8 times 7 times
6 over 3 factorial of 3 times 2 times 1. So that's 6. The 6 cancels out,
so it's 8 times 7. So there's 8 times
7, or what is that? 56. That's equal to 56. So there's 56 different ways
to pick 3 things out of 8. Or if I have 8 people there's
56 ways of picking 3 people to sit in the car or however
you want t view it. But if I have 8 flips there's
56 ways of picking 3 of those flips to be heads. So let's go to our original
probability problem. What is the probably that
I get 3 out of 8 heads? Well, it's the number of ways
I can pick 3 out of those 8, so it equals 56, over the
total number of outcomes. The total number of outcomes
is 2 to the eighth. Another way I could write
that-- 56, let me unseparate. That's 8 times 7 over
2 to the eighth. 8 is 2 to the third. Let me erase some of this. Not with that color. Let me erase that. Let me erase all of
this just so I space. And I will switch
colors for variety. Let me use the small pen. OK, so I'm back. All right, so 8 is the same
thing as 2 to the third times 7-- this is all just
mathematical simplification, but it's useful-- over
2 to the eighth. And so, if we just divide both
sides-- the numerator and the denominator by 2 to the
third, this becomes 1. This becomes 2 to the fifth. And so it becomes 7/32. Is that right? So if I were to pick 3 out of
8-- yep, I think that is right. And so what does that
turn out to be? Let me get my calculator. [INAUDIBLE] to make careless mistakes. Let's see. My calculator seems
to have disappeared. Let me get it back. There it is. OK. 7 divided by 32 is
equal to 0.21875. Which is equal to 21.-- you
know, if I were to round roughly-- 21.9% chance. So there's a little bit better
than 1 in 5 chance that I get exactly 3 out of the
8 flips as heads. Hopefully I didn't confuse you
and now you can apply that to pretty much anything. You could say, well, what is
the probability of getting-- if I flip a fair coin-- of getting
exactly 7 out of 8 heads? Or you could say, what's
the probability of getting 2 out of 100 heads? And you could use it the exact
same way we did this problem. I'll see you in the next video.