## Counting Poker Hands

For this post I’m going to go through a classic exercise in combinatorics and probability; namely, proving that the standard ranking of poker hands is correct.

First, here are the standard poker hands, in ranked order.

1. Straight flush: Five cards of the same suit, in sequential numerical order.
2. Four-of-a-kind: Four cards of the same denomination and one card of a different denomination.
3. Full house: Three cards of one denomination and two cards of the same different denomination.
4. Flush: Five cards of the same suit.
5. Straight: Five cards in sequential numerical order.
6. Three-of-a-kind: Three cards of one denomination and two cards of two other, different, denominations.
7. Two pair: Two cards of one denomination, two cards of a second denomination, and one card of a third denomination.
8. One pair: Two cards of one denomination and three cards of three other denominations.
9. High card: None of the above.

Let’s count the number of ways each of these hands can occur.

First, there are $\binom{52}{5} = 2,598,960$ possible poker hands, as we’re choosing five cards from fifty-two.

1. Straight flush:
1. Choose the suit, in $\binom{4}{1} = 4$ ways.
2. Then choose the denomination of the smallest card in the straight, in $\binom{10}{1} = 10$ ways.
3. Once you choose the denomination of the smallest card in the straight, the rest of the denominations in the straight are determined.
4. Thus there are 4(10) = 40 straight flushes.
5. Probability: 40/2,598,960 = 0.0000154.
2. Four-of-a-kind:
1. Choose the denomination, in $\binom{13}{1} = 13$ ways.
2. Then choose the four cards in that denomination, in $\binom{4}{4} = 1$ way.
3. Finally, choose the off card, in $\binom{48}{1} = 48$ ways.
4. Thus there are 13(1)(48) = 624 four-of-a-kind hands.
5. Probability: 624/2,598,960 = 0.000240.
3. Full house:
1. Choose the denomination for three cards, in $\binom{13}{1} = 13$ ways.
2. Next choose three of four cards in that denomination in $\binom{4}{3} = 4$ ways.
3. Then choose the denomination for two cards in $\binom{12}{1} = 12$ ways.
4. Finally, choose two of four cards in the second denomination in $\binom{4}{2} = 6$ ways.
5. Thus there are 13(4)(12)(6) = 3744 full house hands.
6. Probability: 3744/2,598,960 = 0.00144.
4. Flush:
1. Choose the suit in $\binom{4}{1} = 4$ ways.
2. Then choose five cards from that suit in $\binom{13}{5} = 1287$ ways.
3. This gives 4(1287) = 5148.
4. However, we’ve included the straight flushes in this count, so we must subtract them off to get $5148 - 40 = 5048$ flush hands.
5. Probability: 5048/2,598,960 = 0.00194.
5. Straight:
1. Choose the denomination of the smallest card in the straight, in $\binom{10}{1} = 10$ ways.
2. This fixes the denominations in the straight.
3. Next, for each of the five denominations in the straight, we have four choices for the suit, giving 4(4)(4)(4)(4) = 1024 choices for the suits.
4. This gives 10(1024) = 10,240.
5. However, we’ve included the straight flushes in this count, so we must subtract them off to get $10,240 - 40 = 10,200$ straight hands.
6. Probability: 10,200/2,598,960 = 0.00392.
6. Three-of-a-kind:
1. Choose the denomination for the three-of-a-kind in $\binom{13}{1} = 13$ ways.
2. Next, choose three cards from that denomination in $\binom{4}{3} = 4$ ways.
3. Then choose two different denominations from the remaining 12 in $\binom{12}{2} = 66$ ways.
4. Then select one card from the larger of the two off-denominations in $\binom{4}{1} = 4$ ways.
5. Finally, select one card from the smaller of the two off-denominations in $\binom{4}{1} = 4$ ways.
6. All together, there are 13(4)(66)(4)(4) = 54,912 three-of-a-kind hands.
7. Probability: 54,912/2,598,960 = 0.021.
7. Two pair:
1. Choose the two denominations for the pairs in $\binom{13}{2} = 78$ ways.
2. Choose two cards from the larger of the chosen denominations in $\binom{4}{2} = 6$ ways.
3. Choose two cards from the smaller of the chosen denominations in $\binom{4}{2} = 6$ ways.
4. Choose the fifth card from the 44 cards not in one of the two chosen denominations in $\binom{44}{1} = 44$ ways.
5. Thus there are 78(6)(6)(44) = 123,552 two-pair hands.
6. Probability: 123,552/2,598,960 = 0.0475.
8. One pair:
1. Choose the denomination for the pair in $\binom{13}{1} = 13$ ways.
2. Choose two cards from that denomination in $\binom{4}{2} = 6$ ways.
3. Choose three different denominations for the remaining three cards in $\binom{12}{3} = 220$ ways.
4. Choose one card from each of those three different denominations in $\binom{4}{1} \binom{4}{1} \binom{4}{1} = 4(4)(4) = 64$ ways.
5. Thus there are 13(6)(220)(64) = 1,098,240 one-pair hands.
6. Probability: 1,098,240/2,598,960 = 0.423.
9. High card:
1. The sum of all the previous counts is 1,296,420.
2. Thus there are $2,598,960 - 1,296,420 = 1,302,540$ high card hands.
3. Probability: 1,302,540/2,598,960 = 0.501.