About the Hypergeometric Distribution Calculator
This hypergeometric distribution calculator gives exact probabilities when you draw a sample without replacement from a finite population that contains a known number of "successes". Enter the population size N, the number of successes in it K, how many items you draw n, and the number of successes you want in the sample k. It returns P(X = k), the cumulative probabilities P(X < k), P(X ≤ k), P(X > k) and P(X ≥ k), and the mean, variance and standard deviation of the number of successes.
Typical uses are card games (the chance of two hearts in a five-card hand, or drawing a combo piece in your opening hand), lotteries, lot acceptance sampling in quality control (how likely a sample of 20 parts contains a defective one), audits, and capture–recapture questions in ecology. A chart and table show the whole distribution so you can see every possible outcome at once.
Unlike the binomial distribution, the hypergeometric accounts for the fact that each draw changes what is left in the population, so it is exact for small populations. Populations up to 100,000 items are supported, computed with log-factorials so large values stay accurate.
With the default inputs, the p(x = k) is 0.27428. Change any value above to recalculate instantly.
How to use the hypergeometric distribution calculator
- 1Enter the population size N (e.g. 52 cards).
- 2Enter how many items in the population count as successes, K (e.g. 13 hearts).
- 3Enter how many items you draw, n.
- 4Enter the number of successes k you are asking about.
- 5Read P(X = k) and the cumulative probabilities, and check the chart for the full distribution.
Formula and method
Count the ways to choose k of the K successes, times the ways to choose the remaining n − k items from the N − K failures, and divide by the total number of equally likely samples of size n, C(N, n). Cumulative probabilities add these terms over every possible k, which runs from max(0, n + K − N) to min(n, K).
The mean equals the binomial mean n·K/N, but the variance is smaller by the finite population correction (N − n)/(N − 1), because sampling without replacement makes extreme outcomes less likely. When N is very large relative to n, the hypergeometric is almost identical to a binomial with p = K/N. Combinations are evaluated with log-factorials to avoid overflow.
- N
- Population size
- K
- Number of successes in the population
- n
- Number of items drawn (sample size)
- k
- Number of successes in the sample
- C(a, b)
- Binomial coefficient, a! ÷ (b!(a − b)!)
Worked examples
Exactly 2 hearts in a 5-card poker hand
C(13,2) × C(39,3) ÷ C(52,5) = 78 × 9,139 ÷ 2,598,960 ≈ 0.2743. The chance of two or more hearts is about 0.3670, and on average a hand holds 5 × 13/52 = 1.25 hearts.
Quality control: at least one defect in a sample of 20 from a lot of 500 with 10 defectives
P(no defects) = C(490,20) ÷ C(500,20) ≈ 0.6623, so the inspector catches at least one defective part only about 33.8% of the time. Exactly one defective in the sample has probability ≈ 0.2812.
Lottery: matching 3 of 6 numbers drawn from 49
Your ticket has 6 "success" numbers among 49. Matching exactly 3 has probability C(6,3) × C(43,3) ÷ C(49,6) = 20 × 12,341 ÷ 13,983,816 ≈ 0.01765, about 1 in 57. Matching 3 or more is about 1 in 54.
Frequently asked questions
When should I use the hypergeometric distribution instead of the binomial?+
Use the hypergeometric when you sample without replacement from a finite population, so each draw changes the odds of the next. The binomial assumes a constant probability on every trial, which is only right with replacement or when the population is far larger than the sample (roughly n < 5% of N).
What do N, K, n and k mean?+
N is the total population size, K is how many of those items are successes, n is how many you draw, and k is how many successes you want in the draw. For a 5-card hand with 2 hearts: N = 52, K = 13, n = 5, k = 2.
What is the mean of a hypergeometric distribution?+
The expected number of successes is n × K ÷ N — the sample size times the proportion of successes in the population. Drawing 5 cards, you expect 5 × 13/52 = 1.25 hearts.
Why is the hypergeometric variance smaller than the binomial variance?+
Because each success you draw removes one from the population, extreme samples are less likely. The variance is the binomial variance multiplied by the finite population correction (N − n)/(N − 1), which shrinks toward zero as the sample approaches the whole population.
How do I find the probability of at least one success?+
Read P(X ≥ k) with k = 1, or compute 1 − P(X = 0). P(X = 0) is C(N − K, n) ÷ C(N, n), the chance that every draw comes from the non-success items.