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

# Getting exactly two heads (combinatorics)

A different way to think about the probability of getting 2 heads in 4 flips. Created by Sal Khan.

## Want to join the conversation?

- To solve the second question of finding the probability of flipping 2 heads, is there an equation of formula to quickly solve the question?(32 votes)
- its actually nCr =(n!)/(r!(n - r)!)(19 votes)

- there was a question on this website "A fair coin is flipped four times. What is the probability of getting tails at least twice? Write your answer as a simplified fraction". I did it like the one said here...but it said the answer is 11/16(which I can get by counting) but my answer was 3/8 using this exact method, i was going along ???? Please tell me what i'm doing wrong?it took my red bar to blue bar...it was gonna make me cry..HELP(15 votes)
- In the question it says AT LEAST two heads, so you don't just count the posibilities of getting exactly two heads, you also have the possibilities of getting three or four heads. This method talks about getting Exactly two heads, not 2, 3 or 4.

If you want to use combinatorics: it's 6/16 (as shown in the video) + 4/16(the possibility of getting three heads 4*3*2/3*2=4 of 16)+ 1/16 (the possibility of getting 4 heads)=11/16(50 votes)

- hey im still not quite understanding the intuition behind why under 4 places, each with 2 outcomes i can get 16 possibilities. Sure if i were to write out each possible outcome I'd indeed arrive at 16. But how do I know by going 2x2x2x2(7 votes)
- I think the easiest way to understand this is to think of a tree diagram. At each point there are two branches coming off of the previous one. Using coin flips, after 1 flip we have 2 branches: heads and tails. At the second flip we have two branches off each of the original two branches, doubling the number of branches (4 total - HH, HT, TH, TT). At the third flip, each of these 4 branches has two new branches coming off of it for a total of 8. And so on, with every flip we are doubling the number of branches. Hence the total number of possible outcomes is 2^x, where x is the number of flips we make.

Another way to think of it is that you have a particular sequence of flips. Let's say we have two flips, I'll call them F1 and F2. The sequence so far is then (F1, F2). Using your reasoning, you can figure out that there are four ways for this sequence of two flips to have occurred. Now let's add a third flip. There are two options: heads or tails. To count the number of possible outcomes for the entire sequence, we take the entire sequence (4 ways), and put an H on the end, or we can take the entire sequence and put a tails on the end. So we have 4 ways (F1,F2,H) plus 4 ways (F1, F2, T). So we've taken the total number of possible outcomes thus far, and doubled it to account for each of the potential outcomes of the next flip.(18 votes)

- In the last example of exactly two heads, I'm not clear on how that's calculating
**exactly**two rather than at least two. We calculate the likelihood of the two heads appearing in each of the places, and clearly that's correct because it gets the right answer compared to just counting the possibilities, but how is the equation constraining out the situations where you have three or four heads?(6 votes)- Here's another way to think about it. We want exactly 2 heads and as a result 2 tails in 4 flips. Let's denote them as Ha, Hb, Ta, and Tb.

How many different ways we can arrange these 4 items? Well, that would be 4! or 4 * 3 * 2 * 1. We don't need to differentiate between Ha and Hb and double count them. For example, we want HaHbTaTb and HbHaTaTb counted as one instead of two. So, we divide by 2! to account for double counting. Same with Ta and Tb. So, we divide by another 2! to cancel out double counting of two T's.`4! / (2! * 2!) = 6`

Finally, if we divide all 6 different ways of getting exactly 2 heads (and 2 tails) in 4 flips by all possible outcomes 2 * 2 * 2 * 2 = 16 we would get the probability of exactly 2 heads in 4 flips.`6 / 16 = 3 / 8`

(5 votes)

- Then, what do we say when there are more than one heads? Two headss?(3 votes)
- Yes, you would say
*two headses*. This is because "heads" is a single state, so you're really saying*two "heads"es*. Although, most people would probably say*two heads*. :)

You could also call them "successes" and "failures," which would eliminate the need for this odd terminology.(6 votes)

- The majority of operations involved with probability involve multiplication, even after watching intro videos and working through the modules I'm having a hard time in general intuitively understanding why. Specifically at1:39, why use multiplication? Couldn't you break it down into complicated addition at some point?(5 votes)
- Can we solve this the same way we solve word problems in combinations? Eg: How many different ways are can we write the word "THAT" uniquely? The answer being --> 4!/2. Similarly we can apply for HHTT,but by selectively letting T repeat--> 4!/2. Am i going wrong somewhere?? Does this have any loop hole?(3 votes)
- If you look at the video and solution, and reason through it, you'll find that's exactly what being done here.

But before that, the number of different ways we can write (or re-arrange) the word "THAT" is 4!/2! not 4!/2 (2! for the different ways the two T's would have permuted if they were different, which they are not, so we are dividing that value from the whole).

And going by that, the ways we can re-arrange HHTT (exactly two heads) will be 4!/(2!*2!) = 6. The first 2! in the denominator for the same two H and the next 2! in the denominator for the same two TT. This is if you look at it a combination given by 4C2 = 4!/[(4-2)! * 2!] = 6. Hope this make stuff a bit clearer for you.(4 votes)

- Please help me understand and have intuition as to why 4 has to be multiplied by 3 and why there are 12 places. I've watched the permutations video and understood that by drawing diagrams, however, I can't quite seem to understand this.(4 votes)
- We are flipping the coin four times.

As Sal explained in the video, with Ha (Heads A), there are four potential "spots" or flips for us to get a heads. This is because we are flipping for the first time, meaning there are still four outcomes.

Next, we have Hb (Heads B). Since we have already flipped a heads (Heads A), there are now only 3 spots/flips for an outcome of heads (or any outcome).

For every spot/flip that we can get a heads the first flip (4 different spots for heads A), there are 3 other flips that we could get a heads for (heads B).

You can create a tree diagram by having Heads branch out into 4 (since we are flipping the coin 4 times), and for each of those Heads, you would branch out 3 times since you have already flipped the coin once (4-1=3), and you would have three more flips afterwards to get another heads.

We would then multiply: 4 * 3 = 12

because for every possible heads (4 possibilities: first flip, second flip, third flip, or fourth flip), there would be three others.

Hope this makes sense! I strongly recommend drawing a tree diagram that I mentioned above to help comprehend the reasoning behind this.(2 votes)

- There was this question on dependent probability, 'You have 6 coins in a bag. 3 of them are unfair in that they have a 55% chance of coming up heads when flipped (the rest are fair coins). You randomly choose one coin from the bag and flip it 3 times.

What is the probability, written as a percentage, of getting 3 heads? Round your answer to the nearest hundredth of a percent.'

and I had no idea how to solve it :((4 votes)- I know this one is old, but in case someone was wondering how to solve this:

First, you have to realize that any coin we pick - unfair or fair - can get 3 heads and that equally suits us. There are 3 fair and 3 unfair coins, which means the probability of getting a fair or unfair coin is 1/2. Let's start with unfair. P(H) of unfair = .55, as in the description of the problem. That said, P(HHH) = .55*.55*.55=0.1663... Then we have to multiply that by probability of getting this unfair coin , which is 1/2, to get the P(unfair HHH). So, 0.1663*.5 = 0.08315

Same with the fair coin. P(H) = .5, so P(HHH) = .5^3=1/8. Multiply that by 1/2, probability

of getting any fair coin. We get 1/16.

We then need to sum those probabilities up, because we don't care which one will it be and they both suit us. 0.08315+1/16 = 0.08315 + 0.0625 = 0.14565 = 14.56%

All Done!(3 votes)

- Please help me by pointing out where am I going wrong, but if we think conceptually(by keeping aside combinatorics and sample space for a moment) then by probability of getting heads "1/2" times we say that half of the times we are likely to get heads, so by this logic when we repeat this experiment of tossing a fair coin four times then why probability of getting two heads is not 0.5 or 8/16 but instead is 6/16? I also referred binomial distribution for this, by binomial distribution our expected value comes to "nXp", according to this expected value comes to 4x1/2 which is 2 right? If we repeat a single coin tossing experiment 4 times, shouldn't we be expecting to get 2 heads?(2 votes)
- You would expect to get two heads
*on average*but that does not preclude getting no heads or four heads. Those extremes are less likely to happen than two heads, but they're not entirely impossible.

Think of a simpler experiment than yours: tossing a coin twice. Using your logic we would expect to get 1 head (2 x ½). Do you really think if the first toss came up heads, then the second*must*come up tails? Because that's not how probability works - the two events are independent.

We can work out the sixteen**equally likely**result of tossing a coin four times:

HHHH

HHHT, HHTH, HTHH, THHH,

HHTT, HTHT, HTTH, THHT, THTH, TTHH,

HTTT, THTT, TTHT, TTTH,

and TTTT

There are 16 equally likely outcomes, and six of them contain two heads, so P(2H) = 3/8(2 votes)

## Video transcript

I'm going to start
with a fair coin, and I'm going to
flip it four times. And the first question I want to
ask is, what is the probability that I get exactly
one head, or heads? This is one of those
confusing things, when you're talking about what
side of the coin. I know I've been not
doing this consistently. I'm tempted to say,
if you're saying one, it feels like you should do the
singular, which would be head. But I've read up a little
bit of it on the internet, and it seems like when
you're talking about coins, you really should say one
heads, which is a little bit, it seems a little
bit difficult for me. But I'll try to go with that. So what is the probability
of getting exactly one heads? And I put that in
quotes to say, you know, really, we're just to
talking about one head there. But it's called heads when
you're dealing with coins. Anyway, I think you get
what I'm talking about. And to think about
this, let's think about how many different
possible ways we can get four flips of a coin. So we're going to have one
flip, then another flip, then another flip, then another flip. And this first flip
has two possibilities. It could be heads or tails. The second flip has
two possibilities. It could be heads or tails. The third flip has
two possibilities. It could be heads or tails. And the fourth flip
has two possibilities. It could be heads or tails. So you have 2 times
2 times 2 times 2, which is equal
to 16 possibilities. 16 possible outcomes when
you flip a coin four times. And any one of the possible
outcomes would be 1 of 16. So if I wanted to
say, so if I were to just say the
probability, and I'm just going to not talk
about this one heads, if I just take a, just
maybe this thing that has three heads right here. This exact sequence of events. This is the first flip, second
flip, third flip, fourth flip. Getting exactly
this, this is exactly one out of a possible
of 16 events. Now with that out of
the way, let's think about how many possibilities,
how many of those 16 possibilities, involve
getting exactly one heads? Well, we could list them. You could get your heads. So this is equal
to the probability of getting the heads
in the first flip, plus the probability of getting
the heads in the second flip, plus the probability of getting
the heads in the third flip. Remember, exactly one heads. We're not saying at least
one, exactly one heads. So the probability in
the third flip, and then, or the possibility that you
get heads in the fourth flip. Tails, heads, and tails. And we know already
what the probability of each of these things are. There are 16 possible
events, and each of these are one of those
16 possible events. So this is going to be 1 over
16, 1 over 16, 1 over 16, and 1 over 16. And so we're really
saying the probability of getting exactly one
heads is the same thing as the probability of getting
heads in the first flip, or the probability
of getting heads-- or I should say the
probability of getting heads in the first flip, or
heads in the second flip, or heads in the third flip,
or heads in the fourth flip. And we can add the probabilities
of these different things, because they are
mutually exclusive. Any two of these things cannot
happen at the same time. You have to pick one
of these scenarios. And so we can add
the probabilities. 1/16 plus 1/16 plus
1/16 plus 1/16. Did I say that four times? Well, assume that I did. And so you would get 4/16,
which is equal to 1/4. Fair enough. Now let's ask a slightly
more interesting question. Let's ask ourselves
the probability of getting exactly two heads. And there's a couple of
ways we can think about it. One is just in the
traditional way. [? We ?] know the
number of possibilities and of those equally
likely possibilities. And we can only use
this methodology because it's a fair coin. So, how many of the
total possibilities have two heads of the total of
equally likely possibilities? So we know there are 16
equally likely possibilities. How many of those
have two heads? So I've actually, ahead
of time so we save time, I've drawn all of the 16
equally likely possibilities. And how many of these
involve two heads? Well, let's see. This one over here has two
heads, this one over here has two heads, this one
over here has two heads. Let's see, this one
over here has two heads, and this one over
here has two heads. And then this one over
here has two heads, and I believe we
are done after that. So if we count them, one,
two, three, four, five, six of the possibilities
have exactly two heads. So six of the 16 equally likely
possibilities have two heads. So we have a-- what
is this-- a 3/8 chance of getting exactly two heads. Now that's kind of what
we've been doing in the past, but what I want to do
is think about a way so we wouldn't have to write
out all the possibilities. And the reason why
that's useful is, we're only dealing
with four flips now. But if we were
dealing with 10 flips, there's no way that
we could write out all the possibilities like this. So we really want a different
way of thinking about it. And the different
way of thinking about it is, if we're
saying exactly two heads, you can imagine we're
having the four flips. Flip one, flip two,
flip three, flip four. So these are the flips,
or you could say, the outcome of the flips. And if you're going to
have exactly two heads, you could say, well,
look, I'm going to have one head in
one of these positions, and then one head in
the other position. So how many, if I'm
picking the first, so I have kind of a heads
one, and I have a heads two. And I don't want you to
think that these are somehow the heads in the first flip or
the heads in the second flip. What I'm saying is
we need two heads. We need a total of two
heads in all of our flips. And I'm just giving one
of the heads a name, and I'm giving the
other head a name. And what we're going to see in a
few seconds is that we actually don't want to double
count, we don't want to count the
situation, we don't want to double count this
situation-- heads one, heads two, tails, tails. And heads two, heads
one, tails, tails. For our purposes, these are
the exact same outcomes. So we don't want to
double count that. And we're going to have
to account for that. But if we just think
about it generally, how many different spots,
how many different flips can that first head show up in? Well, there's four
different flips that that first head
could show up in. So there's four possibilities,
four flips, or four places that it could show up in. Well, if that first head takes
up one of these four places, let's just say that first head
shows up on the third flip, then how many different places
can that second head show up in? Well, if that first head is
in one of the four places, then that second head can only
be in three different places. So that second
head can only be-- I'm picking a nice
color here-- can only be in three different places. And so, you know, it could
be in any one of these. It could maybe be
right over there. Any one of those three places. And so, when you think about
it in terms of the first, and I don't want to say
the first head, head one. Actually, let me
call it this way. Let me call it head A
and head B. That way you won't think that I'm
talking about the first flip or the second flip. So this is head A, and this
right over there is head B. So if you had a particular,
I mean, these heads are identical. These outcomes aren't
different, but the way we talk about it
right now, it looks like there's four places that
we could get this head in, and there's three places where
we could get this head in. And so if you were to multiply
all of the different ways that you could get, all
of the different scenarios where this is in four
different places, and then this is
in one of the three left over places, you get
12 different scenarios. But there would only be
12 different scenarios if you viewed this as
being different than this. And let me rewrite it with
our new-- So this is head A, this is head B,
this is head B, this is head A. There would only be
12 different scenarios if you viewed these two things as
fundamentally different. But we don't. We're actually double counting. Because we can
always swap these two heads and have the
exact same outcome. So what you want to do is
actually divide it by two. So you want to divide it by
all of the different ways that you can swap
two different things. If we had three heads here,
you would think about all of the different ways you could
swap three different things. If you had four heads here, it
would be all the different ways you could swap four
different things. So there's 12
different scenarios if you couldn't
swap them, but you want to divide it by all
of the different ways that you can swap two things. So 12 divided by
2 is equal to 6. Six different scenarios,
fundamentally different scenarios, considering
that you can swap them. If you assume that head A and
head B can be interchangeable. But it's a completely
identical outcome for us, because they're
really just heads. So there's six
different scenarios, and we know that there's a total
of 16 equally likely scenarios. So we could say that the
probability of getting exactly two heads is 6
times, six scenarios and-- Or there's
a couple of ways. You could say there
are six scenarios that give us two heads,
of a possible 16. Or you could say there are
six possible scenarios, and the probability of each
of those scenarios is 1/16. But either way, you'll
get the same answer.