HG

Hypergeometric Calculator

The chance of exactly, at most or at least k successes when you draw n items without putting them back: card hands, poker outs, quality samples.

Statistics & ProbabilityRuns in your browser

Result…

Everything you could draw from: 52 cards in a deck, 47 unseen cards after the flop, 500 parts in a lot.

How many of those count as a success: 13 hearts, 9 outs for a flush draw, 20 faulty parts.

How many you draw without replacement: a 5-card hand, 2 cards to come, a sample of 30.

 

…

How it's calculated

P(X = k) = C(K, k) × C(N − K, n − k) ÷ C(N, n)
mean = nK ÷ N
variance = n (K ÷ N)(1 − K ÷ N)(N − n) ÷ (N − 1)

The hypergeometric distribution counts successes in a sample drawn without replacement from a finite population, so each draw changes the odds for the next: the hearts in a poker hand, the outs that arrive on the turn and river, the faulty parts in an inspection sample. When the population is huge compared with the sample it is close to the binomial distribution; for small populations the binomial overstates the spread. The calculator works out every possible count, so "at least" and "at most" sums are exact sums of the terms, not approximations.

Your numbers, step by step

    About the Hypergeometric calculator

    This hypergeometric calculator gives the chance of drawing exactly, at most or at least k successes when you take n items from a group of N without putting any back. Card players use it for the chance of two hearts in a five-card hand or of hitting a flush draw by the river; inspectors use it for the chance that a sample from a lot contains no faulty parts; teachers and students use it for classic urn problems. Enter the population size, how many successes it holds, how many you draw and the count you care about. You get all three probabilities, the mean, variance and standard deviation, and the steps show the combination counts C(K, k) × C(N − K, n − k) ÷ C(N, n) with your numbers. Every possible count is worked out, so the at least and at most sums are exact rather than approximated.

    How to use it

    1. Enter the “Population size (N)”: 52 for a full deck, or the unseen cards, or the size of the lot.
    2. Enter “Successes in the population (K)”: the hearts, the outs, or the faulty items.
    3. Enter the “Number drawn (n)” and the “Successes drawn (k)” you are asking about.
    4. Under “Probability of”, choose exactly, at most, at least, fewer than or more than k.
    5. Read the answer and the other two probabilities, then check the combination counts in the steps.

    Worked example

    Two hearts in a five-card hand: N = 52, K = 13, n = 5, k = 2. P(X = 2) = C(13, 2) × C(39, 3) ÷ C(52, 5) = 78 × 9139 ÷ 2,598,960 = 0.2743, and the mean number of hearts is 5 × 13 ÷ 52 = 1.25. Poker outs (labelled as such): after the flop in Texas hold'em with four cards to a flush, 9 of the 47 unseen cards complete it and 2 cards are to come, so N = 47, K = 9, n = 2, k = 1, at least: P(X ≥ 1) = 0.3497, about 35%. This treats every unseen card as equally likely and ignores the cards other players hold.

    Updated

    Questions people ask

    How do I calculate a hypergeometric probability by hand?

    Count the ways to choose k successes from K, times the ways to choose the other n − k items from the N − K failures, and divide by the ways to choose any n items from N. The calculator shows those three counts with your numbers.

    What is the difference between the hypergeometric and binomial distributions?

    The hypergeometric distribution is for drawing without replacement, so each draw changes the odds; the binomial is for independent tries with a fixed chance. When the population is much larger than the sample they give nearly the same answer. Use the binomial probability calculator for repeated independent tries.

    How do I work out the chance of hitting my outs in poker?

    Set N to the unseen cards (47 after the flop, 46 after the turn), K to your outs, n to the cards still to come and k to 1 with “At least k”. It assumes every unseen card is equally likely to come, which is the usual simplification.

    What is the chance a quality sample finds no defects?

    Enter the lot size as N, the number of faulty items as K, the sample size as n and k = 0 with “Exactly k”. A lot of 500 with 20 faulty parts and a sample of 30 gives about 0.283, so a clean sample is far from proof of a clean lot.

    Why do I get zero for some values of k?

    Some counts are impossible: you cannot draw more successes than K or n, and if the failures run out you must draw at least n − (N − K) successes. The note under the result shows the possible range. For counting hands or tickets directly, the combinations calculator gives C(n, r).

    More in Statistics & Probability