Hypergeometric Distribution Calculator
The hypergeometric distribution gives the probability of drawing a certain number of successes from a finite population when you sample without replacement, the situation in card games, lotteries, and quality inspection. This calculator computes the exact probability of exactly k successes, the cumulative probability of k or fewer, and the distribution's mean and variance, all from four inputs: the population size, the number of successes in it, the sample size, and your target k. Every result comes from the exact combinatorial formula, computed with logarithms for numerical stability.
Hypergeometric formula
P(X = k) = C(K, k) * C(N - K, n - k) / C(N, n)
P(X ≤ k) = sum of P(X = i) for i = 0 to k
Mean = n * K / N
Variance = n * (K/N) * ((N-K)/N) * ((N-n)/(N-1))
Here C(a, b) is the number of combinations of b items from a. The exact probability multiplies the ways to pick k successes and n minus k failures, divided by the ways to pick the whole sample. The final variance term is the finite population correction.
Hypergeometric context
- It applies to sampling without replacement from a finite population.
- The probability of success changes as items are drawn, unlike the binomial.
- Common uses include card hands, lottery odds, and batch quality inspection.
- k must be between max(0, n + K - N) and min(n, K) to be possible.
- As the population grows large relative to the sample, it approaches the binomial.
Hypergeometric distribution: frequently asked questions
What is the hypergeometric distribution?
It models the number of successes in a sample drawn without replacement from a finite population that contains a fixed number of successes. Unlike the binomial distribution, the probability of success changes as items are drawn, because the population is not replenished.
What is the hypergeometric probability formula?
The probability of exactly k successes is the number of ways to choose k successes from K available, times the ways to choose the remaining n minus k from the N minus K failures, divided by the ways to choose n items from the whole population N. In symbols: C(K,k) times C(N-K,n-k) divided by C(N,n).
When should I use it instead of the binomial distribution?
Use the hypergeometric distribution when you draw without replacement from a small, finite population, such as dealing cards or inspecting a batch. Use the binomial when draws are independent with a constant success probability, which applies to sampling with replacement or very large populations.
What are the mean and variance?
The mean number of successes is n times K divided by N. The variance is n times (K/N) times ((N-K)/N) times ((N-n)/(N-1)). The last term is the finite population correction that distinguishes it from the binomial.
What does the cumulative probability give?
The cumulative probability is the chance of getting k or fewer successes, found by summing the exact probabilities from 0 up to k. It is useful for questions like the probability of at most a certain number of defective items in a sample.
Official sources
- NIST/SEMATECH e-Handbook of Statistical Methods: Discrete distributions.
- NIST Digital Library of Mathematical Functions: Combinatorial functions.
Reviewed by the CalculatorHub team, edited by James Graham, 16 June 2026. See our methodology.