Hypergeometric Distribution Calculator
Test cases replayed : 3 of 3 match · Methodology · No outside source listed
Enter the population size, the number of successes in it, how many items you draw and a number of successes k, for draws without replacement.
Result
P(X = k)
P(X ≤ k)
- P(X ≥ k)
- Mean (n × K ÷ N)
- Variance
Estimate for planning only, not tax, legal, financial or medical advice. This calculator uses the method explained on this page.
This browser did not allow copying. The sentence is in the box below, already selected: copy it with your keyboard or the menu.
How to use this calculator
Fill in the fields in this order; each step takes you to its field.
- Population size (N): enter 1 or more.
- Successes in the population (K): enter 0 or more.
- Number of draws (n): enter 0 or more.
- Successes in the draws (k): enter 0 or more.
- Read the result: P(X = k); the panel also shows P(X ≤ k), P(X ≥ k), Mean (n × K ÷ N) and Variance.
How this calculator works
Hypergeometric distribution: drawing n items without replacement from N items of which K are successes, P(X = k) = C(K, k) × C(N − K, n − k) ÷ C(N, n), where C is the binomial coefficient.
P(X ≤ k) adds these terms from 0 to k (computed here for k up to 30), and P(X ≥ k) = 1 − P(X ≤ k) + P(X = k). Mean = nK ÷ N; variance = n (K/N)(1 − K/N)(N − n) ÷ (N − 1).
Unlike the binomial distribution, each draw changes the odds of the next, because drawn items are not put back.
The formula
| Symbol | Meaning | Unit |
|---|---|---|
| Population size (N) | ||
| Successes in the population | K | |
| Number of draws | ||
| Successes in the draws | ||
| P(X = k) | ||
ncr(n, k) | the number of ways to choose k items from n, order ignored. |
Worked example
| Population size (N) | 52 |
|---|---|
| Successes in the population (K) | 13 |
| Number of draws (n) | 5 |
| Successes in the draws (k) | 2 |
| P(X ≤ k) | 0.9072 |
|---|---|
| P(X ≥ k) | 0.367 |
| Mean (n × K ÷ N) | 1.25 |
| Variance | 0.864 |
P(X = k) 0.2743
Each step uses the unrounded value of the step before it; figures on this page are rounded for display.
Frequently asked questions
What is the chance of exactly 2 hearts in a 5-card hand?
C(13, 2) × C(39, 3) ÷ C(52, 5) = 78 × 9,139 ÷ 2,598,960 ≈ 0.2743.
When can I use the binomial distribution instead?
When the draws are a small part of the population (a common rule is under 5%), drawing without replacement barely changes the odds and the binomial is a close approximation.