In a batch of n products there are k defective items.…
In a batch of $n$ products there are $k$ defective items. Determine the probability that among $m$ randomly chosen products exactly $l$ will be defective.
Explanation of Method
"$m$ products chosen at random" means that every group of $m$ products out of $n$ is equally likely, so we use the classical definition. The number of all groups is $\binom{n}{m}$. A favourable group consists of $l$ defective products chosen from the $k$ defective ones and $m-l$ good products chosen from the $n-k$ good ones; by the multiplication rule there are $\binom{k}{l}\binom{n-k}{m-l}$ such groups. Their ratio is the hypergeometric probability.
Step 1: Combinations
The number of ways to choose $r$ objects out of $s$, without regard to order, is
\[ \binom{s}{r} = \frac{s!}{r!\,(s-r)!}. \]
Example: $\binom{5}{2} = \frac{5\cdot4}{2\cdot1} = 10$.
Step 2: All outcomes
An outcome is a group of $m$ products out of $n$. All groups are equally likely:
\[ \text{number of all outcomes} = \binom{n}{m}. \]
Step 3: Favourable outcomes
The batch consists of $k$ defective and $n-k$ good products. A group with exactly $l$ defective products is formed in two independent choices:
- choose the $l$ defective ones from the $k$ defective: $\binom{k}{l}$ ways;
- choose the remaining $m-l$ from the $n-k$ good ones: $\binom{n-k}{m-l}$ ways.
Every way of the first choice combines with every way of the second (multiplication rule):
\[ \text{number of favourable outcomes} = \binom{k}{l}\binom{n-k}{m-l}. \]
Step 4: The probability
\[ \boxed{P = \frac{\dbinom{k}{l}\dbinom{n-k}{m-l}}{\dbinom{n}{m}}.} \]
It makes sense when $l\le k$ and $m-l\le n-k$ (otherwise there are no favourable groups and $P=0$), i.e. $\max(0,\,m-n+k)\le l\le\min(k,\,m)$.
Step 5: Example
A batch of $n=10$ products contains $k=3$ defective. We take $m=4$. Probability of exactly $l=1$ defective:
\[ P = \frac{\binom31\binom73}{\binom{10}{4}} = \frac{3\cdot35}{210} = \frac{105}{210} = 0.5. \]
The whole distribution of the number of defective products in the sample:
| $l$ | $\binom{3}{l}\binom{7}{4-l}$ | Probability |
|---|---|---|
| $0$ | $1\cdot35=35$ | $35/210\approx 0.167$ |
| $1$ | $3\cdot35=105$ | $105/210\approx 0.500$ |
| $2$ | $3\cdot21=63$ | $63/210\approx 0.300$ |
| $3$ | $1\cdot7=7$ | $7/210\approx 0.033$ |
| total | $210$ | $1$ ✓ |
The probabilities add up to $1$, because every group of $4$ has some number of defective products (Vandermonde's identity $\sum_l\binom{k}{l}\binom{n-k}{m-l}=\binom{n}{m}$).
Step 6: Where this formula is used
Quality control (defective items in a sample), lotteries (how many of your numbers are drawn), card games (how many aces in a hand) — every time objects are drawn without replacement from a group made of two kinds.
Result
| Answer | |
|---|---|
| Probability of exactly $l$ defective among $m$ | $P=\dfrac{\binom{k}{l}\binom{n-k}{m-l}}{\binom{n}{m}}$ |
| Valid range | $\max(0,\,m-n+k)\le l\le\min(k,\,m)$ |