library(dplyr) library(ggplot2) library(plotly)
2025-02-09
library(dplyr) library(ggplot2) library(plotly)
A poker deck has 52 cards, composed of 13 different values or “ranks” ranging from 1-10, J, Q, K, A, and 4 “suits” of Hearts, Clubs, Diamonds, and Spades.
A poker hand involves a combination of 5 cards out of the deck of 52. Choosing 5 out of 52 = 52 choose 5, or the Binomial Coefficient:
\(\text{Total Hands} = \binom{52}{5} = \frac{52!}{5!(52-5)!}\)
choose(52, 5)
## [1] 2598960
There are 2,598,960 total possible 5-card poker hands, and we can use this number to calculate the probability of making a specific type of hand.
Since there are only 4 suits, there are only 4 possible versions of the royal flush.
\(P(\text{Royal Flush}) = \frac{4}{\text{Total 5-card hands}} = \frac{4}{2598960} = 0.00000153907\)
There is a 0.000154% chance of hitting a royal flush.
A straight can be any 5 cards in sequence of the same suit, since there are 13 ranks, we can go from A-5, all the way to 10-A. That is 10 possible - 1 for excluding the royal flush, multiplied by 4 suits.
\(P(\text{Straight Flush}) = \frac{\text{4-suits x 9 sequence}}{\text{Total 5-card hands}} = \frac{36}{2598960} = 0.00013853613\)
There is a 0.00139% chance of hitting a straight flush.
A 4 of a kind requires 4 cards of the same number or rank, 1 of each suit, and 1 additional non-impact card. We choose 1 rank of the 13, and all 4 suits. The 5th card is choosing 1 rank of the remaining 12, and all 4 suits. Using binomial coefficients and combinations:
\(\text{P(4 of a Kind)} = \frac{\binom{13}{1}\binom{4}{4}\binom{12}{1}\binom{4}{4}}{\text{Total hands}} = \frac{624}{2598960} = 0.00024009603\)
There is a 0.02401% chance of hitting 4 of a kind.
For a full house, we choose 3 cards of the same rank, 3 different suits, and 2 cards of a different rank, 2 different suits. Using binomial coefficients and combinations:
\(\text{P(Full House)} = \frac{\binom{13}{1}\binom{4}{3}\binom{12}{1}\binom{4}{2}}{\text{Total hands}} = \frac{3744}{2598960} = 0.00144057623\)
There is a 0.1441% chance of hitting a full house.
For simplicity’s sake I will list the other hand probabilities so that we may play with the data.
hands_probability <- data.frame(
hand = c("Royal Flush", "Straight Flush", "4 of a Kind",
"Full House", "Flush", "Straight", "3 of a Kind", "2 Pairs",
"1 Pair", "High Card"),
probability = c(0.000153907, 0.013853613, 0.024009603, 0.144057623,
0.1965, 0.3925, 2.1128, 4.7539, 42.2569, 50.177)
)
This is a simple graph displaying hand strengh with respect to how many out of the 2,598,960 total possible hands it can beat.
We can see that most of the 5 card hands are of relatively similar strength. For example, out of the 2,598,960 possible hands, the strongest hand: a Royal Flush, beats 2,598,956 hands. However, the next strongest hand: a Straight Flush, beats 2,598,920 hands. This is reflective of the low probability of making these hands, but it also explains the mechanics of poker. Players are operating within razor thin margins of percentages. When a player makes a hand, they have to discern whether or not another hand is likely to beat them, based on opponent behavior. This is of course complicated by each hand other than the Royal Flush having its own hierarchy within it. For example, a straight that goes from 5 to 9 will beat a straight that goes from 2 to 6.