Hypergeometric Distribution Calculator
Enter the population size N, the number of successes K, the sample size n and the target count k. The calculator shows P(X = k), both cumulative tails, an inclusive range, the support, mean, variance and standard deviation. Each sample is assumed to be uniformly random and drawn without replacement. The working shows the binomial coefficients for your inputs, while the plot and table describe the possible success counts.
There are 2,598,960 ways to draw 5 from 52. Put each item back and the same question becomes the binomial, which answers 0.263672. Standard deviation 0.9295001819, variance 0.8639705882, most likely count 1.
The whole support
How likely each possible count of successes is, across the whole support. It runs 0 to 5, because a sample cannot hold more successes than it drew or more than the population has, and it cannot hold fewer than the failures leave room for.
| k | P(X = k) | P(X <= k) | P(X >= k) | Use |
|---|---|---|---|---|
| 0 | 0.221534 | 0.221534 | 1 | |
| 1 | 0.411420 | 0.632953 | 0.778466 | |
| 2 | 0.274280 | 0.907233 | 0.367047 | |
| 3 | 0.081543 | 0.988776 | 0.092767 | |
| 4 | 0.010729 | 0.999505 | 0.011224 | |
| 5 | 0.000495 | 1 | 0.000495 |
Common questions
- How do you calculate a hypergeometric probability?
- First enter N, the total number of items; K, the items counted as successes; n, the number drawn; and k, the successes wanted. The formula is P(X = k) = C(K, k) x C(N - K, n - k) / C(N, n), where C(a, b) counts ways to choose b items from a. The working row substitutes your numbers and shows the coefficients when they fit. For two hearts in a five-card hand, it displays 78 x 9,139 / 2,598,960 = 0.274280. The textbook case N = 10, K = 4, n = 3, k = 1 gives 0.500000.
- What is the difference between the hypergeometric and binomial distributions?
- Replacement. The binomial assumes every draw faces the same odds, which is true when each item goes back; the hypergeometric assumes it does not, so every item drawn changes what is left to draw. Two hearts in five cards is 0.274280 without replacement and 0.263672 with it, and this page prints both so the gap is visible instead of assumed. The gap widens as the sample takes up more of the population, and the variance shows the same effect through its finite population correction.
- What is the support of the hypergeometric distribution?
- It runs from max(0, n - (N - K)) to min(n, K), not from 0 to n. The top end is the obvious one: a sample cannot hold more successes than the items it drew, or more than the population contains. The bottom end catches people out. Draw 35 items from a population of 50 that holds only 30 failures and at least 5 successes have to come with them, so the support runs 5 to 20, the most likely count is 14 at 0.246374, and P(X = 2) is not small, it is zero. The support is a readout cell on this page for that reason.
- Why does it return exactly 0 instead of a tiny number?
- A count outside the support is impossible, so its probability is exactly 0. For a count inside the support, an extremely small positive probability can also underflow to 0 in floating-point arithmetic. The note under the results distinguishes these cases. Small probabilities that still fit are displayed in scientific notation rather than rounded to six decimal zeros.
- How do I get at most, at least or a range?
- They are all on the page at once. For two hearts in a five-card hand, P(X = 2) is 0.274280, P(X <= 2) is 0.907233 and P(X >= 2) is 0.367047, while the range row answers an inclusive band: P(1 <= X <= 3) is 0.767242. The two range fields take the ends of that band. Leave one of them empty and it falls back to that end of the support, and the label above the figure says which number it used, so nothing is left implied.
- How are the mean, variance and standard deviation calculated?
- The mean is n x K / N, so five cards from a deck holding 13 hearts averages 1.25 hearts. The variance is n (K/N) ((N - K)/N) ((N - n)/(N - 1)), which is 0.8639705882 for that hand. Standard deviation is the square root of the variance. The last factor is the finite population correction for sampling without replacement. When N = 1, the count is deterministic and the variance and standard deviation are 0.
- Can it work out lottery odds?
- It calculates matching-count probabilities for a uniformly random draw of distinct numbered balls from one pool. For a 6 from 49 example, use N = 49, K = 6, n = 6 and k = 6: the probability is 7.1511e-8, or one in 13,983,816. This is a descriptive counting example. Separate bonus-ball pools, ordered digits, repeated draws, prize rules and betting decisions are outside this model.
- How do I check a card draw or an opening hand?
- Set N to the deck size, K to the cards counted as successes, n to the cards drawn and k to the successes wanted. For ordinary playing cards, a 52-card deck has 13 hearts: use N = 52, K = 13 and n = 5 to count hearts in a five-card hand. For an MTG opening-hand count, enter your own deck size and number of copies. Four copies in a 60-card deck with 7 cards drawn gives 0.399500 for at least one copy. This assumes a uniformly shuffled deck and one draw without replacement; it does not model mulligans, overlapping card categories, play rules or hand rankings.
- Does the sample have to be small compared with the population?
- No. The hypergeometric model includes the finite population directly, so it also applies when the sample is most of that population. For N = 50, K = 20 and n = 35, at least 5 successes are forced into the sample. This calculator evaluates that model in floating-point arithmetic rather than replacing it with a binomial approximation.
- How large can the numbers be, and how accurate is the result?
- N must be from 1 to 100,000. Other counts must be whole numbers within 100,000, with K and n no larger than N. Commas must group digits in threes, such as 1,000; decimal commas and fractional counts are refused. Logarithms avoid overflow from enormous binomial coefficients. Ordinary probabilities are shown to six decimal places, small ones in scientific notation, and extreme values may underflow to 0 or round to 1. The support distinguishes an impossible count from numerical underflow.
- Does this give TI-84 button instructions?
- This page is a browser calculator with its own labelled inputs. It explains the combination formula and substitutes your counts, but it does not provide verified TI-84 menu steps, commands or programs. Instructions for operating that physical calculator are a separate workflow.
- Can I calculate a multivariate hypergeometric distribution?
- This calculator has one success category and groups all other items together. A multivariate calculation needs separate population and target counts for several categories and their joint probability. Combining several categories into K gives only their total count, not the joint result, so that calculation is not supported here.
Floating-point evaluation of the hypergeometric model for a uniformly random sample without replacement. Logarithms avoid coefficient overflow. Counts outside the support are impossible and return 0; extreme probabilities can underflow to 0 or round to 1.