Hypergeometric Distribution

Exact P(X = k), P(X ≤ k) and P(X ≥ k) for sampling without replacement, with mean, variance and a live chart of every outcome.
The probabilities, chart and steps update live.
ResultP(X = k)
385/969≈ 0.397317
P(X = k)
385/969≈ 0.397317
P(X ≤ k)
682/969≈ 0.703818
P(X ≥ k)
224/323≈ 0.693498
Distribution (N = 20, K = 8, n = 5)
k=0
33/646
k=1
165/646
k=2
385/969
385/969
k=3
77/323
k=4
35/646
k=5
7/1938

Each bar is the exact probability of that outcome; the darker bars form the selected event. Toggle between PMF (P(X = k)) and CDF (P(X ≤ k)).

Step-by-step solution

  1. 1

    Formula

    For X ~ Hypergeometric(N, K, n), P(X = k) counts the samples with exactly k successes and divides by all possible samples: P(X = k) = C(K, k) · C(N−K, n−k) / C(N, n).

    P(X=k)=(Kk) (N−Kn−k)(Nn)P(X = k) = \frac{\binom{K}{k}\,\binom{N-K}{n-k}}{\binom{N}{n}}
  2. 2

    Plug in the values

    N = 20, K = 8, n = 5, k = 2. The support is 0 ≤ k ≤ 5.

  3. 3

    Choose the successes

    C(8, 2) = 28.

  4. 4

    Choose the failures

    C(12, 3) = 220.

  5. 5

    All possible samples

    C(20, 5) = 15504.

  6. 6

    Combine

    P(X = 2) = (28 · 220) / 15504 = 385/969.

    P(X=2)=28⋅22015504=385969P(X = 2) = \frac{28 \cdot 220}{15504} = \frac{385}{969}
  7. 7

    Result

    P(X = 2) = 385/969

About the hypergeometric distribution

The hypergeometric distribution models sampling without replacement: draw n items from a population of N that contains K successes, and X counts the successes drawn. Because drawn items are not returned, every draw changes the odds of the next one — unlike the binomial distribution, where the success probability p is fixed.

The support is max(0, n + K − N) ≤ k ≤ min(n, K): you cannot draw more successes than exist, and once the sample is large enough at least n − (N − K) successes are forced. The mean is n · K/N, and the variance is the binomial variance multiplied by the finite-population correction (N − n)/(N − 1), which shrinks toward 0 as the sample covers the whole population.

Typical uses: lottery odds (6 out of 49), quality control (defectives in a sample) and card games. As a rule of thumb, when the sample is small compared to the population (n ≤ N/10), the hypergeometric distribution is close to the binomial Bin(n, K/N).