If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

# Example: Combinatorics and probability

Probability of getting a set of cards. Created by Sal Khan and Monterey Institute for Technology and Education.

## Want to join the conversation?

• While calculating # of hands with 1's , we use 32x31x30x29x28 as the numerator which seems obvious. However since the arrangement of 1's and the remaining cards does not matter , should the denominator not be 9 factorial ?
• No. I was initially confused here as well. Here's the reasoning, I think:

We know our hand will have four 1s in it. This is given. If the size of our hand were just four cards, there would be exactly one way to do this. That would be easy. Unfortunately, we have 5 other cards in our hand as well, which make this more complicated (and interesting).

Sal took this idea (the idea that there is only one way way to have all of the ones if our hand only had four cards), and he built from there. The question then became how to fill the other five "slots" in our hand, which turns out to be (32*31*30*29*28)/(5!). We can essentially ignore the four 1s because we already accounted for them by assuming we had them from the outset.

A simpler example:
A simpler example might examined a 2-card hand (perhaps we're playing blackjack or something). Using a standard deck of cards, what would the probability be of having the four of hearts in your 2-card hand? Well, you can start by assuming you have the four of hearts, then figure out how many options you would have for the other card in your hand. This would tell you the total number of hands you could have (52 minus the four of hearts = 51). Then, just divide this by the total number of possible hands and you have your answer.

This is essentially the same thing Sal did, but instead of assuming he had just one card in his hand at the outset, he assumed he had all four 1s. Then, all he had to do was figure out how many 9-card hands he could have based on that assumption.

Yikes! That explanation got kinda long! I hope it helped :-)
• wouldn't it be easier to explain it this way: ((4 C 4) * (32 C5)) / (36 C 9) = 2/935?
• You are right. Wouldn't that expression the hypergeometric distribution?
• Isn't the number of ways to arrange a hand with 4 1's and 5 non-1's be 9 factorial rather than 5 factorial?
• SAL is CORRECT and I can prove it...

The event he explained is getting all four 1's in a hand of 9, out of 36 cards numbered 1 through 9 and of four suits. If it is correct, then the odds of getting three 1s, two 1's, one 1's, and zero 1's should all be calculated in the exact same way.(1)
Then, when all the possibilities are added together, they should have a 100% chance of success.(2)
Each of these events are mutually exclusive and cover the range of ALL possible hands:
4, 3, 2, 1, and 0 ones in a hand. (3)
*
I believe we all agree:
36*35*34*33*32*31*30*29*28 / 9*8*7*6*5*4*3*2*1
covers all the possible hands.
This can be written as, "36 choose 9." Which is found by 36! divided by 27! and 9!
OR
36! / ( [36-9]! * 9! )
AND
It could also be written 36 choose 27... since we are in a sense choosing 27 cards NOT to be in the hand. (Written much the same way).
I am not trying to confuse anyone! All these previous statements (*) are equivalent and are all equal to 94,143,280. They all mean the exact same thing and will make this MUCH easier to write.

What Sal is doing when he says 1*1*1*1 for the four 1's in the hand, is 4 choose 4. Or counting how many ways to choose 4 cards for 4 slots, all at once.
This is written out mathematically as:
4!/( [4-0]! * 0!)
Because 0! = 1 (and only just because) we wind up with 4!/4! which is equal to 1.
1*1*1*1 = 1
And your intuition should tell you, there is only one way to "4 choose 4."

Intuition is so-so. You should really remember how the formula works (that is all Liebniz did...)
For example, we can't 4 choose 9, because then you end up with (-5)! which is undefined, but you can do 4 choose 0; only because 0! = 1. So your intuition doesn't work... neither does math evidently, because how can you choose 4 cards to fill 0 slots and not 9 and multiply 0 by something to equal 1???
That's Leibniz for you! And I should also remind you this was invented as a way to cheat at cards.

So, then we have 32 cards left to freely choose from. There are 5 slots to place them in A.K.A. 32 choose 5.
You then do permutations of 4 choose 4 times 32 choose 5. Which is real exciting, because 4 choose 4 = 1.

Yes, this is exactly what Sal has proposed. (4)

So we use the same logic for all the possible hands: 4, 3, 2, 1, and 0 ones.
4 choose 4 * 32 choose 5
4 choose 3 * 32 choose 6
4 choose 2 * 32 choose 7
4 choose 1 * 32 choose 8
4 choose 0 * 32 choose 9

(It is an excellent question that you asked.)
When you add each of the 4 possible hands above you get 94,143,280.
I did not fudge on this one either! I got it right the first time! I am strongly convinced that Sal is correct...
• I really didnt follow this video very well after having followed all of Sal's probability videos up to this point. I tried to solve this problem doing it in a way that seemed logical to me, and voila I got the same answer Sal did!

Basically, I calculated the odds of drawing 4 ones out of 36 cards, and multiplied that result times (9 choose 4), which is the number of ways that these 4 can be organized in 9 positions.

1. The probability of drawing the 1st one is 4/36
2. The probability of drawing the 2nd one is 3/35
3. The probability of drawing the 3rd one is 2/34
4. The probability of drawing the 4th one is 1/33

Multiplying these 4 numbers together and then multiplying this result with (9 choose 4), which is 126 will give you 2/935 , the same number Sal got.

I now need to see how a method that is totally logical to me fits into the method that he did which isnt obvious at all! The beauty of logic and math!
• Here's a simpler way to solve this problem without using combinatorics at all. We want 4 specific cards out of 36 in a hand of 9 cards: 1♥️, 1♦️, 1♠️, and 1♣️.

1. What is the probability of getting 1♥️ in 9 cards? We have 36 different cards, only one of them is 1♥️, and 9 chances to get it. It's 9 out of 36 or 9/36.

2. Now what is the probability of getting 1♦️? These are dependent events because we don't put the cards back into the deck. So, if the first event happens we would have 35 cards left in the deck and 8 spots to fill in our hand. That's 8 out of 35 or 8/35.

3. If events 1 and 2 happen, we would have 34 cards left and 7 empty spots in our hand. The probability of getting 1♠️ would be 7 out of 34 or 7/34.

4. Similarly, given the events 1, 2, and 3, the probability of getting 1♣️ would be 6 out 33 or 6/33.

We want 4 of these events to happen and we don't care about the rest of the 5 cards in the hand, so we multiply the 4 probabilities: 9/36 * 8/35 * 7/34 * 6/33 = 2/935. The same would apply to any 4 unique cards out of 36 in a hand of 9 cards.
• I am perplexed. I would have thought that the probability is: The number of ways four ones could combine in 9 cards divided by the total number of combinations which could occur. I understand that the denominator should be 36! / (9! x 27!). But why isn't the numerator 9! / (4! x 5!) ? That given numerator would be the number of ways one could combine four ones into 9 cards regardless of order. That number over the total number of combinations possible regardless of order should give the probability of getting four ones. That comes out to 9 / 6,724,520. Why is my numerator incorrect? I just don't get it. Please help and explain. Thanks.
• I hope I can shed some light on this.

Let's start at the beginning. We want to know the probability of getting all four 1's in our hand of nine cards. And just to be clear, imagine you are holding some cards in your hand... You would still have the same cards in your hand even if you switch a few around. Does this make sense? For example, say I have a Queen, a Jack and a Spade. If I switch these around in my hand, I still have those three cards to play the game, right? THAT's what Sal means when he says 'the order does not matter'... Okay so let's continue.

We have 36 cards, and 9 'places'. The total number of possible ways we can get 36 things in 9 places is: 36!/27! But since we would be over-counting as the order does not matter, we need to divide through by 9!. This gives us the 36! / (27! x 9!) that you say you understood.

So let's move on to the numerator.

We have 36 cards. We want four of the 1's in our hand. Since order does not matter (same logic as above), there's really only one way I will have four 1's (treat them as quadruplets that we can treat as one entity for the time being). So for example...

1, 1, 1, 1, something else, something else, something else, something else, something else

The remaining 5 places we need to look at. Providing we have the four 1's, we must see how many outcomes there are for the remaining 32 cards in 5 places. That is 32!/ (32-5)!. But again, we would be over-counting since order does not matter. And therefore we must divide by a futher 5!. This then becomes 32! / (32 - 5)! x 5!

SO TO FINALLY PUT EVERYTHING TOGETHER:

[ 32! / (32-5)! x 5! ] ALL DIVIDED BY [ 36! / (36-9)! x 9!] GIVES US 2/935 !
• I don't understand why this video uses a different methodology than in previous problems. I’ll use a couple of examples to illustrate my confusion:

A) When we're asked to find the probability of exactly 3 heads after 5 flips of a coin, we figure out the # of successes using the combination 5 nCr 3 (5 choose 3). The intuition being that there are 5 events and we need 3 heads.

B) On the other hand, in this card problem when we want to find the # of successful outcomes we use the combination 32 nCr 5 (32 choose 5). The intuition being that AFTER our 4 cards have been drawn, there are 5 cards that can complete the hand and make up a combination.

It seems to me that by following the logic in A) and applying it to B), we should be using the combination 9 nCr 4 (9 choose 4); intuition being that there are 9 events and we need 4 cards of “1’s”.

So, why is it that we are using a different resolution?
• I had trouble understanding this too, but I think I know why we can't use the method "A".

You could use 5 nCr 3 for the flip of coins problem because you wanted to identify all the positions three Heads could be arranged in. You then divided this by the total number of possible outcomes of five flips and you're done.

Now, for the cards problem, if you say 9 nCr 4, you're saying one of two things:
1 - The number of arrangements four 1s can be in, in a 9 card hand; which does not matter, because we only care as long as there's 1 arrangement, unlike the coin flips problem.
2 - The number of possible four card combinations for a hand of 9 cards; which we are not looking for.

You see, 9 nCr 4 does not account for the fact that for the other 5 spots that make up your hand, there could be any of the other 27 cards still in the deck. This has to be taken into consideration if you're looking for the total number of hands that have four 1s, because this total depends on all the possible combinations of cards that those last 5 spots can have.

It was hard for me to grasp it. I hope this explanation helped :(
• The last part confused me for a moment, but:
(32*31*30*29*28) / (5*4*3*2*1)
is the same as:
32! / 5!(32-5)!
Is this right?
• yes that is correct. 32! = 32*31*30... *1 but a lot of terms get cancelled out with the 27!, and you are left with what you originally had.
• A less confusing explanation (I think):
I think we all can agree that while calculating both the numerator and denominator we are essentially counting the number of possible arrangements (permutations) and then finding the combinations from it. Also, I hope that the denominator part is quite clear from Sal's explanation.

So let's focus on numerator. Firstly, what are all the possible arrangements? Note that at first we are just focussed on finding the number of possible arrangement (permutations)s. We'll find the number of combinations later.
Firstly, let's have 9 slots. So we can represent them like this:
_ _ _ _ _ _ _ _ _

Now let's start to fill the slots. Let's fill the first 4 slots with 1H 1S 1C 1D (1H means 1 of hearts, 1S means 1 of spades and so on). You can fill any slot with 1's but I'm taking the first four just because it keeps things simple. So we have:
1H 1S 1C 1D _ _ _ _ _

So let us find the number of all possible arrangements where we have 1H 1S 1C 1D (in that order) in the first 4 slots . The number of remaining cards = 36 - 4 = 32.

Therefore, number of possible arrangements with first 4 slots as 1H 1S 1C 1D (in that order) is:
1 x 1 x 1 x 1 x 32 x 31 x 30 x 29 x 28

To make it more clear, this number is the count of all possible hands like the following:
1H 1S 1C 1D 2H 3H 7C 9D 6C or,
1H 1S 1C 1D 9S 7S 6S 2S 3S or,
1H 1S 1C 1D 8C 3H 2H 9D 7C etc.

In all the above cases our first four cards are 1H 1S 1C 1D (in that order). But now what about the cases like:
7H 2S 1C 8D 1S 1H 7C 1D 8C or,
1D 1C 1S 1H 9S 7S 6S 2S 3S or,
8C 3H 2H 9D 7C 1H 1S 1C 1D etc.

Well to find that, we can find the possible ways to arrange the 4 1's in 9 slots. So the first 1 can occupy any of the 9 slots, the second 1 can have 8 slots, the third 1 can have 7 slots and the fourth 1 can have any of the remaining 6 slots.
So the possible ways to arrange just the 4 1's = 9 x 8 x 7 x 6

Therefore, the total number of possible arrangements for our hand in which we can have four 1's is:
32 x 31 x 30 x 29 x 28 x 9 x 8 x 7 x 6

Now, the order doesn't matter in a hand. Therefore the following two cases for example are equivalent:
7H 2S 1C 8D 1S 1H 7C 1D 8C,
8D 1S 1H 7C 1D 8C 7H 2S 1C

Now to account for all the duplicate hands we'll need to find the number of ways in which we can arrange the 9 cards in 9 slots. It is equal to
9 x 8 x 7 x 6 x 5 x 4 x 3 x 2 x 1 = 9!

Therefore, our numerator (i.e. total number of possible outcomes or combinations in which we can have 4 1's in our hand of 9 cards) =
32 x 31 x 30 x 29 x 28 x 9 x 8 x 7 x 6 / 9!

Our denominator (i.e. total possible combinations for a hand of 9 cards) =
36 x 35 x 34 x 33 x 32 x 31 x 30 x 29 x 28 / 9!
(Refer to Sal's explanation in the video if you don't understand how we got the denominator.)

Now our probability of getting 4 1's = numerator / denominator
= (32 x 31 x 30 x 29 x 28 x 9 x 8 x 7 x 6 / 9!) / (36 x 35 x 34 x 33 x 32 x 31 x 30 x 29 x 28 / 9!)
= (9 x 8 x 7 x 6) / (36 x 35 x 34 x 33)
= 2 / 935
• Before Sal explained. I came up with `9C4/36C4` which value is the same as the video. I worked out in a difference approach. First I found that the probability of getting first 4 1s and 5 of any other cards (in order) is `1/36C4` (4/36 for the 1st card, 3/35, 2/34 and 1/33 for 2nd, 3rd and 4th. And for the next 5 non-1 cards always going to be 1). And multiply by the difference ways that the 4 1-cards of 9 cards can be rearrange, which is `9C4`.