Quant Memo
Core

The Hypergeometric Distribution

The distribution for counting successes when you sample without replacement from a finite pool — the honest version of the binomial once each draw changes the odds for the next. It powers card problems, quality inspection, and Fisher's exact test.

Prerequisites: The Binomial Distribution, Counting: Permutations and Combinations

The hypergeometric distribution shows up whenever you reach into a finite pile and grab a handful without putting anything back. Deal five cards from a deck and count the aces; pull ten parts off a shipment and count the defects; audit twelve of a hundred trades and count the errors. Each item you remove changes what's left, so the odds shift with every draw, and that shifting is exactly what separates the hypergeometric from its more famous cousin, the The Binomial Distribution.

Set up the pool with three numbers: NN items in total, of which KK are "successes" (aces, defects, whatever you're counting), and you draw a sample of size nn. The probability of getting exactly kk successes is a ratio of counting numbers:

P(X=k)=(Kk)(NKnk)(Nn).P(X = k) = \frac{\dbinom{K}{k}\dbinom{N-K}{\,n-k\,}}{\dbinom{N}{n}} .

Read it as: (ways to pick kk of the KK successes) times (ways to pick the remaining nkn-k from the NKN-K non-successes), divided by (ways to pick any nn from all NN). It's pure Counting: Permutations and Combinations: favourable arrangements over total arrangements.

With replacement or without: binomial vs hypergeometric

The single question that decides which model you need is: does each draw put the item back? Same experiment, one word of difference, two distributions.

BinomialHypergeometric
Samplingwith replacement (or infinite pool)without replacement (finite pool)
Draw-to-draw oddsfixed at pp every timeshift after each draw
PMF(nk)pk(1p)nk\binom{n}{k}p^k(1-p)^{n-k}(Kk)(NKnk)/(Nn)\dbinom{K}{k}\dbinom{N-K}{n-k}\big/\dbinom{N}{n}
MeannpnpnKNn\,\tfrac{K}{N}
Variancenp(1p)np(1-p)nKN(1KN)NnN1n\,\tfrac{K}{N}\big(1-\tfrac{K}{N}\big)\tfrac{N-n}{N-1}

Notice the means match if you read p=K/Np = K/N: on average, the fraction of successes in your sample equals the fraction in the pool, replacement or not. The variance is where they part company.

The choice is one word: with replacement is binomial, without replacement is hypergeometric. Their means agree (npnp with p=K/Np = K/N), but the hypergeometric's variance is smaller by the finite-population factor NnN1\tfrac{N-n}{N-1}.

The finite-population correction

That extra factor NnN1\frac{N-n}{N-1} in the variance is the finite-population correction, and it's always at most 1, so sampling without replacement is less variable than sampling with. The intuition: once you've drawn most of a small pool, there's little left to be surprised by, in the extreme, if you draw the entire pool (n=Nn = N) the correction is zero and you know the count exactly. When the pool is huge relative to your sample (NN far bigger than nn), the correction is nearly 1 and the hypergeometric becomes indistinguishable from the binomial. That's why "with replacement" is a fine approximation when you're sampling a tiny slice of a big population.

When the pool dwarfs the sample (NnN \gg n), stop reaching for factorials, the hypergeometric collapses into a The Binomial Distribution with p=K/Np = K/N. Polling 1,000 people out of millions? Binomial is exact enough.

Worked example

A shipment has N=20N = 20 items, of which K=5K = 5 are defective. A quality inspector pulls n=4n = 4 at random, without replacement. What's the chance exactly 2 of the 4 are defective?

P(X=2)=(52)(152)(204).P(X = 2) = \frac{\dbinom{5}{2}\dbinom{15}{2}}{\dbinom{20}{4}} .

Compute each piece: (52)=10\binom{5}{2} = 10 (ways to choose 2 defectives from 5), (152)=105\binom{15}{2} = 105 (ways to choose 2 good ones from 15), and (204)=4845\binom{20}{4} = 4845 (total ways to choose any 4). So

P(X=2)=10×1054845=105048450.217.P(X = 2) = \frac{10 \times 105}{4845} = \frac{1050}{4845} \approx 0.217 .

About a 22% chance of catching exactly two defects. And the expected number of defects in the sample is E[X]=nKN=4×520=1E[X] = n\,\tfrac{K}{N} = 4 \times \tfrac{5}{20} = 1, the same one-quarter defect rate as the shipment, scaled to four draws.

Don't use the binomial here. With only 20 items, treating the draws as independent (each defective with probability 0.25) overstates the spread, it ignores that pulling a defect leaves fewer defects behind. Small pools demand the finite-population correction.

Where you'll meet it

  • Card and lottery problems. "Probability of exactly two aces in a five-card hand" is textbook hypergeometric.
  • Quality control and auditing. Inspecting a finite batch without replacement is its native habitat.
  • Fisher's exact test. The p-value for a 2×22\times2 contingency table is computed from hypergeometric probabilities, the small-sample alternative to a chi-squared test.

The hypergeometric completes the counting family: it's the without-replacement partner of the The Binomial Distribution, built entirely from Counting: Permutations and Combinations, and it sits alongside the The Negative Binomial Distribution and the rest of the Common Distributions every quant should recognise on sight.

Related concepts

Practice in interviews

Further reading

  • Blitzstein & Hwang, Introduction to Probability, ch. 3
  • Ross, A First Course in Probability
ShareTwitterLinkedIn