Hypergeometric Distribution: Formula and Sampling Examples

Use a hypergeometric distribution when you draw a fixed number of items from a finite pool without putting any back. It tells you the chance of a given marked count in your sample. Each draw changes what is left for the next draw. The word marked just means an item meets the rule you chose; it need not mean a win.
This differs from a binomial model, whose trials are independent and have the same success chance. In a financial audit, you might draw a random sample from a known list of positions. Some may link to one event. You want the chance of finding a given number of those positions in the sample, not the chance that the event itself occurs.
This guide explains the formula, works through a hypothetical portfolio audit, and repeats the math in Excel. It also shows how a binomial shortcut changes the answer. All counts are teaching inputs. They are not disclosures about Macro Markets positions, users, or market exposure. Check the sampling rule as well as the numbers before applying this model to a real review.
What Does a Hypergeometric Distribution Model?
Define a population containing N items, of which K are marked and N − K are unmarked. Select n items uniformly at random without replacement, and let X count the marked items in the sample.
The marking rule must be fixed. A position might be marked because it relates to a particular event, belongs to a chosen asset category, or meets a predefined audit condition. “Marked” is a mathematical label, not necessarily a profitable outcome or a risk assessment.
The model requires every subset of n items to have the same selection probability. A manually chosen sample of the most important positions does not meet that requirement. Neither does a sample weighted by position value unless the model explicitly accounts for the unequal selection probabilities.
The official Microsoft HYPGEOM.DIST reference describes the finite-population sampling calculation and its parameters. Before using the function, identify the entire population, the marked subset, and the sample size in the same units.
Hypergeometric Distribution Formula
The chance of exactly x marked items is:
P(X = x) = C(K, x) × C(N − K, n − x) / C(N, n)
The numerator counts ways to choose x marked items and n − x unmarked items. The denominator counts all possible samples of size n. C(a, b) denotes the number of combinations of b items selected from a items.
The allowed count runs from max(0, n − (N − K)) through min(n, K). These limits ensure that the sample does not contain more marked or unmarked items than the population supplies.
For example, a sample cannot contain seven marked items if only six exist in the full population. It also cannot contain more marked items than its own sample size. Checking this support before calculating helps catch reversed parameters and impossible inputs.
The binomial distribution guide covers the different formula that applies when there are fixed independent trials with a constant success probability. Both distributions count marked or successful outcomes, but their sampling structures differ.
Worked Example: Two Linked Positions in a Five-Position Audit
Assume a hypothetical portfolio list has 20 positions. Exactly six relate to one stated event, and the other 14 do not. An auditor selects five distinct positions uniformly at random without replacement. Let X count how many selected positions belong to that event group.
For exactly two marked positions, use N = 20, K = 6, n = 5, and x = 2:
P(X = 2) = C(6, 2) × C(14, 3) / C(20, 5)
There are 15 ways to choose the marked pair and 364 ways to choose three unmarked positions. Their product is 5,460 qualifying samples. There are 15,504 equally likely samples in total.
P(X = 2) = 5,460/15,504 ≈ 35.22%
| Quantity | Value |
|---|---|
| Full list N | 20 |
| Marked positions K | 6 |
| Sample size n | 5 |
| Exactly two marked | 35.22% |
This probability concerns the composition of a random audit sample. It does not measure the chance of the underlying event occurring, the chance that the positions are profitable, or the percentage of portfolio value at risk. Six small positions and six large positions have the same count in this example.

Why Sampling Without Replacement Changes the Probability
On the first selection, the chance of a marked position is 6/20 = 30%. If the first selection is marked, five marked positions remain among 19 total positions. The next marked-selection probability becomes 5/19 ≈ 26.32%.
If the first selection is unmarked, all six marked positions remain among 19 total positions. The next marked-selection probability becomes 6/19 ≈ 31.58%.
Thus, the second selection's conditional probability depends on the first selection. Holding it at 30% regardless of the first result would ignore the changing pool. The dependence is created by the sampling procedure.
This sampling dependence is separate from dependence between the positions' economic outcomes. Positions linked to one settlement can have common payoff exposure even before any audit sample is drawn. The independent events guide helps distinguish a mathematical independence assumption from a casual claim that data points are different rows.
For single marked-selection indicators under uniform sampling, the without-replacement mechanism creates negative association. That does not mean the financial positions themselves hedge each other's settlement risk.
Mean and Variance of a Hypergeometric Count
The expected marked count is:
E(X) = n × K/N
The variance is:
Var(X) = n × (K/N) × (1 − K/N) × (N − n)/(N − 1)
For the hypothetical portfolio, the expected count is 5 × 6/20 = 1.5. The variance is 5 × 0.30 × 0.70 × 15/19 ≈ 0.82895, and the standard deviation is about 0.9105 positions.
The final factor, 15/19, is the finite-population correction for this count variance. It reduces dispersion relative to independent binomial sampling with p = 0.30. If the entire population were sampled, X would equal K with certainty, and its variance would be zero.
An expected count of 1.5 is an average across possible samples. An actual five-position sample contains an integer count. The variance guide explains how squared deviations summarize the spread around a distribution's mean.
Exactly Two vs. At Least One Marked Item
Different audit questions require different events. The chance of exactly two marked positions is 35.22%, but the chance of finding at least one is much larger.
The complement is often easiest. A sample with no marked positions must choose all five from the 14 unmarked positions. Therefore:
P(X ≥ 1) = 1 − C(14, 5)/C(20, 5) ≈ 87.09%
This answer does not prove an audit will identify every relevant exposure. It only describes finding at least one position carrying the predefined mark in the stated random sample. An auditor must still decide whether the marking definition and sample design answer the real review question.
Similarly, “at most two” includes counts zero, one, and two. “More than two” excludes two. Write the inequality before selecting a spreadsheet's cumulative flag, especially when a review threshold lies exactly on a possible count.
Calculate Hypergeometric Probabilities in Excel
For exactly two marked positions in the example, enter:
=HYPGEOM.DIST(2,5,6,20,FALSE)
The argument order is marked items in the sample, sample size, marked items in the population, population size, and the cumulative flag. The result is about 0.352167183, or 35.22%.
For no more than two marked items, use:
=HYPGEOM.DIST(2,5,6,20,TRUE)
For at least one, use the complement of zero:
=1-HYPGEOM.DIST(0,5,6,20,TRUE)
That result is about 0.870872033. These formulas use English Excel function names and comma separators; other locale settings can change the separators. Microsoft documents the exact HYPGEOM.DIST syntax, including the distinction between mass and cumulative output.
Hypergeometric vs. Binomial Approximation
If you approximate the five selections as independent with p = 0.30, a binomial model gives:
C(5, 2) × 0.30^2 × 0.70^3 = 30.87%
The exact hypergeometric probability is 35.22%. The difference is about 4.35 percentage points for this question. A sample of five takes one quarter of the 20-position population, so removing items materially changes the remaining pool.
When the sampled fraction is very small, a binomial approximation can be close enough for some purposes. Its adequacy depends on the requested probability and the error tolerance; there is no need to approximate this small example when the exact calculation is readily available.
Do not choose the distribution by which answer looks more favorable. Choose it from the sampling process, then assess any approximation against the decision's accuracy requirements.
Frequently Asked Questions
Does the hypergeometric distribution require independence?
It models a uniform fixed-size sample without replacement. Single draw indicators are generally dependent because selections change the pool. That is why a simple independent-trial binomial formula differs.
What do N, K, n, and x mean?
N is population size, K is the number of marked items in that population, n is sample size, and x is the marked count in the sample. Use counts from the same population and marking rule.
Can this estimate the probability that an event settles Yes?
Not from the portfolio counts alone. The example models sampling positions from a known list. Estimating an event's occurrence probability is a different question requiring a suitable event model and evidence.
Can I use the formula for a handpicked audit sample?
Not without a justified selection model. The standard formula assumes all subsets of the chosen size are equally likely. Preferentially selecting large or suspicious positions changes those chances.