Quant Memo
Foundational

Counting Poker Hands

How to count five-card poker hands using combinations rather than listing them out, worked through for pairs and flushes — the standard warm-up combinatorics question in quant interviews.

"How many ways can you deal a five-card poker hand?" sounds like it wants you to start listing hands. It doesn't — with 2,598,960 possible five-card hands from a 52-card deck, listing is impossible, and the interviewer knows it. What they want is whether you reach for combinations, (nk)\binom{n}{k}, instead of trying to enumerate anything by hand. This is the standard warm-up for a longer line of questions ("how many are a flush," "how many are two pair") that build on the same technique.

The tool: choosing without order

A five-card hand is a set of cards — the order you're dealt them doesn't matter, and no card repeats. That's exactly what (nk)=n!k!(nk)!\binom{n}{k} = \frac{n!}{k!(n-k)!} counts: the number of ways to choose kk items from nn without regard to order. The total number of five-card hands from a 52-card deck is

(525)=52!5!47!=2,598,960.\binom{52}{5} = \frac{52!}{5!\,47!} = 2{,}598{,}960 .

In plain English: there are about 2.6 million distinct five-card hands, and every poker probability question is really "how many of those 2.6 million hands have property XX, divided by 2,598,960."

Worked example 1: counting flushes

A flush is five cards of the same suit (ignoring straight flushes for now, and yes, real poker excludes straight flushes from "flush" — a good interview move is to name that ambiguity and pick a convention). Pick the suit: 4 ways. Given a suit, pick 5 of its 13 cards: (135)=1,287\binom{13}{5} = 1{,}287 ways. So the count of same-suit hands is

4×(135)=4×1,287=5,148.4 \times \binom{13}{5} = 4 \times 1{,}287 = 5{,}148 .

The probability of any five-card hand being a flush (including straight flushes) is 5,148/2,598,9600.198%5{,}148 / 2{,}598{,}960 \approx 0.198\% — about 1 in 505 hands. This is the general pattern: break the hand into independent choices (suit, then ranks within that suit), count each choice with a combination, and multiply.

Worked example 2: counting one pair

"Exactly one pair" (two cards of one rank, three cards of three different other ranks, no further coincidences) needs more care because you must avoid double-counting and avoid accidentally including three-of-a-kind or two-pair hands. Break it into steps: choose the paired rank, (131)=13\binom{13}{1} = 13 ways; choose 2 of the 4 suits for that rank, (42)=6\binom{4}{2} = 6 ways; choose the 3 other (distinct) ranks from the remaining 12, (123)=220\binom{12}{3} = 220 ways; choose 1 suit out of 4 for each of those 3 cards independently, 43=644^3 = 64 ways. Multiply:

13×6×220×64=1,098,240.13 \times 6 \times 220 \times 64 = 1{,}098{,}240 .

That's about 1,098,240/2,598,96042.3%1{,}098{,}240 / 2{,}598{,}960 \approx 42.3\% of all hands — one pair is by far the most common non-trivial hand, which matches poker intuition. The technique — decompose into a sequence of independent choose-steps, multiply the counts, and only then divide by the total — generalizes to every "count hands with property XX" question you'll be asked.

42.3% one pair 0.198% flush
The two counted outcomes side by side: one pair covers 42.3% of all hands, while a flush is over 200x rarer at roughly 0.2% — both computed with the same choose-and-multiply recipe.

Poker hand-counting is always the same recipe: decompose the hand into a sequence of independent selection steps (which ranks, which suits), count each step with (nk)\binom{n}{k} or a simple product, multiply the steps together, then divide by (525)=2,598,960\binom{52}{5} = 2{,}598{,}960 for the probability. Never try to enumerate hands directly.

The most common error is double-counting or under-counting because a decomposition accidentally treats two different selection orders as different outcomes, or forgets that "exactly one pair" must exclude ranks that would create a second pair or a three-of-a-kind. Before multiplying, sanity-check by asking whether your decomposition could produce the same final hand through two different paths — if so, you're overcounting.

Related concepts

Practice in interviews

Further reading

  • Ross, A First Course in Probability, ch. 1
ShareTwitterLinkedIn