Hypergeometric Distribution Calculator
Exactly, at most, at least, or between: hypergeometric probabilities when draws come without replacement.
What it does
Draw cards, pull parts from a bin, or snag candy from a dish and the odds change with every pick because the item is gone. The hypergeometric distribution models exactly that: k successes in n draws from a finite population of N items that holds K successes.
It is the no replacement cousin of the binomial. Flip coins or roll dice and the binomial applies; deal cards or inspect a shipment without putting pieces back and the hypergeometric is the right tool.
The calculator answers four question shapes from one setup: exactly k, at most k, at least k, and between k and k2. Every mode also reports the mean and standard deviation of the draw count, so you see the expected spread, not just one slice.
Classic uses run from poker odds to quality control lot sampling to audit work, anywhere a small sample comes from a countable pool.
How to use
- Enter the population size N, the number of successes K inside it, and the number of draws n.
- Pick the question: exactly, at most, at least, or between.
- Enter k, and for between mode also k2.
- Read the probability as a decimal and a percent.
- Read the mean and standard deviation for the draw count.
- Defaults show 50 items, 10 successes, 5 draws, exactly 2.
Formula
- N
- Population size, all items you draw from.
- K
- Successes present in the population.
- n
- Number of draws taken.
- k
- Successes you ask about in the draws.
- C(a, b)
- Combinations: a things taken b at a time.
k runs only from max(0, n - (N - K)) to min(n, K); counts outside that window have probability zero and the tool reports the valid range. Probabilities are computed with log gamma functions so large populations stay stable. The finite population factor ((N - n) / (N - 1)) is why the spread is tighter than a binomial with the same success rate.
Worked example
Example: 5 draws from 50 items with 10 successes
N 50, K 10, n 5, exactly 2 successes.
- Combinations: C(10, 2) = 45 ways to choose the successes.
- Combinations: C(40, 3) = 9,880 ways to fill the other 3 draws from the 40 non successes.
- Favorable deals: 45 x 9,880 = 444,600.
- Total deals: C(50, 5) = 2,118,760.
- Probability: 444,600 / 2,118,760 = 0.2098, shown as 20.98 %.
- Mean 5 x 10 / 50 = 1 and SD 0.8571. Tool shows 0.2098 (20.98 %), 1, 0.8571.
Reference table
| Question | Probability | Percent |
|---|---|---|
| Exactly 2 | 0.2098 | 20.98 % |
| At most 1 | 0.7419 | 74.19 % |
| At least 1 | 0.6894 | 68.94 % |
| Between 1 and 2 | 0.6412 | 64.12 % |
Limits
- Draws are without replacement; independent trials belong to the binomial distribution.
- Counts are whole numbers, and k must fall inside the achievable range.
- The population must be finite and known, up to 1,000,000 items here.
- It counts one category; more than two groups need the multivariate version.
Common mistakes
- Using it for coin flips or dice, where draws are independent and the binomial applies.
- Swapping K, successes in the population, with k, successes in the draws.
- Asking for an impossible count and reading the error as a zero probability.
- Expecting the mean to equal K; the mean of the count is n x K / N.
- Forgetting that k2 must be at or above k in between mode.
Try it yourself
Quick checks. Answers sit tucked under each question.
Five cards from a 52 card deck: probability of exactly 1 ace?
0.2995, about 29.95 %. C(4, 1) x C(48, 4) / C(52, 5) = 778,320 / 2,598,960.
20 parts, 5 defective, 4 drawn: probability of at least 1 defective?
0.7183, about 71.83 %, the complement of zero defectives at 0.2817.
50 items, 10 successes, 5 draws: P(0) plus P(1)?
0.3106 + 0.4313 = 0.7419, which matches the at most 1 figure.
Questions
What is the hypergeometric distribution?
The distribution of successes in draws from a finite pool without replacement. Each pick changes the composition, unlike independent trials.
How is it different from the binomial?
The binomial assumes every trial has the same success probability; the hypergeometric removes the drawn items, so the odds shift each time. Binomial is the large pool limit.
What do the mean and SD mean here?
They describe the expected number of successes, n x K / N, and how widely the count scatters around it, tightened by the finite population factor.
Can I use it for lottery odds?
Yes for match count style questions. Lottery drawings are the same combination math with a different set of winning requirements.
Why is my k rejected?
Impossible counts, like drawing 9 reds from a pool holding 8, fall outside the valid window; the tool explains the range instead of returning zero.
Does it work for huge populations?
Yes, within the 1,000,000 item cap. Probabilities are computed on a log scale, so huge factorials do not overflow.
Sources
- NIST Dataplot: Hypergeometric Percent Point Function (PDF)
- OpenStax: Introductory Statistics 2e, Hypergeometric Distribution
- Wolfram MathWorld: Hypergeometric Distribution