Hypergeometric Distribution Calculator
Calculate exact and cumulative hypergeometric probabilities for sampling without replacement. Enter the population size, number of successes, draws, and desired successes.
Compute Hypergeometric Probabilities
Hypergeometric Distribution Formula
Where:
- \(N\) — population size (total number of items)
- \(K\) — number of successes in the population (items with the desired property)
- \(n\) — number of draws (sample size, drawn without replacement)
- \(k\) — desired number of successes in the sample
The formula gives the probability of finding exactly \(k\) successes in a sample of \(n\) items drawn without replacement from a finite population of \(N\) items containing \(K\) successes. The mean and standard deviation are \(E(X) = nK/N\) and \(SD(X) = \sqrt{n \cdot \frac{K}{N} \cdot \left(1 - \frac{K}{N}\right) \cdot \frac{N-n}{N-1}}\).
Hypergeometric Distribution – Calculation Example
Example: a standard deck has 52 cards, 13 of which are hearts. You draw 5 cards and want the probability of getting exactly 2 hearts. So \(N = 52\), \(K = 13\), \(n = 5\), \(k = 2\).
\[ P(X = 2) = \frac{\binom{13}{2}\binom{39}{3}}{\binom{52}{5}} = \frac{78 \times 9139}{2598960} = \frac{712842}{2598960} \approx 0.2743 \]
Result: \(P(X = 2) \approx 0.2743\), or about 27.43% (roughly 1 in 4). The cumulative probability \(P(X \le 2)\) is about 90.72%, the mean is \(E(X) = 1.25\) hearts, and the standard deviation is about 0.93.
How to Use the Calculator
- Enter the Population size \(N\) — the total number of items you are drawing from.
- Enter the Successes in population \(K\) — how many of those items have the property you care about.
- Enter the Draws (sample size) \(n\) — how many items you draw without replacement.
- Enter the Desired successes \(k\) — the number of successes you want in your sample.
- Read the results: the exact probability \(P(X = k)\), the cumulative probabilities \(P(X \le k)\), \(P(X k)\) (all in percent), plus the mean, standard deviation, the formula with your values substituted, and a plain-language interpretation.
What Is the Hypergeometric Distribution?
The hypergeometric distribution describes the number of successes you get when drawing a fixed number of items without replacement from a finite population. It is the correct model whenever each draw changes the composition of what remains — dealing cards from a deck, picking parts from a batch for quality inspection, selecting people for a survey from a small group, or drawing lottery numbers.
Its closest relative is the binomial distribution, which applies when items are drawn with replacement (or from an effectively infinite population), so every trial has the same probability of success. With the hypergeometric distribution, each success you remove lowers the success rate for the remaining draws, which is exactly what happens with a real deck of cards or a finite batch of products. If the sample is small compared to the population (say, under 5–10%), the two distributions give nearly identical answers.
The calculator reports the probability of every outcome at once, which is often more useful than the exact value alone. For example, a quality inspector may need \(P(X \ge k)\) — the chance of finding at least a certain number of defective items — while a card player may want \(P(X \le k)\), the chance of drawing at most a few key cards. The mean \(E(X) = nK/N\) tells you the expected number of successes in an average sample; it is simply the sample size times the population success rate.
The shape of the distribution depends on the parameters: it can be symmetric, skewed toward few successes, or skewed toward many. The possible values of \(X\) are also bounded — you cannot draw more successes than exist in the population or more items than you draw, so the number of successes is limited to the range \([\max(0, n-(N-K)), \; \min(n, K)]\). The calculator automatically returns a probability of zero if your \(k\) falls outside this range.
Assumptions, Limitations and Tips
- Sampling without replacement: the model assumes drawn items are not returned to the population. If items are replaced after each draw, use the Binomial Distribution Calculator instead.
- Fixed sample size: the number of draws \(n\) must be decided in advance and stay fixed. If you count events occurring randomly over a fixed interval of time or space, the Poisson Distribution Calculator is the better tool.
- Equally likely samples: every possible subset of \(n\) items must have the same chance of being drawn. If some items are more likely to be selected, the hypergeometric model does not apply.
- Whole numbers only: \(N\), \(K\), \(n\) and \(k\) must be integers, with \(1 \le N \le 1{,}000{,}000\), \(0 \le K \le N\), \(0 \le n \le N\), and \(0 \le k \le n\).
- Large populations: when \(n\) is small relative to \(N\), the hypergeometric distribution is well approximated by the binomial (or, for large counts, by the normal distribution), but this calculator gives the exact result with no approximation needed.
- Check the binomial coefficients: the substituted formula uses \(\binom{a}{b}\) notation. You can verify these values with the Permutations & Combinations Calculator.
- Interpreting zero probability: a result of 0% usually means your \(k\) is impossible — for instance, asking for 3 successes when the population contains only 2 success items.
Frequently Asked Questions
How do I calculate a hypergeometric probability by hand?
Count the ways to choose your desired successes from the success items \(\binom{K}{k}\), multiply by the ways to choose the remaining draws from the non-success items \(\binom{N-K}{n-k}\), and divide by the total number of possible samples \(\binom{N}{n}\). For small numbers, factorials work: \(\binom{a}{b} = \frac{a!}{b!(a-b)!}\). For anything larger, use the calculator to avoid arithmetic errors with huge factorials.
How do I get the probability of at least or at most k successes?
The calculator reports all four cumulative probabilities directly. At least k is \(P(X \ge k)\); at most k is \(P(X \le k)\). By hand, you would sum the exact probabilities of every outcome in that range, e.g. \(P(X \ge 3) = P(X=3) + P(X=4) + \dots\), which gets tedious quickly — that is exactly what the cumulative outputs do for you.
Why did I get a probability of exactly 0?
A zero result almost always means the requested number of successes is impossible. The sample cannot contain more successes than exist in the population (\(k \le K\)), more successes than draws (\(k \le n\)), or fewer successes than are forced into the sample when almost all remaining items are successes. The substituted-formula output shows the valid range for your parameters, and any \(k\) outside it is genuinely 0%.
What's the difference between P(X = k) and P(X ≤ k)?
\(P(X = k)\) is the probability of hitting that exact number of successes — for example, exactly 2 hearts in 5 cards. \(P(X \le k)\) is the probability of that number or fewer — 0, 1, or 2 hearts. The cumulative value is always larger. Be careful which one your problem asks for: "at most 2" means \(P(X \le 2)\), while "exactly 2" means \(P(X = 2)\).
Can I use this calculator for lottery odds?
Yes — lotteries are a classic hypergeometric setup: balls are drawn without replacement from a finite pool. Set \(N\) to the total number of balls, \(K\) to how many you matched on your ticket, \(n\) to the balls drawn, and \(k\) to the matches you want. For example, "6 of 49" games need \(N = 49\), \(K = 6\), \(n = 6\), \(k = 6\) for the jackpot odds.
What are the most common mistakes when entering values?
The biggest one is mixing up the order: \(N\) is the whole population, \(K\) only the items with the desired property, and \(n\) the sample size — not the other way around. Another frequent error is using the hypergeometric model for draws with replacement, which requires the binomial distribution instead. Finally, all four values must be whole numbers; fractions of items or draws are not valid inputs.
What does the mean E(X) = nK/N actually mean?
It is the average number of successes you would expect per sample if you repeated the drawing many times — simply the sample size multiplied by the population success rate. If 20% of a batch of parts are defective and you inspect 10, the mean is 2 defective items. Note that individual samples vary around this value; the standard deviation tells you by how much, and the mean is often not even a whole number or the most likely single outcome.