Math & Geometry
Hypergeometric Distribution Calculator (Drawing Without Replacement)
The hypergeometric distribution answers questions about drawing items from a finite group without putting them back. A deck of cards, a batch of manufactured parts, a lottery drum or a group of people all have a fixed population of size N containing K items of interest, called successes. If n items are drawn at random without replacement, the number of successes drawn follows the hypergeometric distribution. The probability of exactly k successes is the number of ways to choose k of the K successes, times the number of ways to choose the remaining n minus k items from the N minus K failures, divided by the total number of ways to choose n items from N. These counts are combinations, written C of a and b. Because each draw changes what remains, the probabilities differ from the binomial distribution, which assumes drawing with replacement; the difference is large when the sample is a big share of the population and small when the population is large. The expected number of successes is n times K divided by N, the same as the binomial, but the variance is smaller by a finite population correction factor. Classic examples include the chance of at least one ace in a five-card poker hand, about 34 percent, the odds of matching numbers in a lottery, and acceptance sampling in quality control, where a batch is accepted if a sample contains few defects. This calculator takes the population size, the number of successes in it, the number drawn and a value of k, and returns the exact, cumulative and at-least probabilities, the mean, the standard deviation and a table of the whole distribution.
How to use this calculator
- Enter the population size N, such as 52 cards.
- Enter the number of successes in the population K, such as 4 aces.
- Enter the number of items drawn n, such as 5 cards.
- Enter the number of successes k you are interested in.
- Read the probabilities of exactly, at most and at least k successes.
Lotteries and card games
In a 6-from-49 lottery, the probability of matching exactly three numbers is C(6, 3) × C(43, 3) ÷ C(49, 6), about 1.77 %, a classic hypergeometric calculation.
Card players use the same distribution to work out the chance of drawing specific cards, such as completing a hand or finding a key card in a deck-building game.
Acceptance sampling
Quality inspectors draw a sample from a batch and accept the batch if the number of defective items is at or below a limit. The hypergeometric distribution gives the probability of accepting a batch with a given number of defects.
Standards for sampling plans, such as ISO 2859, use these probabilities to balance the risk of accepting bad batches against the cost of inspection.
Formula & method
P(X = k) = C(K, k) × C(N − K, n − k) ÷ C(N, n)C(a, b) = a! ÷ (b! (a − b)!), the number of combinationsMean = n K ÷ N; variance = n (K/N)(1 − K/N)(N − n)/(N − 1)k ranges from max(0, n − (N − K)) to min(n, K)P(X = k) = C(K, k) C(N − K, n − k)/C(N, n), mean = nK/N and variance = n(K/N)(1 − K/N)(N − n)/(N − 1).
Worked example
The chance of exactly one ace in a five-card hand
- C(4, 1) = 4 ways to choose one ace
- C(48, 4) = 194,580 ways to choose four non-aces
- P = 4 × 194,580 ÷ C(52, 5) = 778,320 ÷ 2,598,960 ≈ 0.2995
Answer: About 30 % of five-card hands contain exactly one ace, and about 34 % contain at least one.
Frequently asked questions
When should I use hypergeometric instead of binomial?
Use the hypergeometric distribution when sampling without replacement from a finite population. If the sample is less than about 5 % of the population, the binomial gives almost the same answer.
What does P(X ≥ k) mean?
It is the probability of drawing at least k successes. For example, P(at least one ace) in five cards is about 0.341.
Why are some values of k impossible?
You cannot draw more successes than exist or more than you draw, and you must draw at least n − (N − K) successes if there are few failures. The calculator shows the possible range.
How large can the population be?
Up to 10 million. The calculator uses logarithms of combinations, so it handles large numbers without overflow.
What is the finite population correction?
It is the factor (N − n)/(N − 1) that reduces the variance compared with the binomial, because drawing without replacement makes results less variable.
Is the table complete?
It shows up to 60 values of k. For very large samples, use the cumulative results for ranges.