Calculator

Hypergeometric Distribution

Calculate PMF, CDF and hypergeometric quantiles for sampling without replacement.

Settings

Calculator focused on this distribution.

Result and visualization

Calculate PDF/PMF, CDF and percentiles instantly.

Result pending…

Explanation

The hypergeometric distribution models the number of successes in a sample drawn without replacement from a finite population. Unlike the binomial, which assumes sampling with replacement (constant probability on each trial), the hypergeometric accounts for the fact that each draw changes the composition of the remaining group, which makes the trials dependent. When the population is much larger than the sample (N ≫ n), the hypergeometric is well approximated by the binomial with p = K/N. Its mean is n·K/N and its variance is n·(K/N)·(1 − K/N)·(N − n)/(N − 1), where the factor (N − n)/(N − 1) is the finite population correction that reduces the variance relative to the binomial.

Formula

\( P(X=x)=\frac{\binom{K}{x}\binom{N-K}{n-x}}{\binom{N}{n}} \)

Parameters

  • N: total size of the population (positive integer).
  • K: number of elements of interest (successes) in the population. Must satisfy 0 ≤ K ≤ N.
  • n: size of the sample drawn without replacement. Must satisfy 0 ≤ n ≤ N.

Worked example

Situation: A quality inspector audits a batch of \(N = 50\) units, of which \(K = 10\) are defective. A sample of \(n = 8\) units is drawn without replacement. Let \(X\) be the number of defective units in the sample; \(X \sim \text{Hypergeometric}(50, 10, 8)\).

Question 1: What is the probability of finding exactly 2 defective units in the sample, \(P(X = 2)\)?

Solution: We apply the hypergeometric probability mass function: \[ P(X = 2) = \frac{\binom{K}{k}\binom{N-K}{n-k}}{\binom{N}{n}} = \frac{\binom{10}{2}\binom{40}{6}}{\binom{50}{8}} \] Computing each factor: \(\binom{10}{2} = 45\), \(\binom{40}{6} = 3,838,380\), \(\binom{50}{8} = 536,878,650\): \[ P(X = 2) = \frac{45 \times 3,838,380}{536,878,650} \approx \frac{172,727,100}{536,878,650} \approx 0.3217 \] There is approximately a 32.17% probability of finding exactly 2 defective units.

Question 2: What is the expected number of defective units in the sample, \(E[X]\)?

Solution: The mean of the hypergeometric distribution is: \[ E[X] = n \cdot \frac{K}{N} = 8 \times \frac{10}{50} = 8 \times 0.2 = 1.6 \text{ units} \] On average, 1.6 defective units are expected in each sample of 8.

Interpretation: Unlike the binomial (sampling with replacement), the hypergeometric reflects that each draw changes the remaining proportions. With only 20% defective units in the batch (\(K/N = 0.2\)), the most likely value in the sample is 1 or 2 defective units, and the probability of finding 4 or more is very low, which makes it possible to design efficient acceptance sampling plans.

How to interpret the result

The calculator provides three types of output. The PMF, \( P(X = k) \), gives the probability of drawing exactly \( k \) elements of the class of interest in a sample of size \( n \) taken without replacement from a population of size \( N \) with \( K \) elements of that class. Unlike the binomial, the hypergeometric distribution has bounded support: \( k \) can only take values between \( \max(0, n+K-N) \) and \( \min(n, K) \). In the chart, the vertical bars show the probability of each possible count within that range; the horizontal axis reflects exactly the feasible values.

The CDF, \( P(X \leq k) \), accumulates the probabilities from the minimum up to \( k \). In quality control, if a batch contains \( K \) defective units out of \( N \) total and a sample of \( n \) is inspected, then \( P(X \leq c) \) is the probability of accepting the batch with an acceptance sampling plan with acceptance number \( c \). The right tail \( P(X > k) \) measures the probability of detecting more than \( k \) defects, which can be used as a batch rejection criterion. The green area in the chart visualizes the cumulative probability of the selected range.

The percentile result returns the smallest integer \( k \) such that \( P(X \leq k) \geq p \). This makes it possible to design sampling plans: if you want to guarantee with 90% probability that you will not find more than \( k \) defects in a batch with a given defect rate, the 90th percentile gives you that cutoff value directly. It is also useful for assessing how unusual observations are in audits and epidemiological studies with small finite populations.

Frequently asked questions

  • How does it differ from the binomial? Sampling is done without replacement from a finite population: each draw changes the remaining composition, so trials are not independent and p is not constant.
  • What do its parameters mean? N is the population size, K the number of “success” items in the population, and n the sample size drawn. The variable counts how many successes appear in the sample.
  • When can I approximate it with a binomial? When the sample is small relative to the population (rule of thumb, n/N < 0.1): drawing without replacement then barely changes the proportions and a binomial with p = K/N gives almost identical results.

Reference: Hypergeometric distribution — Wikipedia