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.

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

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

First, there are possible poker hands, as we’re choosing five cards from fifty-two.

- Straight flush:
- Choose the suit, in ways.
- Then choose the denomination of the smallest card in the straight, in ways.
- Once you choose the denomination of the smallest card in the straight, the rest of the denominations in the straight are determined.
- Thus there are 4(10) = 40 straight flushes.
- Probability: 40/2,598,960 = 0.0000154.

- Four-of-a-kind:
- Choose the denomination, in ways.
- Then choose the four cards in that denomination, in way.
- Finally, choose the off card, in ways.
- Thus there are 13(1)(48) = 624 four-of-a-kind hands.
- Probability: 624/2,598,960 = 0.000240.

- Full house:
- Choose the denomination for three cards, in ways.
- Next choose three of four cards in that denomination in ways.
- Then choose the denomination for two cards in ways.
- Finally, choose two of four cards in the second denomination in ways.
- Thus there are 13(4)(12)(6) = 3744 full house hands.
- Probability: 3744/2,598,960 = 0.00144.

- Flush:
- Choose the suit in ways.
- Then choose five cards from that suit in ways.
- This gives 4(1287) = 5148.
- However, we’ve included the straight flushes in this count, so we must subtract them off to get flush hands.
- Probability: 5048/2,598,960 = 0.00194.

- Straight:
- Choose the denomination of the smallest card in the straight, in ways.
- This fixes the denominations in the straight.
- 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.
- This gives 10(1024) = 10,240.
- However, we’ve included the straight flushes in this count, so we must subtract them off to get straight hands.
- Probability: 10,200/2,598,960 = 0.00392.

- Three-of-a-kind:
- Choose the denomination for the three-of-a-kind in ways.
- Next, choose three cards from that denomination in ways.
- Then choose two different denominations from the remaining 12 in ways.
- Then select one card from the larger of the two off-denominations in ways.
- Finally, select one card from the smaller of the two off-denominations in ways.
- All together, there are 13(4)(66)(4)(4) = 54,912 three-of-a-kind hands.
- Probability: 54,912/2,598,960 = 0.021.

- Two pair:
- Choose the two denominations for the pairs in ways.
- Choose two cards from the larger of the chosen denominations in ways.
- Choose two cards from the smaller of the chosen denominations in ways.
- Choose the fifth card from the 44 cards not in one of the two chosen denominations in ways.
- Thus there are 78(6)(6)(44) = 123,552 two-pair hands.
- Probability: 123,552/2,598,960 = 0.0475.

- One pair:
- Choose the denomination for the pair in ways.
- Choose two cards from that denomination in ways.
- Choose three different denominations for the remaining three cards in ways.
- Choose one card from each of those three different denominations in ways.
- Thus there are 13(6)(220)(64) = 1,098,240 one-pair hands.
- Probability: 1,098,240/2,598,960 = 0.423.

- High card:
- The sum of all the previous counts is 1,296,420.
- Thus there are high card hands.
- Probability: 1,302,540/2,598,960 = 0.501.