Skip to content
Mathico

Hypergeometric Calculator

Calculate hypergeometric probabilities for drawing without replacement: the chance of exactly, at most or at least k successes, as in card hands, lottery numbers or quality checks. Mean, variance and a distribution chart are included.

e.g. 52 cards

e.g. 4 aces

e.g. 5 cards drawn

e.g. exactly 2 aces

Examples

P(X = 2)

0.03993

3.993% ยท 1 in 25

P(X < 2)
0.958316
P(X โ‰ค 2)
0.998245
P(X > 2)
0.001755
P(X โ‰ฅ 2)
0.041684
Mean (expected successes)
0.3846
Standard deviation
0.572

Distribution

04

How to use the hypergeometric calculator

  1. Enter the population size (N) and how many of those count as successes (K).
  2. Enter the sample size (n), how many you draw without putting them back.
  3. Enter k, the number of successes you're asking about, and read the exact, "at most" and "at least" probabilities, plus the mean and a distribution chart.

Hypergeometric formula

P(X = k) = C(K, k) ร— C(N โˆ’ K, n โˆ’ k) รท C(N, n)
C(a, b) = a! รท (b! ร— (a โˆ’ b)!)
Mean = nK รท N ยท Variance = n (K/N)(1 โˆ’ K/N)(N โˆ’ n) รท (N โˆ’ 1)

Worked examples

QuestionN, K, n, kProbability
Exactly 2 aces in a 5-card poker hand52, 4, 5, 20.0399 (about 1 in 25)
At least 1 of 4 copies in a 7-card hand from 6060, 4, 7, โ‰ฅ10.3995 (40%)
Match exactly 3 in a 6/49 lottery49, 6, 6, 30.0177 (about 1 in 57)
Jackpot: match all 649, 6, 6, 61 in 13,983,816
3 red marbles in 5 draws (10 red, 30 blue)40, 10, 5, 30.0793

Hypergeometric vs binomial

Both count successes, but the binomial assumes each trial has the same probability (sampling with replacement, or a huge population). In a 52-card deck, once an ace is drawn the chance of another drops from 4/52 to 3/51, which is exactly what the hypergeometric distribution accounts for. When the population is much larger than the sample, the two give nearly identical results, and for large samples both look like a bell curve; see the normal CDF calculator.

Common uses

  • Card games and deck building: odds of drawing key cards in an opening hand.
  • Lotteries and raffles: the chance of matching some or all numbers.
  • Quality control: the chance of finding defective items when inspecting a sample from a batch.
  • Ecology and surveys: capture-recapture estimates and sampling from small groups. For estimating proportions from a sample, see the confidence interval calculator.

Need to draw a fair random sample? The random number generator can pick unique numbers without repeats. Probabilities as fractions? Simplify them with the fraction calculator. More math calculators.

Sources

Frequently asked questions

What is the hypergeometric distribution?

It gives the probability of drawing a certain number of successes when you sample without replacement from a finite group, such as dealing cards from a deck or picking lottery numbers. Each draw changes what's left, which is why it differs from the binomial distribution.

What is the hypergeometric formula?

P(X = k) = C(K, k) ร— C(N โˆ’ K, n โˆ’ k) รท C(N, n), where N is the population size, K the number of successes in it, n the sample size and k the successes you want, and C is 'choose'. For exactly 2 aces in a 5-card hand: C(4,2) ร— C(48,3) รท C(52,5) = 6 ร— 17,296 รท 2,598,960 โ‰ˆ 0.0399.

How do I calculate 'at least one'?

Use the complement: P(X โ‰ฅ 1) = 1 โˆ’ P(X = 0). With 4 copies of a card in a 60-card deck, the chance of at least one in a 7-card opening hand is 1 โˆ’ C(56,7) รท C(60,7) โ‰ˆ 0.3995, about 40%.

When should I use hypergeometric instead of binomial?

Use hypergeometric when sampling without replacement from a small population, where each draw noticeably changes the odds. If the population is very large compared with the sample (say, more than 20 times bigger), the binomial distribution gives almost the same answer.

What are the odds of winning a 6/49 lottery?

Matching all 6 numbers is C(6,6) ร— C(43,0) รท C(49,6) = 1 in 13,983,816. Matching exactly 3 is about 1.77%, or roughly 1 in 57.

What are the mean and variance?

Mean = n ร— K รท N. Variance = n ร— (K/N) ร— (1 โˆ’ K/N) ร— (N โˆ’ n) รท (N โˆ’ 1). The last factor, the finite population correction, makes the variance smaller than for the binomial.