Hypergeometric Calculator
With population size 52, successes in the population 13, draws 5, successes wanted 2, hypergeometric comes to 27.4280 % — chance of exactly k. It is reached in 7 steps, the last of which is 0.2742797 * 100, and each one is printed on the page with its numbers filled in. The formula is the one published by NIST/SEMATECH e-Handbook §7.3.3, not an approximation fitted to it.
The probability of drawing exactly k of a kind from a finite population without replacement — the card and lottery case the binomial gets wrong.
Formula and sources checked · How we check
Population size 52, Successes in the population 13, Draws 5, Successes wanted 2
27.4280 %
Chance of exactly k for the example below. Editing a field recomputes the calculator below; this figure holds the answer the page was loaded with.
It is written into the HTML rather than drawn by a script, so a search engine reading this page without running JavaScript still finds an answer.
- Ways to pick k from the K successes
combinations(13, max(0, min(2, 13)))78 ways- Ways to pick the rest from the failures
combinations(52 - 13, max(0, min(5 - 2, 52 - 13)))9,139 ways- Ways to draw n from N at all
combinations(52, max(0, min(5, 52)))2,598,960 ways- P(X = k)
(78 * 9139) / 25989600.274- P(X = k) as a percentage
0.2742797 * 10027.428 %- Mean, n·K/N
5 * 13 / 521.25 successes- What the binomial would say
combinations(5, max(0, min(2, 5))) * (13 / 52) ^ 2 * (1 - 13 / 52) ^ (5 - 2) * 10026.367 %
Worked example
Exactly two hearts in a five-card hand: 78 ways to pick the hearts times 9,139 ways to pick three non-hearts, over 2,598,960 hands — 27.43%. The binomial, which assumes the deck is reshuffled between cards, says 26.37%. The gap is small here and grows as the sample takes a bigger bite out of the population.
How to work it out yourself
- 1.Count the ways to choose k successes from the K available: C(K, k).
- 2.Count the ways to fill the remaining draws from the failures: C(N − K, n − k).
- 3.Multiply those two — that is the number of favourable hands.
- 4.Divide by C(N, n), every hand that could be drawn.
The formula
- Ways to pick k from the K successes
combinations(13, max(0, min(2, 13))) - Ways to pick the rest from the failures
combinations(52 - 13, max(0, min(5 - 2, 52 - 13))) - Ways to draw n from N at all
combinations(52, max(0, min(5, 52))) - P(X = k)
(78 * 9139) / 2598960 - P(X = k) as a percentage
0.2742797 * 100 - Mean, n·K/N
5 * 13 / 52 - What the binomial would say
combinations(5, max(0, min(2, 5))) * (13 / 52) ^ 2 * (1 - 13 / 52) ^ (5 - 2) * 100
Source: NIST/SEMATECH e-Handbook §7.3.3 — comparing two proportions, which uses the hypergeometric, NIST DLMF §26.3 — binomial coefficients
Questions people actually ask
- When do I use hypergeometric instead of binomial?
- Whenever the draw changes what is left. Cards dealt from a deck, items pulled from a batch for inspection, balls drawn from an urn without putting them back. The binomial assumes the probability is identical every trial, which is only true if you replace what you took.
- How different are the two answers?
- It depends on how much of the population you draw. Take under about 5% of it and the difference is negligible — which is the standard rule for treating a survey sample as binomial. Take a fifth of it and the binomial overstates the spread noticeably, because it lets the same item be counted repeatedly.
- How do I use this for lottery odds?
- Population is how many numbers the machine holds, successes is how many are drawn, draws is how many you pick, and k is how many you want to match. For a 6-from-49 game, N = 49, K = 6, n = 6, k = 6 gives one in 13,983,816.
- What does the mean mean here?
- n·K/N — draws times the share of the population that is a success. It is the same as the binomial mean, which is the thing that surprises people: sampling without replacement changes the spread of the outcomes but not their average.
Related
- Binomial CalculatorThe probability of exactly k successes in n independent trials, with the cumulative tails, the mean and the standard deviation.
- Percentage CalculatorWhat X% of a number is, plus the discounted price, the marked-up price and the remainder.
- Z-Score to P-Value CalculatorExact p-value from a z-score, one-tailed or two-tailed, with the percentile the score sits at.
- Factorial Calculatorn factorial for n up to 170, with the number of digits, the previous factorial and what the figure counts: the orderings of n distinct things.
- Grade CalculatorYour weighted course grade from up to eight categories, by percentage or by points, or the score you need on the final to reach the grade you want.
- Confidence Interval CalculatorThe confidence interval around a sample mean, with the margin of error and what the interval does and does not claim.
Put this calculator on your site
Free, no attribution required beyond the link.
<iframe src="https://rulecalculators.com/embed/hypergeometric" width="100%" height="420" style="border:1px solid #e7e4de;border-radius:12px" title="Hypergeometric Calculator"></iframe>