Finding something worth knowing…

Science

Exactly 2,598,960 different poker hands, and how to count them fast

Deal five cards from a standard 52-card deck and the odds of getting any one particular hand are 1 in 2,598,960. Nobody listed them all to find that out. The figure comes from a short piece of arithmetic for counting selections where order does not matter, which mathematicians call combinations.

Start small. From an apple, an orange and a pear you can pick two fruits in three ways: apple with pear, apple with orange, or pear with orange. Picking the apple first or second makes no difference, which is what separates a combination from a permutation, where order counts. Allow doubles, so two apples is a legal choice, and three more selections appear, bringing the total to six.

For the poker hand, first count ordered draws. The first card can be any of 52, the next any of 51 remaining, then 50, 49 and 48, giving 311,875,200 ordered sequences. But any five cards can be arranged in 5 × 4 × 3 × 2 × 1 = 120 orders, and all of them make the same hand. Dividing 311,875,200 by 120 gives 2,598,960. Cancelling common factors first shrinks the job to multiplying 26, 17, 10, 49 and 12.

The general count, written n choose k, is known as the binomial coefficient because the same numbers appear when (1 + X) is raised to a power and multiplied out. Each entry equals the sum of two entries from the row above, which builds Pascal's triangle row by row. The numbers are also symmetrical: choosing which five cards to keep is the same as choosing which 47 to leave behind, so 52 choose 5 equals 52 choose 47.

Every subset of a set with n members turns up exactly once when all these counts are added, so the whole row sums to 2 multiplied by itself n times. The compact factorial formula is the easiest to remember, though it forces extra multiplication, which makes it slower to compute than the version that cancels as it goes.

Source: Combination

Related

More in Science · All topics