CompoundPage

Hypergeometric Calculator

This hypergeometric calculator gives the chance of exactly, at least or at most k successes when you draw without putting anything back, such as the 34.12% chance of at least one ace in a 5-card hand.

Everything you could draw from, such as the 52 cards in a deck.

How many of those count as a success, such as the 4 aces.

How many you draw, without putting any back, such as a 5-card hand.

P(X ≥ 1)34.12%

Probability of at least 1 success 5 drawn from 52 without replacement, 4 of which are successes.
34.12%
Formula
1 - P(X = 0) = 1 - C(48, 5) / C(52, 5) = 1 - 1,712,304 / 2,598,960
As a fraction Counted exactly in whole numbers and reduced: the draws that qualify over every possible draw.
18,472 / 54,145
Probability of fewer than 1 The complement: 1 minus the answer above.
65.88%
Mean (expected successes) n x K / N = 5 x 4 / 52.
0.3846
Variance n x (K/N) x (1 - K/N) x (N - n)/(N - 1). The last factor is the finite population correction: the variance of drawing with replacement, shrunk because each draw changes what is left.
0.3272
Standard deviation
0.572
Most likely count
0 (65.88%)
Possible counts At most the smaller of the draws and the successes, and at least whatever the failures cannot fill.
0 to 4
The distribution of X, every possible count
kP(X = k)P(X ≤ k)P(X ≥ k)
00.65880.65881
10.29950.95830.3412
20.039930.99820.04168
30.00173610.001755
41.847 × 10^-511.847 × 10^-5
  • Probabilities in the table have four significant figures. Terms smaller than 10^-300 of the most likely one are treated as 0.

How the Hypergeometric Calculator works

The hypergeometric distribution counts successes when you draw without replacement. A population of N items holds K successes, you draw n of them and keep them out, and X is how many successes you got. Cards are the classic case: a deck is 52 cards with 4 aces, and a 5-card hand is 5 draws that never go back.

The hypergeometric distribution formula is P(X = k) = C(K, k) x C(N - K, n - k) / C(N, n). C(a, b) is the number of ways to choose b things from a. The top counts the hands with exactly k successes and n - k failures, and the bottom counts every possible hand. Each hand is equally likely, so the ratio is the probability.

The chance of at least one ace in a 5-card hand is easiest as a complement. No aces means all five cards come from the 48 others: C(48, 5) = 1,712,304 hands out of C(52, 5) = 2,598,960. So at least one ace is 1 - 1,712,304 / 2,598,960 = 34.12%, which is exactly 18,472/54,145. Exactly two aces is C(4, 2) x C(48, 3) / C(52, 5) = 6 x 17,296 / 2,598,960 = 3.99%.

A flush draw in hold'em works the same way. With four hearts in your hand and on the flop, 9 hearts are left among the 47 unseen cards. The chance that the turn or river brings at least one is 1 - C(38, 2) / C(47, 2) = 1 - 703/1,081 = 34.97%.

A lottery is a hypergeometric draw too. Pick 6 of 49 and the 6 winning numbers are the successes. Matching exactly 3 is C(6, 3) x C(43, 3) / C(49, 6) = 246,820 / 13,983,816 = 1.765%, and matching all 6 is 1 in 13,983,816.

Quality control uses it to size a sample. A lot of 100 parts holds 5 defective ones, and an inspector checks 10. The chance the sample holds no defective part is C(95, 10) / C(100, 10) = 58.38%, so a sample that small misses the problem more often than it catches it.

The mean is n x K / N, which is 0.3846 aces in a 5-card hand. The variance is n x (K/N) x (1 - K/N) x (N - n)/(N - 1). Without the last factor that is the binomial variance, for drawing with replacement. The factor shrinks it because every card drawn changes the odds of the next one. With replacement, at least one ace in five draws would be 1 - (12/13)^5 = 32.98% instead of 34.12%.

This calculator builds each term from the most likely count outward, using the exact ratio between neighbors, and then scales them to sum to 1. No factorial is ever formed, so a population of a billion is handled as exactly as a deck. For populations up to 2,000 it also counts the hands in whole numbers and gives the answer as a reduced fraction.

Hypergeometric Calculator FAQ

What is the hypergeometric distribution used for?

Any count of successes in draws without replacement: aces in a poker hand, matching lottery numbers, defective parts in an inspection sample, or tagged fish in a recapture. The draws are not independent, because each one changes what is left.

What is the difference between the hypergeometric and binomial distributions?

The binomial assumes each draw has the same chance of success, which is true with replacement. The hypergeometric is for draws without replacement. When the sample is a small share of the population the two are close, and the hypergeometric variance is the binomial one times (N - n)/(N - 1).

What is the probability of at least one ace in a 5-card hand?

34.12%, or 18,472/54,145 exactly. It is 1 - C(48, 5) / C(52, 5): one minus the share of hands drawn entirely from the 48 cards that are not aces.

How do you calculate at least one success?

Take one minus the chance of none. P(X = 0) is C(N - K, n) / C(N, n), every card drawn from the failures, so P(X ≥ 1) = 1 - C(N - K, n) / C(N, n).

More Hypergeometric Calculator pages

Related calculators

Embed this calculator
<div id="compoundpage-hypergeometric-calculator"></div>
<script src="https://compoundpage.com/embed/hypergeometric-calculator.js" async></script>

The same calculation as JSON