How to use
The hypergeometric distribution describes how many success items appear in a fixed-size random sample drawn without replacement. Use this calculator for an urn exercise, a deck-of-cards example or a finite-population sampling lesson. A success is simply the category you choose to count; it need not describe a desirable outcome.
- Enter whole numbers for N, K, n and k, then choose the probability event to highlight. Do not use thousands separators.
- Choose Calculate or press Enter. Read the result together with the plot and the detailed table.
- Copy result copies the confirmed numbers as plain text. Editing an input clears the previous result and copy state, while the graph previews valid current inputs. Clear empties inputs, results and graph without restoring the example.
How it works
N is the total population, K is the number of success items, n is the number drawn and k is the success count of interest. The probability of exactly k successes is C(K,k) × C(N−K,n−k) / C(N,n). The support runs from max(0, n−(N−K)) through min(n,K). Counts outside that support are impossible and have zero point probability, even if they satisfy 0 ≤ k ≤ n.
At most k sums outcomes through k, including k. More than k sums only outcomes above k. Select which event to highlight; the other probabilities remain visible. Each bar and table row uses the same distribution as the results. Adjacent log probabilities and normalization avoid overflowing factorials; very small values use scientific notation rather than being shown as zero.
Examples
With N = 10, K = 4, n = 3 and k = 2, there are C(10,3) = 120 equally likely samples. Exactly two successes occur in C(4,2) × C(6,1) = 36 samples, so P(X = 2) = 0.3. P(X ≤ 2) = 116/120 ≈ 0.96666667 and P(X > 2) = 4/120 ≈ 0.03333333.
With N = 5, K = 5, n = 2 and k = 2, every item is a success. The only possible count is 2, its probability is 1, and the variance is 0. Selecting more than 2 highlights no outcome and returns 0.
Uses and limits
Use whole numbers with 0 ≤ K ≤ N ≤ 10,000 and 0 ≤ k ≤ n ≤ min(N, 200). The sampling limit keeps the full plot and table readable; there is no hidden truncated tail. N = 0 is accepted only with K = n = k = 0, representing the empty sample. For N = 1 or a deterministic sample, variance is 0.
All samples of the stated size must be equally likely, and drawn items must not be returned. With replacement, the binomial model may be appropriate instead. This educational result does not guarantee the quality of a sampling plan or the outcome of a real decision. Values close to one may round to one; inspect the separately calculated opposite tail when that distinction matters.
Frequently asked questions
Why can a valid k have probability zero?
There may be too few success or failure items to form that outcome. The displayed support gives the actual feasible counts.
Does more than k include k?
No. It means X > k. At most k means X ≤ k. Those two events partition all outcomes and their probabilities sum to one before display rounding.
Is the expected value a possible count?
Not necessarily. The mean nK/N is an average over repeated samples and can be fractional, while every actual success count is an integer.
Can I copy extremely small probabilities?
Yes. Copy result includes the full probability table using the same notation as the screen. The logarithmic calculation retains tiny positive probabilities even when an ordinary decimal representation would underflow.