Hypergeometric Distribution: Formula, Examples & Practice

5 fully solved examples and 3 practice problems on sampling without replacement

What is the Hypergeometric Distribution?

The hypergeometric distribution models random sampling without replacement from a finite population that contains exactly two groups (conventionally called "successes" and "failures"). Because each draw removes an item, the probability of success changes from draw to draw — this is the key difference from the binomial distribution, which assumes independence and constant \(p\).

Note on terminology. "Success" and "failure" are just labels, not value judgments. In a quality-control problem, for example, it may be convenient to treat "defective" as the "success" group when the question is about the number of defectives drawn — as in Example 2 below.

Hypergeometric Formulas

Hypergeometric distribution formulas
Formula Expression
Combinations \( \dbinom{M}{m} = \dfrac{M!}{m!\,(M-m)!} \)
Hypergeometric probability \( P(X = x) = \dfrac{\dbinom{R}{x}\,\dbinom{N-R}{n-x}}{\dbinom{N}{n}} \)

Variable Breakdown

Why this formula? The numerator counts the ways to choose \(x\) successes from the \(R\) available and \(n-x\) failures from the \(N-R\) available. The denominator counts all possible ways to choose \(n\) items from \(N\). Every sample of size \(n\) is equally likely, so the probability is (favorable samples) / (all samples).

Diagram illustrating the two-group selection: x successes drawn from R available, and n−x failures drawn from N−R available, out of all C(N,n) possible samples
Figure 1 — The hypergeometric sampling process.

Solved Hypergeometric Examples

Example 1 — Colored balls

Four balls are randomly selected from a box containing 5 red and 3 white balls.

  1. Find the probability of selecting an equal number of red and white balls.
  2. Find the probability of selecting at least 2 red balls.
View solution

\( N = 8 \), \( R = 5 \) (red = success), \( N-R = 3 \), \( n = 4 \).

(a) Equal numbers of red and white. With \(n = 4\) and equal counts, we need \(x = 2\) reds and 2 whites:

\[ P(X = 2) = \frac{\binom{5}{2}\binom{3}{2}}{\binom{8}{4}} = \frac{10 \times 3}{70} = \frac{30}{70} = \frac{3}{7} \]

(b) At least 2 red. Sum \(P(X=2) + P(X=3) + P(X=4)\):

\[ P(X \ge 2) = \frac{10 \times 3}{70} + \frac{10 \times 3}{70} + \frac{5 \times 1}{70} = \frac{30 + 30 + 5}{70} = \frac{65}{70} = \frac{13}{14} \]

Example 2 — Quality control (with an inverse problem)

An inspector randomly selects 4 tools from a batch of 15, where 2 are known to be defective.

  1. Probability of selecting exactly one defective tool.
  2. Probability of selecting no defective tools.
  3. How many additional non-defective tools must be added to the batch so that P(no defectives) rises to exactly 0.70?
View solution

\( N = 15 \), \( R = 2 \) defectives (our "success"), \( N-R = 13 \) non-defectives, \( n = 4 \).

(a) Exactly one defective.

\[ P(X = 1) = \frac{\binom{2}{1}\binom{13}{3}}{\binom{15}{4}} = \frac{2 \times 286}{1365} = \frac{572}{1365} \approx 0.41905 \]

(b) No defectives.

\[ P(X = 0) = \frac{\binom{2}{0}\binom{13}{4}}{\binom{15}{4}} = \frac{1 \times 715}{1365} = \frac{715}{1365} \approx 0.52381 \]

(c) Inverse problem. Let \(y\) = additional non-defective tools. New \(N = 15 + y\), new \(R = 2\) (still defective), new non-defective \(= 13 + y\). We want \(P(X=0) = 0.70\):

\[ \frac{\binom{13+y}{4}\binom{2}{0}}{\binom{15+y}{4}} = 0.70 \]

Expand the binomial coefficients and cancel \((13+y)(12+y)\) from numerator and denominator:

\[ \frac{(11+y)(10+y)}{(15+y)(14+y)} = 0.70 \]

Expand and collect:

\[ 110 + 21y + y^2 = 0.70(210 + 29y + y^2) \] \[ 0.30y^2 + 0.70y - 37 = 0 \]

By the quadratic formula, the positive root is \( y = 10 \).

Check: with \(y = 10\), \( \frac{\binom{23}{4}}{\binom{25}{4}} = \frac{8855}{12650} = 0.70 \) exactly. ✓

Answer: 10 non-defective tools must be added.

Example 3 — Committee selection

A 6-person committee is randomly selected from 4 men and 8 women.

  1. Probability of equal gender representation.
  2. Probability of at most 3 men on the committee.
View solution

\( N = 12 \), \( R = 4 \) (men = success), \( N-R = 8 \), \( n = 6 \).

(a) Equal representation — 3 men and 3 women:

\[ P(X = 3) = \frac{\binom{4}{3}\binom{8}{3}}{\binom{12}{6}} = \frac{4 \times 56}{924} = \frac{224}{924} = \frac{8}{33} \]

(b) At most 3 men — sum \(P(X=0) + \cdots + P(X=3)\):

\[ P(X \le 3) = \frac{1 \times 28 + 4 \times 56 + 6 \times 70 + 4 \times 56}{924} = \frac{28 + 224 + 420 + 224}{924} = \frac{896}{924} = \frac{32}{33} \]

Example 4 — Multivariate hypergeometric

Six balls are drawn from a container with 6 red, 4 blue, and 5 white balls. Find the probability of drawing exactly 3 red, 2 blue, and 1 white.

View solution

This is a multivariate hypergeometric selection: three groups instead of two. Total balls \(N = 15\); sample size \(n = 6\).

For each group, count the combinations drawn from that group, then divide by the total combinations from all groups:

\[ P(\text{3R, 2B, 1W}) = \frac{\binom{6}{3}\binom{4}{2}\binom{5}{1}}{\binom{15}{6}} = \frac{20 \times 6 \times 5}{5005} = \frac{600}{5005} = \frac{120}{1001} \approx 0.11988 \]

Example 5 — Lottery even numbers

Seven numbers are randomly selected from the integers 1 through 49. For which value of \(x\) is the probability \(P(X = x)\) of drawing \(x\) even numbers maximized?

View solution

Of the integers 1 to 49, exactly 24 are even and 25 are odd. Sample size \(n = 7\), sampled without replacement.

\[ P(X = x) = \frac{\binom{24}{x}\binom{25}{7-x}}{\binom{49}{7}} \]

Here \( \binom{49}{7} = 85{,}900{,}584 \). Computing each:

  • \( P(0) \approx 0.00560 \)
  • \( P(1) \approx 0.04948 \)
  • \( P(2) \approx 0.17071 \)
  • \( P(3) \approx 0.29806 \) — maximum
  • \( P(4) \approx 0.28451 \)
  • \( P(5) \approx 0.14844 \)
  • \( P(6) \approx 0.03917 \)
  • \( P(7) \approx 0.00403 \)

The sum of these eight probabilities is \(1.00000\) ✓, and the maximum occurs at \(x = 3\).

Bar chart of the hypergeometric probabilities for x = 0 through 7, peaking at x = 3 with P ≈ 0.30
Figure 2 — Hypergeometric PMF for the lottery example, peaking at \(x = 3\).

Practice Problems

Practice 1 — Cards from a deck

Five cards are drawn without replacement from a standard 52-card deck. What is the probability of drawing exactly 3 hearts?

Answer

\( N = 52 \), \( R = 13 \) (hearts), \( n = 5 \), \( x = 3 \).

\[ P(X = 3) = \frac{\binom{13}{3}\binom{39}{2}}{\binom{52}{5}} = \frac{286 \times 741}{2{,}598{,}960} = \frac{211{,}926}{2{,}598{,}960} \approx 0.08154 \]

Practice 2 — Quality control with "at least"

A shipment of 20 devices contains 3 defective units. If 5 devices are randomly selected, what is the probability of finding at least one defective?

Answer

Use the complement of \(P(\text{no defectives})\):

\[ P(\text{at least 1}) = 1 - \frac{\binom{3}{0}\binom{17}{5}}{\binom{20}{5}} = 1 - \frac{6188}{15504} = 1 - 0.3991 \approx 0.6009 \]

Practice 3 — Mean and variance

For the setup in Example 1 (\(N = 8\), \(R = 5\), \(n = 4\)), compute the mean and variance of \(X\) directly from the distribution.

Answer

Use the formulas:

\[ \mu = n \cdot \frac{R}{N} = 4 \cdot \frac{5}{8} = 2.5 \] \[ \sigma^2 = n \cdot \frac{R}{N} \cdot \frac{N-R}{N} \cdot \frac{N-n}{N-1} = 4 \cdot \frac{5}{8} \cdot \frac{3}{8} \cdot \frac{4}{7} = \frac{4 \cdot 15 \cdot 4}{8 \cdot 8 \cdot 7} = \frac{240}{448} = \frac{15}{28} \approx 0.536 \]

The factor \(\frac{N-n}{N-1} = \frac{4}{7}\) is the finite-population correction — it makes \(\sigma^2\) smaller than the corresponding binomial variance \(n \cdot p \cdot (1-p) = 4 \cdot \frac{5}{8} \cdot \frac{3}{8} = \frac{15}{16} \approx 0.9375\).

Frequently Asked Questions

What is the hypergeometric distribution?

It models the number of successes in a sample of size \(n\) drawn without replacement from a finite population of size \(N\) containing \(R\) successes. Its PMF is \(P(X = x) = \dfrac{\binom{R}{x}\binom{N-R}{n-x}}{\binom{N}{n}}\).

How is the hypergeometric distribution different from the binomial distribution?

The binomial assumes independent trials with constant success probability — meaning sampling with replacement (or from an effectively infinite population). The hypergeometric handles sampling without replacement from a finite population, where each draw changes the population composition and therefore the probabilities of subsequent draws.

When can I approximate the hypergeometric distribution with a binomial?

When the sample size \(n\) is small relative to the population \(N\) — often stated as \(n \le 0.05N\). Then the finite-population correction factor \((N-n)/(N-1)\) is close to 1, and the hypergeometric is well approximated by a binomial with \(p = R/N\).

What are the mean and variance of a hypergeometric random variable?

Mean: \(\mu = n \cdot R/N\). Variance: \(\sigma^2 = n \cdot (R/N) \cdot (N-R)/N \cdot (N-n)/(N-1)\). The factor \((N-n)/(N-1)\) is the finite-population correction — it makes the hypergeometric variance smaller than the corresponding binomial variance.

Related Probability & Statistics Topics

Last updated: October 20, 2026