﻿ Poker Odds

# Poker Odds

Every now and then I like to play a game of poker.

Hands, in poker, are ranked according to the basic chances of them occurring. Those hands that would randomly occur with a lower frequency rank higher than those that are more likely to occur. In the most vanilla form of poker, five cards are dealt to make a hand. The hand rankings for five card poker are shown in the table below.

 A standard deck of playing cards contains 52 cards, and these can be arranged to make a total of 2,598,960 distinct sets of five cards. Mathematicians often write this number as 52C5 (spoken as “52 choose 5”). It's a measure of the ways that five cards can be selected from 52 cards without replacement, and not worrying about their order.

The calculation of these choices (also called combinations) are the number of ways that k items can be picked from a set of n items in an unordered way. It can be calculated using the following formula:

### Five Card Poker

HandFrequency
Straight Flush40
Four of a kind624
Full House3,744
Flush5,108
Straight10,200
Three of a kind54,912
Two pair123,552
One pair1,098,240
High card1,302,540
TOTAL2,598,960

If five cards are dealt, to the left is the table of all the ranks and the frequencies of them occuring. The highest ranked hand is the straight flush. In a straight flush, all cards are of the same suit (flush), and they are numerically connected in order (straight). If there is more than one straight flush, the value of the highest card is compared.

Many poker enthusiasts call out the very highest possible Straight Flush: A-K-Q-J-10 and give it the special name of a Royal Flush, but there is no real reason to do this as it's simply a higher version of a regular straight flush.

Even though there are 40 possible straight flushes, there are only four possible royal flushes. One for each suit.

It's a fun exercise to see how we can mathematically derive all the above frequency numbers.

 Straight Flush

For a straight flush, not only do the cards need to be of the same suit, but they all need to be numerically connected. There is only one of each card of each suit. The highest possible straight flush ends with an Ace. The next highest ends with a King, then a Queen, all the way down to the run ending with a five. In poker the Ace can be used either as a high-card, or a low-card (but not both types in the same hand, so it's not possible for a straight to roll over the top).

This means there are ten possible straight flushes in any suit: A-K-Q-J-10, K-Q-J-10-9, Q-J-10-9-8 … 5-4-3-2-A

(The lowest straight is also given the vernacular name of a Wheel).

Ten possible straights in each suit, and four suits, results in 40 possible straight flushes out of the 2,598,960 hands.

Another way to calculate this is to say we have 10C1 × 4C1 (Ten possible choices for the first card, and four possible suits).

 Four of a kind

To get four of a kind we have, as the name implies, four of one kind, then a singleton. As there are only four of any number, this singleton can by any of the other non-used cards.

There are thirteen different cards that can be used for the quads: A,K,Q,J,T … 3,2, this leaves 48 other cards for the singleton. So the number of possible hands is 13 × 48 = 624.

Another way to calculate this is to say we have 13C1 × 48C1 (Thirteen possible choices for the quads card, and forty-eight possible choices for the singleton).

 Full House

In a full house, there are three of one kind of card, and two of another. There are thirteen possible cards that can be used for the triple, leaving twelve possible (different) cards that can be used for the pair. For the triple, as there are three cards, there are 4C3 different combinations of the cards (An easy way to think of this is that this has to be four: If you are selecting three cards, there are four ways, one for each suit that is missing).

After the triple, there are twelve possible cards that can be selected as the pair.

There 4C2 ways the suits of the twelve possible pairs can be arranged.

So the number of full houses possible is: 13C1 × 4C3 × 12C1 × 4C2 = 13 × 4 × 12 × 6 = 3,744.

 Flush

This one gets a little more complicated, but there's a little trick, and we can leverage a previously calculated answer.

For a flush, all the cards are the same suit. Let's pick the suit first. There are 4C1 choices.

There are 13 cards in a suit, and from these, we need to pick any 5, so this would have been 13C5, however if we do this we'll be double counting a straight flush (where all the cards are in numeric order). We have, however, already determined there are forty straight flushes, so all we have to do is subtract this number of straight flushes from all the flushes.

Flushes: (4C1 × 13C5) − 40 = (4 × 1,287) - 40 = 5,108.

 Straight

The calculations for a vanilla straight is a little more complex.

As from above there are ten possible cards that the highest card of the straight can be. This card can be any one of the four possible suits, so as a starting point there are 10 × 4C1 = 40 possible top cards of any straight.

After this card, the numeric value of each subsequent card below is already defined; the only variable is suit, and there are 4C1 ways each next card can be selected. The last step, as above, is to subtract out the number of straight flushes, to stop the double count if all the cards in the straight have the same suit.

Straight: ((10 × 4C1) × 4C1 × 4C1 × 4C1 × 4C1) - 40 = 10 × (4C1)5 - 40 = (10 × 1,024) - 40 = 10,200.

 Three of a kind

Things are getting a little more complex. For three of a kind, we can have any of the thirteen possible numbers for the triple (just like the start of the full house), but for the two remaining cards, not only do they need to be different from the triple, they need to be different from each other (otherwise they set would be a full house). We don't care what the suit of these last two cards are, so there are 4C1 ways for each of these singletons.

Three of a kind: 13C1 × 4C3 × 12C2 × (4C1)2 = 13 × 4 × 66 × 16 = 54,912.

 Two Pairs

For two pairs there are thirteen possible values that each of the pairs could have, and from these we need to select two 13C2. Each of these pairs can be made from two differenent suits 4C2. The singleton can have a value of any of the other unused 11 cards 11C1, and be any one of the suits 4C1

Two Pair: 13C2 × (4C2)2 × 11C1 × 4C1 = 78 × 36 × 11 × 4 = 123,552.

 Pair

To get a hand with a pair there are thirteen possible values for the paired card 13C1, and this can happen in 4C2 suited ways. The remaining three cards can be any suit, and we need to select this card from the remaining 12, so 12C3 cards each one of them 4C1 suits.

Pair: 13C1 × 4C2 × 12C2 × (4C1)3 = 13 × 6 × 220 × 64 = 1,098,240.

 High Card

In theory, we don't need to calculate this value. Paraphrasing Sherlock Holmes; once we've eliminated the impossible, whatever left is the solution. We know the total number of possible sets is 2,598,960 and we've calculated the occurences of all the other possible hand rankings. If we add up all the other ranking hands and subtract this from the total number, we should be left with the number of hands which have nothing but a high card.

However, since we like the challenge (plus it's good verify), here's the calculation.

Because the values of the card have to be distinct (not even a pair), there are 13C5 basic ways these values can be selected. Let's assume, for now, that each of these cards can be any suit.

We're almost home. From this value we subtract away the number of straights, flushes, and straight flushes.

High card: 13C5 × (4C1)5 - 40 - 5,108 - 10,200 = (1,287 × 1,024) - 40 - 5,108 - 10,200 = 1,302,540.

Another way to calculate this value is to start with the 13C5 ways to get five values and from that subtract the 10 we know are the only straights. This gives us the values of the cards. Then we need to look at the suits. Each of the cards can be any the suits, with the exception of the four times when the suits all align and it would be a flush.

Alternative High card calculation (13C5 - 10) × ((4C1)5 - 4) = (1,287 - 10) × (1,024 - 4) = 1,302,540.

Thankfully all our possible hand combinations add up to 2,598,960. Phew!

# Different number of suits?

A standard deck of cards has four suits. Because of this, a full house occurs less frequently than a flush, which in-turn occurs less frequently than a straight. What would happen if there were less suits in a deck, or more suits?

This is an interesting thought exercise. If we had a 'skinny' deck with just three suits (or maybe even two?), then flushes would become much more common. Taken to the limit, if there was just one suit, then every hand would be a flush!* How would the other probabilities change?

An added complication is that, with more than five suits it is possible to get a new hand type: Five of a Kind!

*Or a straight flush!

# Different numbers of values?

 Going the other way, what if cards could have more than 13 different values? The higher the number of cards in a deck, the harder it would be to make straights. If we say that Jack=11, Queen=12, and King=13 how would the probabilities change if there were 15 distinct cards for each of the four suits? How about 20? How about if we combined both these and varied both the number of suits and the range of the cards?

# Generic Solutions

Leveraging what we've learned above it's possible to derive generic formulae for the number of occurences of each of these hands.

If S is the number of suits in a deck, and V is the range of values, then here are the generic formulae for the number of hands:*

 Five of a kind VC1 × SC5 Straight Flush V-3C1 × SC1 Four of a kind VC1 × SC4 × VS-SC1 Full House VC1 × SC3 × V-1C1 × SC2 Flush (VC5 × SC1) - (V-3C1 × SC1) Straight (V-3C1 × SC15) - (V-3C1 × SC1) Three of a kind VC1 × SC3 × V-1C2 × SC12 Two Pair VC2 × SC22 × V-2C1 × SC1 Pair VC1 × SC2 × V-1C3 × SC13 High Card (VC5 - (V-3)) × (SC15 - S)

*The formula for straights is only correct for V ≥ 6 (because we need to take account that the Ace can be used at either end). If V = 5, we need to subtract 4 from the number of choices to pick from, not 3.

## Changing Suits

Below are the how the rankings change if we keep the number of values in a deck fixed at 13 (A,K,Q,J,T,9,8,7,6,5,4,3,2) and vary the number of suits in the deck. For each number of decks I've calculated the number of occurences of that hand, and the cardinal ranking of their strengths.

Suits:123456781632
Five of a kind        131st782nd2732nd7282nd56,7843rd2,617,8883rd
Straight Flush101st201st301st401st502nd601st701st801st1601st3201st
Four of a Kind      6242nd3,9003rd14,0404th38,2204th87,3604th4,542,7204th179,512,3204th
Full House    4682nd3,7443rd15,6005th46,8005th114,6605th244,6085th10,483,2005th383,784,9606th
Flush1,2772nd2,5544th3,8314th5,1084th6,3854th7,6623rd8,9393rd10,2163rd20,4322nd40,8642nd
Straight  3002nd2,4003rd10,2005th31,2006th77,7006th168,0006th327,6006th10,485,6006th335,544,0005th
Three of a kind    7,7225th54,9126th214,5007th617,7607th1,471,4707th3,075,0727th123,002,8807th4,357,816,3207th
Two Pair  1,7163rd23,1666th123,5527th429,0008th1,158,3008th2,648,6468th5,381,3768th197,683,2008th6,754,615,2968th
Pair  22,8805th231,6607th1,098,2408th3,575,0009th9,266,4009th20,600,5809th41,000,9609th1,405,747,20010th46,483,374,08010th
High card  38,3106th306,4808th1,302,5409th3,984,24010th9,922,29010th21,453,60010th41,834,52010th1,339,011,1209th42,848,968,8009th
TOTAL1,287 65,780 575,757 2,598,960 8,259,888 21,111,090 46,504,458 91,962,520 3,091,033,296 101,346,274,848

Here are some takeaways:

• When there is only one suit, all hands are either flushes or straight flushes! The straight flush is the rarest.

• When a deck contains two suits, it's not possible to make four of a kind, three of a kind, or a full house. The straight flush is still the rarest hand, but a straight is less likely than a flush.

• With three suits, all the standard poker hands are possible except four of a kind, but again the ranking of the flush and the straight are reversed.

• With four suits, this is our vanilla deck, and the numbers correspond to those calculated earlier.

• If we add a fifth suit, five of a kind is possible. This becomes the rarest hand, and the flush and the full house switch places.

• With six suits (and beyond), five of a kind relinquishes the position of ranking highest, and this honour returns to the straight flush.

• The rankings don't change from six to seven suits.

• Nor do they change from seven to eight.

• Things don't change again until 10 suits (not shown), when now it becomes more likely to have a pair than just a high card.

• By 13 suits (not shown), the flush becomes the second ranking hand.

• After 16 suits, the full house changes from fifth ranking to sixth ranking.

• The rankings don't change from this point onwards.

## Changing Values

What happens if we keep a deck with the standard four suits, but adjust the number of cards in every suit away from the standard 13?

The top table below shows decks with a range of cards up to a standard 13 card per suite deck.

N cards:2345678910111213
Five of a kind
Straight Flush      41st121st161st201st241st281st321st361st401st
Four of a Kind81st241st481st802nd1203rd1683rd2243rd2882nd3602nd4402nd5282nd6242nd
Full House482nd1442nd2882nd4803rd7204th1,0084th1,3444th1,7284th2,1604th2,6404th3,1684th3,7443rd
Flush        121st682nd2042nd4803rd9803rd1,8163rd3,1323rd5,1084th
Straight      1,0204th3,0605th4,0805th5,1005th6,1205th7,1405th8,1605th9,1805th10,2005th
Three of a kind  1923rd7683rd1,9205th3,8407th6,7206th10,7526th16,1286th23,0406th31,6806th42,2406th54,9126th
Two Pair  4324th1,7285th4,3206th8,6408th15,1207th24,1927th36,2887th51,8407th71,2807th95,0407th123,5527th
Pair    1,5364th7,6807th23,0409th53,7609th107,5209th193,5369th322,5609th506,8809th760,3208th1,098,2408th
High card        3,0605th17,3408th52,0208th122,4008th249,9008th463,0808th798,6609th1,302,5409th
TOTAL56 792 4,368 15,504 42,504 98,280 201,376 376,992 658,008 1,086,008 1,712,304 2,598,960

The lower table shows larger decks.

N cards:13141516322564,096
Five of a kind
Straight Flush401st441st481st521st1161st1,0121st16,3721st
Four of a Kind6242nd7282nd8402nd9602nd3,9682nd261,1203rd67,092,4803rd
Full House3,7443rd4,3683rd5,0403rd5,7603rd23,8083rd1,566,7204th402,554,8804th
Flush5,1084th7,9644th11,9644th17,4205th805,3885th35,238,195,2127th38,336,971,972,739,1008th
Straight10,2005th11,2205th12,2405th13,2604th29,5804th258,0602nd4,174,8602nd
Three of a kind54,9126th69,8886th87,3606th107,5206th952,3206th530,595,8405th2,197,412,904,9605th
Two Pair123,5527th157,2487th196,5607th241,9207th2,142,7207th1,193,840,6406th4,944,179,036,1606th
Pair1,098,2408th1,537,5368th2,096,6408th2,795,5208th55,234,5608th268,481,495,0408th17,988,022,040,002,6007th
High card1,302,5409th2,030,8209th3,050,8209th4,442,1009th205,373,9409th8,985,739,779,0609th9,775,927,853,048,470,0009th
TOTAL2,598,960 3,819,816 5,461,512 7,624,512 264,566,400 9,291,185,992,704 9,832,259,989,126,990,000

Here are some takeaways:

• As there are only four suits it's always going to be impossible to make five of a kind.

• Because there are only four suits, if we only have one distinct value for each card, there will be only four cards in the deck, so there is no way to make a five card hand! We need a minimum of two cards per suit to play poker.

• With two numbers for each suit, in your five card hand, you either have four of a kind, or a full house.

• With three values in each suit it's also possible to have three of a kind, or two pairs.

• With four values in each suit it's possible to only have a pair for the first time.

• Once we have five, or more, cards it's possible be able to make straights and straight flushes.

• With five values, it's still not possible to just get a high card, as any five distinct cards in a set of five will always make a straight. Because of this, even though with five cards you can now make a flush, this will be a straight flush because they will be connected.

• With six cards, both a straight flush and non-straight flush are equally likely. It's also possible to get a high card only for the first time.

• With a small number of values, it's much more likely to get a pair than a high card. As the number of cards increases, this changes (changing over at 12).

• With large numbers of cards per suit, high cards dominate. Flushes are also common.

Image: Guts Gaming

## Future Fun?

 If you are bored one afternoon, it might be a fun exercise to dust off a little code to see the sensitivity impact of losing one card in a deck. If you have a deck of cards and your kids have lost one (or the dog has eaten it), how does this change the odds for poker hands? If you know what the missing card is, how does this impact the rankings?

## Wild Cards

If you want to know how the odds change with the additional of wild cards, see my next article.