How to use the hypergeometric calculator
- Enter the population size (N) and how many of those count as successes (K).
- Enter the sample size (n), how many you draw without putting them back.
- Enter k, the number of successes you're asking about, and read the exact, "at most" and "at least" probabilities, plus the mean and a distribution chart.
Hypergeometric formula
C(a, b) = a! รท (b! ร (a โ b)!)
Mean = nK รท N ยท Variance = n (K/N)(1 โ K/N)(N โ n) รท (N โ 1)
Worked examples
| Question | N, K, n, k | Probability |
|---|---|---|
| Exactly 2 aces in a 5-card poker hand | 52, 4, 5, 2 | 0.0399 (about 1 in 25) |
| At least 1 of 4 copies in a 7-card hand from 60 | 60, 4, 7, โฅ1 | 0.3995 (40%) |
| Match exactly 3 in a 6/49 lottery | 49, 6, 6, 3 | 0.0177 (about 1 in 57) |
| Jackpot: match all 6 | 49, 6, 6, 6 | 1 in 13,983,816 |
| 3 red marbles in 5 draws (10 red, 30 blue) | 40, 10, 5, 3 | 0.0793 |
Hypergeometric vs binomial
Both count successes, but the binomial assumes each trial has the same probability (sampling with replacement, or a huge population). In a 52-card deck, once an ace is drawn the chance of another drops from 4/52 to 3/51, which is exactly what the hypergeometric distribution accounts for. When the population is much larger than the sample, the two give nearly identical results, and for large samples both look like a bell curve; see the normal CDF calculator.
Common uses
- Card games and deck building: odds of drawing key cards in an opening hand.
- Lotteries and raffles: the chance of matching some or all numbers.
- Quality control: the chance of finding defective items when inspecting a sample from a batch.
- Ecology and surveys: capture-recapture estimates and sampling from small groups. For estimating proportions from a sample, see the confidence interval calculator.
Need to draw a fair random sample? The random number generator can pick unique numbers without repeats. Probabilities as fractions? Simplify them with the fraction calculator. More math calculators.
Sources
Frequently asked questions
What is the hypergeometric distribution?
It gives the probability of drawing a certain number of successes when you sample without replacement from a finite group, such as dealing cards from a deck or picking lottery numbers. Each draw changes what's left, which is why it differs from the binomial distribution.
What is the hypergeometric formula?
P(X = k) = C(K, k) ร C(N โ K, n โ k) รท C(N, n), where N is the population size, K the number of successes in it, n the sample size and k the successes you want, and C is 'choose'. For exactly 2 aces in a 5-card hand: C(4,2) ร C(48,3) รท C(52,5) = 6 ร 17,296 รท 2,598,960 โ 0.0399.
How do I calculate 'at least one'?
Use the complement: P(X โฅ 1) = 1 โ P(X = 0). With 4 copies of a card in a 60-card deck, the chance of at least one in a 7-card opening hand is 1 โ C(56,7) รท C(60,7) โ 0.3995, about 40%.
When should I use hypergeometric instead of binomial?
Use hypergeometric when sampling without replacement from a small population, where each draw noticeably changes the odds. If the population is very large compared with the sample (say, more than 20 times bigger), the binomial distribution gives almost the same answer.
What are the odds of winning a 6/49 lottery?
Matching all 6 numbers is C(6,6) ร C(43,0) รท C(49,6) = 1 in 13,983,816. Matching exactly 3 is about 1.77%, or roughly 1 in 57.
What are the mean and variance?
Mean = n ร K รท N. Variance = n ร (K/N) ร (1 โ K/N) ร (N โ n) รท (N โ 1). The last factor, the finite population correction, makes the variance smaller than for the binomial.