Poker Hands Permutations Combinations

I’ve always confused “permutation” and “combination” — which one’s which?

Permutations vs. Combinations. Both are ways to count the possibilities. The difference between them is whether order matters or not. Consider a poker hand: –A, 5, 7♣, 10♠, K♠. Is that the same hand as: –K♠, 10♠, 7♣, 5, A. Does the order the cards are handed out matter? Further individual wins the jackpot. It could be a complete game and then you can avoid the correct winning numbers to getting creative and innovative UTD (ultimately win you need to play at the last thing is that which direction consider the following with a permutations and combinations poker hands restatement. In poker, players form sets of five playing cards, called hands, according to the rules of the game. Each hand has a rank, which is compared against the ranks of other hands participating in the showdown to decide who wins the pot. In high games, like Texas hold 'em and seven-card stud, the highest-ranking hands win.

Here’s an easy way to remember: permutation sounds complicated, doesn’t it? And it is. With permutations, every little detail matters. Alice, Bob and Charlie is different from Charlie, Bob and Alice (insert your friends’ names here).

Combinations, on the other hand, are pretty easy going. The details don’t matter. Alice, Bob and Charlie is the same as Charlie, Bob and Alice.

Permutations are for lists (order matters) and combinations are for groups (order doesn’t matter).

You know, a 'combination lock' should really be called a 'permutation lock'. The order you put the numbers in matters.

A true 'combination lock' would accept both 10-17-23 and 23-17-10 as correct.

Permutations: The hairy details

Let’s start with permutations, or all possible ways of doing something. We’re using the fancy-pants term “permutation”, so we’re going to care about every last detail, including the order of each item. Let’s say we have 8 people:

How many ways can we award a 1st, 2nd and 3rd place prize among eight contestants? (Gold / Silver / Bronze)

We’re going to use permutations since the order we hand out these medals matters. Here’s how it breaks down:

Permutations
  • Gold medal: 8 choices: A B C D E F G H (Clever how I made the names match up with letters, eh?). Let’s say A wins the Gold.
  • Silver medal: 7 choices: B C D E F G H. Let’s say B wins the silver.
  • Bronze medal: 6 choices: C D E F G H. Let’s say… C wins the bronze.

We picked certain people to win, but the details don’t matter: we had 8 choices at first, then 7, then 6. The total number of options was $8 * 7 * 6 = 336$.

Let’s look at the details. We had to order 3 people out of 8. To do this, we started with all options (8) then took them away one at a time (7, then 6) until we ran out of medals.

We know the factorial is:

Unfortunately, that does too much! We only want $8 * 7 * 6$. How can we “stop” the factorial at 5?

This is where permutations get cool: notice how we want to get rid of $5 * 4 * 3 * 2 * 1$. What’s another name for this? 5 factorial!

So, if we do 8!/5! we get:

And why did we use the number 5? Because it was left over after we picked 3 medals from 8. So, a better way to write this would be:

where 8!/(8-3)! is just a fancy way of saying “Use the first 3 numbers of 8!”. If we have n items total and want to pick k in a certain order, we get:

And this is the fancy permutation formula: You have n items and want to find the number of ways k items can be ordered:

Combinations, Ho!

Combinations are easy going. Order doesn’t matter. You can mix it up and it looks the same. Let’s say I’m a cheapskate and can’t afford separate Gold, Silver and Bronze medals. In fact, I can only afford empty tin cans.

How many ways can I give 3 tin cans to 8 people?

Well, in this case, the order we pick people doesn’t matter. If I give a can to Alice, Bob and then Charlie, it’s the same as giving to Charlie, Alice and then Bob. Either way, they’re equally disappointed.

This raises an interesting point — we’ve got some redundancies here. Alice Bob Charlie = Charlie Bob Alice. For a moment, let’s just figure out how many ways we can rearrange 3 people.

Well, we have 3 choices for the first person, 2 for the second, and only 1 for the last. So we have $3 * 2 * 1$ ways to re-arrange 3 people.

Wait a minute… this is looking a bit like a permutation! You tricked me!

Indeed I did. If you have N people and you want to know how many arrangements there are for all of them, it’s just N factorial or N!

So, if we have 3 tin cans to give away, there are 3! or 6 variations for every choice we pick. If we want to figure out how many combinations we have, we just create all the permutations and divide by all the redundancies. In our case, we get 336 permutations (from above), and we divide by the 6 redundancies for each permutation and get 336/6 = 56.

The general formula is

which means “Find all the ways to pick k people from n, and divide by the k! variants”. Writing this out, we get our combination formula, or the number of ways to combine k items from a set of n:

Sometimes C(n,k) is written as:

which is the the binomial coefficient.

A few examples

Here’s a few examples of combinations (order doesn’t matter) from permutations (order matters).

  • Combination: Picking a team of 3 people from a group of 10. $C(10,3) = 10!/(7! * 3!) = 10 * 9 * 8 / (3 * 2 * 1) = 120$.

    Permutation: Picking a President, VP and Waterboy from a group of 10. $P(10,3) = 10!/7! = 10 * 9 * 8 = 720$.

  • Combination: Choosing 3 desserts from a menu of 10. C(10,3) = 120.

    Permutation: Listing your 3 favorite desserts, in order, from a menu of 10. P(10,3) = 720.

Don’t memorize the formulas, understand why they work. Combinations sound simpler than permutations, and they are. You have fewer combinations than permutations.

Other Posts In This Series

This post works with 5-card Poker hands drawn from a standard deck of 52 cards. The discussion is mostly mathematical, using the Poker hands to illustrate counting techniques and calculation of probabilities

Working with poker hands is an excellent way to illustrate the counting techniques covered previously in this blog – multiplication principle, permutation and combination (also covered here). There are 2,598,960 many possible 5-card Poker hands. Thus the probability of obtaining any one specific hand is 1 in 2,598,960 (roughly 1 in 2.6 million). The probability of obtaining a given type of hands (e.g. three of a kind) is the number of possible hands for that type over 2,598,960. Thus this is primarily a counting exercise.

___________________________________________________________________________

Preliminary Calculation

Usually the order in which the cards are dealt is not important (except in the case of stud poker). Thus the following three examples point to the same poker hand. The only difference is the order in which the cards are dealt.

These are the same hand. Order is not important.

The number of possible 5-card poker hands would then be the same as the number of 5-element subsets of 52 objects. The following is the total number of 5-card poker hands drawn from a standard deck of 52 cards.

The notation is called the binomial coefficient and is pronounced “n choose r”, which is identical to the number of -element subsets of a set with objects. Other notations for are , and . Many calculators have a function for . Of course the calculation can also be done by definition by first calculating factorials.

Thus the probability of obtaining a specific hand (say, 2, 6, 10, K, A, all diamond) would be 1 in 2,598,960. If 5 cards are randomly drawn, what is the probability of getting a 5-card hand consisting of all diamond cards? It is

This is definitely a very rare event (less than 0.05% chance of happening). The numerator 1,287 is the number of hands consisting of all diamond cards, which is obtained by the following calculation.

The reasoning for the above calculation is that to draw a 5-card hand consisting of all diamond, we are drawing 5 cards from the 13 diamond cards and drawing zero cards from the other 39 cards. Since (there is only one way to draw nothing), is the number of hands with all diamonds.

If 5 cards are randomly drawn, what is the probability of getting a 5-card hand consisting of cards in one suit? The probability of getting all 5 cards in another suit (say heart) would also be 1287/2598960. So we have the following derivation.

Thus getting a hand with all cards in one suit is 4 times more likely than getting one with all diamond, but is still a rare event (with about a 0.2% chance of happening). Some of the higher ranked poker hands are in one suit but with additional strict requirements. They will be further discussed below.

Another example. What is the probability of obtaining a hand that has 3 diamonds and 2 hearts? The answer is 22308/2598960 = 0.008583433. The number of “3 diamond, 2 heart” hands is calculated as follows:

One theme that emerges is that the multiplication principle is behind the numerator of a poker hand probability. For example, we can think of the process to get a 5-card hand with 3 diamonds and 2 hearts in three steps. The first is to draw 3 cards from the 13 diamond cards, the second is to draw 2 cards from the 13 heart cards, and the third is to draw zero from the remaining 26 cards. The third step can be omitted since the number of ways of choosing zero is 1. In any case, the number of possible ways to carry out that 2-step (or 3-step) process is to multiply all the possibilities together.

___________________________________________________________________________

The Poker Hands

Here’s a ranking chart of the Poker hands.

The chart lists the rankings with an example for each ranking. The examples are a good reminder of the definitions. The highest ranking of them all is the royal flush, which consists of 5 consecutive cards in one suit with the highest card being Ace. There is only one such hand in each suit. Thus the chance for getting a royal flush is 4 in 2,598,960.

Royal flush is a specific example of a straight flush, which consists of 5 consecutive cards in one suit. There are 10 such hands in one suit. So there are 40 hands for straight flush in total. A flush is a hand with 5 cards in the same suit but not in consecutive order (or not in sequence). Thus the requirement for flush is considerably more relaxed than a straight flush. A straight is like a straight flush in that the 5 cards are in sequence but the 5 cards in a straight are not of the same suit. For a more in depth discussion on Poker hands, see the Wikipedia entry on Poker hands.

The counting for some of these hands is done in the next section. The definition of the hands can be inferred from the above chart. For the sake of completeness, the following table lists out the definition.


Definitions of Poker Hands

Poker HandDefinition
1Royal FlushA, K, Q, J, 10, all in the same suit
2Straight FlushFive consecutive cards,
all in the same suit
3Four of a KindFour cards of the same rank,
one card of another rank
4Full HouseThree of a kind with a pair
5FlushFive cards of the same suit,
not in consecutive order
6StraightFive consecutive cards,
not of the same suit
7Three of a KindThree cards of the same rank,
2 cards of two other ranks
8Two PairTwo cards of the same rank,
two cards of another rank,
one card of a third rank
9One PairThree cards of the same rank,
3 cards of three other ranks
10High CardIf no one has any of the above hands,
the player with the highest card wins

___________________________________________________________________________

Counting Poker Hands

Straight Flush
Counting from A-K-Q-J-10, K-Q-J-10-9, Q-J-10-9-8, …, 6-5-4-3-2 to 5-4-3-2-A, there are 10 hands that are in sequence in a given suit. So there are 40 straight flush hands all together.

Four of a Kind
There is only one way to have a four of a kind for a given rank. The fifth card can be any one of the remaining 48 cards. Thus there are 48 possibilities of a four of a kind in one rank. Thus there are 13 x 48 = 624 many four of a kind in total.

Full House
Let’s fix two ranks, say 2 and 8. How many ways can we have three of 2 and two of 8? We are choosing 3 cards out of the four 2’s and choosing 2 cards out of the four 8’s. That would be = 4 x 6 = 24. But the two ranks can be other ranks too. How many ways can we pick two ranks out of 13? That would be 13 x 12 = 156. So the total number of possibilities for Full House is

Note that the multiplication principle is at work here. When we pick two ranks, the number of ways is 13 x 12 = 156. Why did we not use = 78?

Flush
There are = 1,287 possible hands with all cards in the same suit. Recall that there are only 10 straight flush on a given suit. Thus of all the 5-card hands with all cards in a given suit, there are 1,287-10 = 1,277 hands that are not straight flush. Thus the total number of flush hands is 4 x 1277 = 5,108.

Straight
There are 10 five-consecutive sequences in 13 cards (as shown in the explanation for straight flush in this section). In each such sequence, there are 4 choices for each card (one for each suit). Thus the number of 5-card hands with 5 cards in sequence is . Then we need to subtract the number of straight flushes (40) from this number. Thus the number of straight is 10240 – 10 = 10,200.

Three of a Kind
There are 13 ranks (from A, K, …, to 2). We choose one of them to have 3 cards in that rank and two other ranks to have one card in each of those ranks. The following derivation reflects all the choosing in this process.

Two Pair and One Pair
These two are left as exercises.

High Card
The count is the complement that makes up 2,598,960.

The following table gives the counts of all the poker hands. The probability is the fraction of the 2,598,960 hands that meet the requirement of the type of hands in question. Note that royal flush is not listed. This is because it is included in the count for straight flush. Royal flush is omitted so that he counts add up to 2,598,960.

Poker Hands Permutations Combinations Calculator


Probabilities of Poker Hands

Poker Hands Permutations Combinations List

Poker HandCountProbability
2Straight Flush400.0000154
3Four of a Kind6240.0002401
4Full House3,7440.0014406
5Flush5,1080.0019654
6Straight10,2000.0039246
7Three of a Kind54,9120.0211285
8Two Pair123,5520.0475390
9One Pair1,098,2400.4225690
10High Card1,302,5400.5011774
Total2,598,9601.0000000

Poker Hands Permutations Combinations Worksheet

___________________________________________________________________________
2017 – Dan Ma