On this page
Deal five cards and count the aces, or check five items from a box and count the faulty ones. Nothing goes back, so the odds shift with every draw. That is the job of the hypergeometric distribution, and many "balls from a bag" problems are hypergeometric questions in disguise.
What is the hypergeometric distribution?
The hypergeometric distribution gives the probability of k successes in n draws, without replacement, from a finite population of size N that contains exactly K successes (Wikipedia: Hypergeometric distribution).
N: the population size (cards in the deck, items in the lot)
K: how many of them count as a success (aces, defective items)
n: how many you draw
k: how many successes you want in your sample
The formula is P(X = k) = C(K, k) × C(N − K, n − k) / C(N, n), and k can only run from max(0, n + K − N) to min(K, n) (Wikipedia; also Wolfram MathWorld).
You need not memorise it. All C(N, n) samples are equally likely, and a favourable one picks k of the K successes and n − k of the N − K failures. Divide the two counts and you have the formula.
How do you use the formula? Two worked examples
Cards first, with the same formula Wolfram MathWorld gives for good and bad balls in an urn. A deck has N = 52 cards with K = 4 aces, and you draw n = 5. For k = 2:
Choose 2 of the 4 aces: C(4, 2) = 6.
Choose the other 3 cards from the 48 non-aces: C(48, 3) = 17,296.
Count all hands: C(52, 5) = 2,598,960.
P(X = 2) = 6 × 17,296 / 2,598,960 = 103,776 / 2,598,960 ≈ 0.040.
So about one hand in 25 holds exactly two aces.
Now quality control. In a single sampling plan, one sample is taken at random from a lot, and the lot is rejected if it holds more than a set number of defectives (NIST/SEMATECH e-Handbook).
Say a lot has N = 20 items, K = 4 defective, and the inspector checks n = 5. The chance of no defective in the sample is C(16, 5)/C(20, 5) = 4,368/15,504 ≈ 0.282. So more than a quarter of the time, this lot would pass an inspection that accepts only a clean sample.
What is the mean of the hypergeometric distribution?
The mean is nK/N, and the variance is n(K/N)(1 − K/N)(N − n)/(N − 1) (LibreTexts, Siegrist, The Hypergeometric Distribution/12%3A_Finite_Sampling_Models/12.02%3A_The_Hypergeometric_Distribution)).
For the cards, that is 5 × 4/52 ≈ 0.38 aces per hand; for the lot, 5 × 4/20 = 1 defective. It matches the binomial mean np with p = K/N, because each draw on its own succeeds with probability K/N and expectations add even when draws are dependent. Our post on why the binomial mean and variance are np and npq builds those from scratch.
The variance is where they part ways. The factor (N − n)/(N − 1) is below 1, so the spread is tighter: for the lot it is 15/19, giving about 0.63 against the binomial's 0.8.
How is it different from the binomial distribution?
The binomial counts successes in n draws with replacement, where the chance of success stays the same on every draw; without replacement, each draw shrinks the population and changes the chance (Wikipedia). Our four-condition test for whether drawing without replacement is binomial shows why independence fails.
Here is the small lot next to a binomial with p = 0.2, each computed from its formula (hypergeometric first):
k = 0: 0.282 vs 0.328
k = 1: 0.470 vs 0.410
k = 2: 0.217 vs 0.205
k = 3: 0.031 vs 0.051
k = 4: 0.001 vs 0.006
The binomial even gives a tiny chance to five defectives, impossible when only four exist. For a two-draw version, see both balls the same colour, with and without replacement.
When is the binomial a fair approximation?
When the population is very large compared with the sample, the hypergeometric distribution is well approximated by the binomial (LibreTexts, Siegrist/12%3A_Finite_Sampling_Models/12.02%3A_The_Hypergeometric_Distribution)). Wikipedia adds that p should not be close to 0 or 1 (Wikipedia).
Scale the lot up to N = 2,000 with K = 400 defective, still checking 5. A clean sample now has probability (1,600/2,000)(1,599/1,999)(1,598/1,998)(1,597/1,997)(1,596/1,996) ≈ 0.3273, against the binomial's 0.8^5 ≈ 0.3277. The factor (N − n)/(N − 1) is about 0.998.
A checklist for exam questions:
Items replaced, or a population called very large: use the binomial.
A bag, deck or lot of stated size, nothing replaced: use the hypergeometric formula; it is exact.
Unsure? Work out (N − n)/(N − 1). Near 1, the answers agree; well below 1, as with 15/19, they do not.
Check that your mean comes out as nK/N.
If counting is where you get stuck, the Fermi Concept Library covers every concept in mathematics, including combinations. To practise, the Fermi Problem Library has a step-by-step solver that explains the reasoning, not just the final number.



