ML Interview Q Series: Calculating Yarborough Hand Probability Using Combinatorics
Browse all the Probability Interview Questions here.
Question: A bridge hand in which there is no card higher than a nine is called a Yarborough. Specify an appropriate sample space and determine the probability of a Yarborough when you are randomly dealt 13 cards out of a well-shuffled deck of 52 cards.
Short Compact solution
We can consider an ordered or unordered sample space. In an unordered sample space, the total number of equally likely outcomes is the number of ways to choose 13 cards out of 52, that is 52 choose 13. Among these, the favorable outcomes correspond to choosing all 13 cards from the 32 cards that are 9 or below (i.e., no card higher than a nine), which is 32 choose 13. Thus the probability of a Yarborough is:
Numerically, this is approximately 0.000547, which is about 1 in 1827.
Alternatively, if we considered an ordered sample space (i.e., the order in which cards are dealt is relevant), the same probability can be computed using the ratio (52 × 51 × ... × 40) / (32 × 31 × ... × 20), giving the same result of 0.000547.
Comprehensive Explanation
Overview
A Yarborough in bridge is a 13-card hand with no card ranked 10 or higher. That means every card in the hand is one of {2, 3, 4, 5, 6, 7, 8, 9}, and there are 8 ranks × 4 suits = 32 such cards. The problem is to find the probability that all 13 cards in a randomly dealt hand come exclusively from these 32 lower-ranked cards.
Appropriate Sample Space
When determining probabilities of a card hand, we typically define the sample space as all possible 13-card combinations that can be drawn from a standard 52-card deck. This is reflected in 52 choose 13. Each combination (of 13 distinct cards) is equally likely when the deck is well-shuffled.
Number of Favorable Outcomes
The event “Yarborough” requires that all 13 chosen cards are from the 32 lower-ranked cards (9 or below). The number of ways to choose 13 such cards out of these 32 is 32 choose 13.
Probability Calculation (Unordered)
Hence, the probability of dealing a Yarborough is the ratio of these two combinatorial counts:
where:
32 choose 13 is the count of all ways to pick 13 cards from the 32 that are 9 or below.
52 choose 13 is the count of all ways to pick 13 cards from the complete 52-card deck.
Plugging into a calculator (or using a computational approach) yields about 0.000547.
Probability Calculation (Ordered)
If we consider the order of drawing the 13 cards (i.e., an ordered sample space), then:
The total number of ways to pick 13 cards in a specific sequence from 52 is 52 × 51 × ... × 40.
The number of ways to pick 13 cards in a specific sequence such that all are 9 or below is 32 × 31 × ... × 20.
Thus the probability is:
This simplifies to the same value 0.000547, consistent with the unordered approach.
Odds Perspective
Odds against a Yarborough are often quoted. If an event’s probability is p = 0.000547, the corresponding odds against it are roughly (1 - p) / p ≈ 1827 to 1. In other words, you would expect to see about 1827 non-Yarborough hands for each Yarborough hand you do get.
Simulation Example (Optional)
If someone wanted to verify this numerically by simulation, they could write:
import math
import random
def trial(n=10_000_000):
deck = list(range(52)) # Represent cards by indices 0..51
count_yarborough = 0
for _ in range(n):
random.shuffle(deck)
hand = deck[:13]
# Check if all are from {0..31} if we map indices suitably
# or just define a function is_low_card(card_index)
# For simplicity, let's say the "lowest 32" are 0..31
if all(c < 32 for c in hand):
count_yarborough += 1
return count_yarborough / n
estimated_prob = trial(100000) # e.g. 100k trials
print("Estimated Probability of a Yarborough:", estimated_prob)
This Monte Carlo approach will approximate the true probability, given enough trials.
Potential Follow-up Questions
Why is the sample space 52 choose 13?
In a standard dealing situation, the order in which you receive cards does not matter if the problem states “you are dealt 13 cards” without regard to sequence. The sample space is all 13-element subsets from the 52 cards. Thus 52 choose 13 is the natural count of ways to form such subsets.
Could we consider an ordered sample space instead?
Yes. You can interpret dealing 13 cards in sequence (ordered sample space). In that case, the total number of ways to deal 13 cards out of 52 is 52 × 51 × ... × 40, and the favorable ways are 32 × 31 × ... × 20. Dividing the latter by the former yields the same probability as the unordered approach. It is crucial to remain consistent: if the sample space is ordered, then you must count favorable outcomes in an ordered manner as well.
How can we interpret “odds” vs. “probability” in this context?
Probability of an event E is (favorable outcomes) / (total outcomes).
Odds against an event E are the ratio of (unfavorable outcomes) : (favorable outcomes). Numerically, odds can also be seen as (1 - p) / p. For this Yarborough example, the probability is 0.000547, so the odds against it are about 1827 to 1.
Is there a connection to the hypergeometric distribution?
Yes. Dealing cards without replacement is a classic hypergeometric scenario. If we define random variable X as “the number of low cards (9 or below) in a 13-card hand,” then X follows a hypergeometric distribution with parameters: population size = 52, number of “successes” in the population = 32, draw size = 13. The probability of X = 13 (i.e., all 13 are from the 32 “low” cards) is exactly (32 choose 13) / (52 choose 13).
Could real-world factors cause deviations from this probability?
In genuine card games, any irregularity—like imperfect shuffles, bias in how decks are manipulated, or game-specific dealing quirks—could cause small deviations. However, in an ideally random scenario, the calculated probability 0.000547 stands.
Are there ways to handle large numbers or potential floating-point issues?
In practice, direct computation of binomial coefficients can lead to very large integers or floating-point overflow. Libraries (like Python’s math.comb
) handle large binomial coefficients internally with precise integer arithmetic. For extremely large computations, one might use logarithms of factorials or special libraries designed for combinatorics.
Could we use this concept in other Machine Learning or data scenarios?
In general, the principle of combinatorial sampling and hypergeometric probability arises in tasks involving sampling without replacement. Examples include:
Subset selection in active learning.
Reservoir sampling algorithms.
Statistical tests that rely on the hypergeometric distribution (e.g., enrichment analyses in biology).
This question, though purely combinatorial, showcases how understanding probability fundamentals is crucial for data scientists and machine learning engineers—especially for evaluating events, sampling processes, or randomized algorithms.
Below are additional follow-up questions
What if the deck is not standard or has missing cards?
A non-standard deck or one missing some cards changes the cardinalities involved in the combinatorial calculations. For instance, if a deck is missing one or more 9-and-below cards (like an 8 of Hearts), the total number of low cards (32 in a standard deck) will be reduced. Simultaneously, the total number of cards (52 in a standard deck) will also be adjusted. Therefore, we’d need to recalculate both:
The new total of “low” cards, which we can call L.
The new total of all cards in the deck, which we can call D.
In that scenario, the probability of a Yarborough becomes (L choose 13) / (D choose 13). The subtlety is recognizing that even a single missing card can significantly affect the probability if it is one of the low cards. Conversely, if the missing card is a high card (10 or above), the number of favorable cases (32 choose 13) might remain unchanged, but the total possible hands (D choose 13) is lower, slightly increasing the overall probability of a Yarborough. It also introduces edge cases, such as the deck having fewer than 13 low cards total, making a Yarborough impossible in that situation.
How does the probability change if certain suits or ranks are removed?
If the question arises about removing an entire suit or subset of ranks, you must again adjust counts:
Suppose an entire suit is removed. Then instead of having 4 suits × 8 ranks = 32 “low” cards, you might have only 3 suits × 8 ranks = 24 low cards (assuming we removed a complete suit). Additionally, the total deck drops from 52 to 39 cards (if you remove all 13 cards of one suit). In that case, the new probability is (24 choose 13) / (39 choose 13).
If specific ranks are removed (e.g., all 9s are taken out), that changes the definition of “low” cards. Now the “low” set might be ranks 2,3,4,5,6,7,8 across 4 suits, which is 7 ranks × 4 suits = 28 possible “low” cards. You have to be careful about which ranks remain in the deck and how that influences L and D.
These scenarios highlight how crucial it is to define the exact composition of the deck before attempting to do the combinatorial calculation.
What if some cards have been revealed before the deal, and you have partial knowledge?
In many real-world games, some cards might be exposed or known in advance due to a previous round or a misdeal. If you know certain high cards are already out of the deck, the probability of drawing a Yarborough changes. Specifically, you would:
Subtract from the deck any cards that have been revealed (or are otherwise known).
Recalculate both the total number of “low” cards still in the unknown portion of the deck and the total number of remaining unknown cards.
For example, if you see two Kings face up, then you know those two high cards are no longer in the unknown deck. If you are only dealing from the unknown subset, your new deck might have fewer total cards and the same or greater number of low cards relative to the total. This partial information can sometimes increase the probability of a Yarborough (if mostly high cards are exposed and removed from contention) or decrease it (if you see that some low cards are gone).
A pitfall is forgetting to account for the revealed cards. If you keep using 52 choose 13 after some known cards have been exposed, you get an incorrect probability. A thorough approach is always to recompute based on the smaller, revised deck of unknown cards.
What is the expected number of Yarboroughs if multiple players are dealt 13 cards each?
In a typical bridge game, four players each receive 13 cards from the same 52-card deck (assuming standard dealing). One might ask: “Over many deals, how many Yarboroughs do we expect to see in total among all players?”
In each deal:
There are four different 13-card hands.
The probability that any single hand is a Yarborough is 0.000547 (approx).
If we assume independence among the hands (though strictly, they are not fully independent because no two players can share the same card—yet for a small-probability event, we can get a near approximation), we can approximate the expected number of Yarboroughs across all four players.
The approximate expected number E of Yarboroughs per deal among four players is 4 × 0.000547 = 0.002188. In other words, on average, you might see about 1 Yarborough every 457 deals (1 / 0.002188) if you look at all four hands combined.
A subtlety is that hands are negatively correlated (one hand’s low cards reduce the pool of low cards available to the other hands). However, for small probabilities, this correlation can be negligible unless you require very precise estimates.
How do we handle or approximate these probabilities if direct computation of large factorials is problematic?
When we try to compute large binomial coefficients like 52 choose 13 directly via factorials, we face very large intermediate values (52! is extremely large). Even though modern libraries can handle big integer arithmetic, in some computational environments it might be inefficient or cause memory issues. A few strategies help:
Use built-in functions (like Python’s
math.comb
) that compute binomial coefficients efficiently using prime factorization or multiplicative formulas.Use logarithmic calculations. For example, you can compute log( (52 choose 13) ) by summing log(52) + log(51) + ... + log(40 ) minus the sum of log(13) + ... + log(1). Then exponentiate the difference at the end, or keep it in log form if you only need a ratio.
Use cancellation in the ratio ( (32 choose 13) ) / ( (52 choose 13) ) by writing out the multiplicative terms, as we do for the “ordered sample space” method.
A pitfall is ignoring floating-point precision. If you naively compute factorial(52) using floating floats, you can exceed the floating-point limit and lose accuracy. That leads to an incorrect result for the probability. Always leverage stable and precise combinatorial or log-based methods.
How might the probability be altered if dealing is not random or is biased?
A perfect shuffle is assumed in standard probability models. In reality, shuffling might not be perfectly random. Small biases could produce distributions that deviate from the theoretical uniform distribution over the 52 choose 13 combinations. For instance:
A common mechanical or “one-pass” shuffle might cluster certain ranks or suits differently than a thorough random process.
A gambler’s shuffle, if done improperly, might cause certain patterns to persist.
Any systematic bias can shift the probability of a Yarborough away from its theoretical value. It might increase it or decrease it depending on how the shuffle influences the distribution of low vs. high cards. Detecting or measuring this effect would require analyzing large sets of dealt hands and comparing the frequency of Yarboroughs to the expected 0.000547 figure.
Can we track the probability that the highest card in a hand is exactly a 9, or at most a 9?
Sometimes the question expands to: “What is the probability that the highest card in a 13-card hand is at most a 9?” That is effectively the probability of a Yarborough. But one might also ask for the probability that the highest card is exactly a 9, ignoring the possibility of “no card higher than a 9.” Actually, these statements sound the same at first, but you can interpret it as “there is at least one 9 in the hand, and no card of rank 10 or above.” Strictly speaking, a Yarborough can include zero or more 9s, as long as no rank 10 or above is present. So if you want “exactly the highest card = 9,” you are allowing at least one 9 and forbidding 10 or higher.
To adapt the formula:
If you insist that at least one 9 appears, then you can compute the probability by subtracting from (32 choose 13) the ways to choose 13 cards from the 24 that are 8 or below.
Divide that remainder by (52 choose 13) to get the probability that the highest rank in the hand is exactly 9 (i.e., at least one 9 is present, but no 10+).
A frequent pitfall is to forget to exclude the case where there are zero 9s in the hand if you specifically want “highest card is exactly 9.” Realizing these subtle rank-based conditions is important in enumerations.
How would the probability of a Yarborough change if we deal more than 13 cards to a single player?
In bridge, we deal exactly 13 cards to each player. But some variations of card games might give each player a different number of cards (e.g., 5-card poker). The concept of a Yarborough can extend to “a hand with no card above rank 9,” so the combinatorial ratio changes if the hand size is something else. For a hand of size h from a deck of D cards with L “low” cards:
Probability = (L choose h) / (D choose h).
If h gets larger, the probability of having exclusively low cards generally decreases unless L is also proportionally adjusted. So if you had a game with a 10-card hand and still only 32 low cards available out of 52 total, the probability of “no card higher than a nine” would be (32 choose 10) / (52 choose 10). One must always carefully re-evaluate these parameters for different card game formats.
How do we handle the probability that two players simultaneously receive Yarborough hands?
In some improbable scenario, you might ask: “What is the probability that Player A and Player B both get Yarboroughs in the same deal of 26 total cards to two players?” This is a more intricate event because you must account for the ways Player A can get 13 from the 32 low cards and Player B can also get 13 from the 32 low cards, but with no overlap in those 13 + 13 = 26 distinct cards:
The total ways to deal 13 cards to Player A and 13 cards to Player B from 52 is (52 choose 13) × (39 choose 13).
The ways to deal 13 “low” cards to Player A and 13 “low” cards to Player B from the pool of 32 low cards is (32 choose 13) × (19 choose 13).
Then the probability is [ (32 choose 13) × (19 choose 13 ) ] / [ (52 choose 13) × (39 choose 13) ]. The subtlety here is that once Player A’s 13 low cards are chosen, only 19 remain in the “low” pool for Player B. This is a more advanced problem, but it demonstrates how easy it is to over- or undercount if you don’t carefully handle the dependence between two players’ hands.
Could we relate a Yarborough to general “no success above a threshold” events in other statistical domains?
Absolutely. The Yarborough concept is a specialized version of a problem often described as “no success or no item exceeding a certain threshold in a random sample.” If you generalize:
Suppose you have N items in a population, with M “acceptable/low” items (akin to the 32 low cards) and N - M “unacceptable/high” items (the 20 high cards).
You sample k items from the population (like dealing 13 cards).
You want the probability that all k sampled items are from the acceptable subset of size M.
This is simply (M choose k) / (N choose k). Such logic appears in quality-control scenarios, random sampling to detect out-of-spec parts, or even cryptographic contexts where you want “all draws to come from a certain pool.” The main pitfall is failing to see the equivalence and incorrectly applying distributions that assume replacement (like a binomial) instead of the hypergeometric distribution.
Are there any combinatorial identities or advanced approaches that simplify the Yarborough calculation?
Sometimes advanced combinatorial identities can be used to simplify expressions involving large choose functions. For example, the ratio ( (32 choose 13) ) / ( (52 choose 13) ) can be expressed in product form or using gamma functions:
( (32 choose 13) ) = 32! / (13! × 19!) ( (52 choose 13) ) = 52! / (13! × 39!)
So the ratio simplifies to:
(32! × 13! × 39!) / (52! × 13! × 19!) = (32! × 39!) / (52! × 19!).
But that is still huge. Using prime factorization or partial cancellation step by step is more direct:
( (32 choose 13) ) / ( (52 choose 13) ) = (32 × 31 × ... × 20) / (52 × 51 × ... × 40).
A potential pitfall is mis-simplifying or incorrectly canceling factors if one tries to handle everything manually. Using robust built-in functions or carefully structured code avoids these mistakes.