This hypergeometric distribution calculator finds the probability of exactly k successes when sampling WITHOUT replacement: P(X = k) = C(K, k) × C(N − K, n − k) ÷ C(N, n) — plus the cumulative probabilities and the distribution’s mean.

–

Sampling Where Every Draw Changes the Odds

The hypergeometric distribution answers the question the binomial can't: draws from a finite population where each removal changes the mix. A deck has 4 aces; draw one and three remain among 51 — the probabilities are path-dependent, and the exact count is a ratio of combinations: favorable ways to choose k successes from the K available, times ways to fill the rest of the sample from the failures, over all ways to draw the sample. The defaults run the canonical card example: exactly 2 aces in a 5-card hand = C(4,2)·C(48,3)/C(52,5) = 3.99%, with the sample mean nK/N = 0.385 aces per hand as the center of the distribution. The same four inputs price a quality inspector's lot (N = 500 parts, K = 20 defectives, sample 30, P(acceptably few defectives)), a lottery's partial matches, and the ecologist's mark-recapture estimate (which inverts this very formula to estimate the unseen N).

Two structural facts organize its use. First, the support is fenced: k can't exceed min(n, K) nor fall below max(0, n − (N − K)) — you can't draw more aces than exist or more non-aces than exist, and the calculator's cumulative sums respect exactly those fences. Second, its relationship to the binomial is convergence with a condition: as N grows large relative to n, removal stops mattering and hypergeometric → binomial with p = K/N — the formal version of the 5–10% sampling-fraction rule. Its variance carries the finite-population correction (N − n)/(N − 1) multiplying the binomial variance — the same factor that shrinks survey margins of error when the population is small — a unifying thread from card games to election polling that this distribution quietly holds together.

Worked Examples (Verified)

  • Defaults: 2 aces in 5 cards → P = 3.99%; P(X ≤ 2) = 99.82%, and the mean is 0.385.
  • At least 1 ace: 1 − C(48,5)/C(52,5) = 1 − 0.6588 = 34.12%.
  • Quality sampling: N = 100, K = 5 defectives, n = 10, P(X = 0) = C(95,10)/C(100,10) = 59.4% — the uncomfortable truth about small samples from mostly-good lots.
  • Lottery flavor: N = 49, K = 6 winning numbers, n = 6, P(match 3) = 1.77%.

Hypergeometric Discipline

  • Without replacement is the trigger: cards, lot sampling, committee selection — if the drawn item goes back, it's binomial instead.
  • Respect the fences: probabilities outside max(0, n−(N−K)) ≤ k ≤ min(n, K) are zero, not errors.
  • The 5–10% rule arbitrates convenience: sampling fraction below that, binomial error is small; above it, use this distribution.
  • Mark-recapture inverts the mean: N̂ ≈ K·n/k (marked × caught ÷ recaptured) — the same formula read backward, estimator noise and all.
  • Exact computation needs log-gamma arithmetic (as here) — raw factorials overflow long before real populations do (171! is already beyond float range).

Related Tools

Frequently Asked Questions

When do you use the hypergeometric distribution?

When sampling without replacement from a finite population with two categories (success/failure): cards dealt from a deck, items inspected from a lot, balls drawn from an urn, names picked from a roster. The probability of exactly k successes in n draws is C(K,k)·C(N−K, n−k)/C(N,n). Exactly 2 aces in a 5-card hand: 3.99%. If draws are replaced (or the population is effectively infinite), the binomial distribution is the right model instead.

What is the difference between hypergeometric and binomial?

Independence. Binomial trials are independent with constant p (with replacement, or an infinite population). Hypergeometric draws are dependent — each draw alters the remaining composition — with p effectively updating after every pick. The distributions converge when the sample is a small fraction of the population (sampling fraction under ~5–10%), and diverge exactly where intuition says: drawing 5 cards from 52 is borderline; drawing 30 from 52 is unmistakably hypergeometric. Their variances differ by the finite population correction (N−n)/(N−1).

How do you calculate the probability of drawing aces from a deck?

As combinations: the ways to choose your aces from the 4 available, times the ways to choose the remaining cards from the 48 non-aces, divided by all 5-card hands (C(52,5) = 2,598,960). Two aces: C(4,2)·C(48,3) = 6 × 17,296 = 103,776 favorable hands → 3.99%. No aces: C(48,5)/C(52,5) = 65.88%, so at least one ace is 34.12%. Enter N = 52, K = 4, n = 5 and any k into this calculator for the full distribution.

What is the mean of the hypergeometric distribution?

μ = n·(K/N) — the sample size times the population success proportion, identical in form to the binomial mean. For the card example: 5 × 4/52 = 0.385 aces expected per hand. The variance is n·(K/N)·(1−K/N)·(N−n)/(N−1) — the binomial variance times the finite population correction, which shrinks spread as the sample consumes the population (draw all 52 cards and the "sample" contains exactly 4 aces with zero variance — the correction hits 0 and the formula knows it).

How is hypergeometric used in quality control?

Acceptance sampling is built on it: from a lot of N items, inspect n, and accept the lot if defectives found ≤ c. The probability of accepting a lot with K defectives is the cumulative hypergeometric P(X ≤ c) — the OC (operating characteristic) curve that balances producer's and consumer's risk. The worked example above shows the stakes: a 100-item lot with 5 defectives passes a 10-item zero-defect inspection 59.4% of the time — the math that decides whether your sampling plan is a quality gate or a formality.

What is mark-recapture and how does it use this formula?

Ecologists estimate an unknown population N by marking K animals, releasing them, then sampling n and counting k marked. Setting the sample proportion equal to the population proportion (k/n ≈ K/N) gives N̂ ≈ K·n/k — the hypergeometric likelihood's maximum, read backward. Catch 50 marked fish in a second sample of 200 where 20 are marked, and the lake holds an estimated 500. The estimator's noise is the distribution's variance — which is why serious studies mark and sample as many as logistics allow.

Can the hypergeometric give a probability for lottery matches?

Yes — it's the exact model of lottery draws (no replacement, finite pool). For a 6/49 game: N = 49 numbers, K = 6 winning, your ticket n = 6 picks: matching exactly 3 has probability C(6,3)·C(43,3)/C(49,6) = 20 × 12,341 / 13,983,816 = 1.77%, and the jackpot (k = 6) is 1/13,983,816. Calculators that price lottery tiers are running this formula with bigger fences; the cumulative outputs here give "at least k matches" directly.

Is this hypergeometric distribution calculator free?

Yes — free, instant, no sign-up. Enter N, K, n and k for the exact probability, both cumulative tails and the mean.