What is the hypergeometric distribution?
The hypergeometric distribution describes the probability of drawing exactly k successes in n draws made without replacement from a finite population of size N that contains K total successes. Unlike the binomial distribution (which assumes replacement and constant probability), the hypergeometric accounts for the fact that each draw changes the composition of the remaining population.
How to use this calculator
Enter four whole numbers: the population size N, the number of successes in the population K, the sample size n, and the number of observed successes k. The calculator returns the exact probability \(P(X=k)\), the cumulative probabilities \(P(X \le k)\) and \(P(X \ge k)\), and the distribution mean and variance.
The formula explained
\(P(X=k)\) equals the number of ways to choose k successes from K, times the ways to choose the remaining n−k items from the N−K failures, divided by the total ways to choose n items from N.
$$P(X = k) = \dfrac{\dbinom{K}{k}\dbinom{N-K}{n-k}}{\dbinom{N}{n}}$$The mean is \(\mu = n\cdot K/N\) and the variance is \(\sigma^{2} = n\cdot(K/N)\cdot((N-K)/N)\cdot((N-n)/(N-1))\), where the last factor is the finite population correction.
$$\begin{gathered} \mu = n\,\dfrac{K}{N} \\[1em] \sigma^{2} = n\,\dfrac{K}{N}\,\dfrac{N-K}{N}\,\dfrac{N-n}{N-1} \end{gathered}$$
Worked example
A standard 52-card deck has K=4 aces. Draw n=5 cards. The probability of exactly k=2 aces is
$$\dfrac{\dbinom{4}{2}\dbinom{48}{3}}{\dbinom{52}{5}} = \dfrac{6\cdot 17296}{2598960} \approx 0.039929$$The expected number of aces is
$$5\cdot\dfrac{4}{52} \approx 0.3846$$FAQ
When should I use hypergeometric instead of binomial? Use hypergeometric when sampling without replacement from a small finite population; use binomial when draws are independent or the population is effectively infinite.
What does \(P(X \ge k)\) mean? It is the probability of getting at least k successes — useful for tail tests such as quality-control acceptance sampling.
Can k be larger than K or n? If k exceeds the smaller of K and n, the probability is 0 because such an outcome is impossible.