This note covers the binomial distribution, the model for counting successes in a fixed number of independent trials. It is used for quality control, medical trials, survey results and any situation where each attempt either works or does not.
Key ideas
A random variable \(X\) follows a binomial distribution when all of these hold:
- there is a fixed number \(n\) of trials;
- each trial has only two outcomes, called "success" and "failure";
- the probability of success, \(p\), is the same every time;
- the trials are independent, so one result does not change the next.
We write \(X \sim B(n, p)\). Here \(X\) counts the number of successes, so it takes the values \(0, 1, 2, \dots, n\). The probability of failure is \(1 - p\), often written \(q\).
Why the formula works. One particular sequence with exactly \(r\) successes and \(n - r\) failures has probability \(p^r (1-p)^{n-r}\), because the trials are independent. There are \(\binom{n}{r}\) different orders in which the \(r\) successes can appear. Multiplying gives the formula below.
Using a calculator. In practice you use the binomial probability function on your GDC for \(P(X = r)\), and the binomial cumulative distribution function for \(P(X \le r)\). The cumulative function always adds from 0 up to and including \(r\). To handle other inequalities, rewrite them first:
- \(P(X \lt r) = P(X \le r-1)\)
- \(P(X \ge r) = 1 - P(X \le r-1)\)
- \(P(X \gt r) = 1 - P(X \le r)\)
- \(P(a \le X \le b) = P(X \le b) - P(X \le a-1)\)
The mean (expected number of successes) is \(np\), and the variance is \(np(1-p)\). The standard deviation is the square root of the variance. The mean is intuitive: in 50 trials with success probability 0.2, you expect 10 successes.
The model fails when trials are not independent or the probability changes. Drawing cards from a pack without putting them back is a classic example, because each draw changes the pack.
Spotting a binomial situation. Ask four quick questions. Is the number of trials fixed in advance? Are there only two outcomes? Is the chance of success the same each time? Are the trials independent? If the answer to all four is yes, use \(B(n, p)\). For example, the number of sixes in 15 rolls of a fair die is binomial with \(n = 15\) and \(p = \dfrac{1}{6}\). The number of rolls needed to get the first six is not binomial, because the number of trials is not fixed.
Shape. When \(p = 0.5\) the distribution is symmetrical. When \(p\) is small the bars are bunched near 0 and the tail stretches to the right. When \(p\) is close to 1 the bars are bunched near \(n\). The most likely value is close to the mean \(np\).
Definitions and formulae
| Term or formula | Meaning / when to use |
|---|---|
| \(X \sim B(n, p)\) | \(X\) is the number of successes in \(n\) independent trials, each with success probability \(p\). |
| \(P(X = r) = \dbinom{n}{r} p^r (1-p)^{n-r}\) | Probability of exactly \(r\) successes, for \(r = 0, 1, \dots, n\). |
| \(\dbinom{n}{r} = \dfrac{n!}{r!\,(n-r)!}\) | Number of ways to choose which \(r\) of the \(n\) trials are successes. |
| \(E(X) = np\) | Mean number of successes. |
| \(\mathrm{Var}(X) = np(1-p)\) | Variance of the number of successes. |
| \(P(X \ge r) = 1 - P(X \le r-1)\) | Complement method, needed because the cumulative function only adds from the bottom. |
Worked examples
Example 1 A machine makes LED bulbs. Each bulb is faulty with probability 0.08, independently of the others. A box holds 12 bulbs. Find the probability that a box contains (a) exactly 2 faulty bulbs, (b) at most 1 faulty bulb, (c) at least 1 faulty bulb.
Let \(X\) be the number of faulty bulbs. Then \(X \sim B(12, 0.08)\).
(a) \(P(X=2) = \dbinom{12}{2}(0.08)^2(0.92)^{10} = 66 \times 0.0064 \times 0.43439\dots \approx 0.183\). (Or use the binomial probability function with \(n = 12\), \(p = 0.08\), \(r = 2\).)
(b) Use the binomial cumulative distribution function with \(r = 1\): \(P(X \le 1) = 0.7513\dots \approx 0.751\).
(c) \(P(X \ge 1) = 1 - P(X = 0) = 1 - 0.92^{12} = 1 - 0.36766\dots = 0.632\).
Answer: (a) 0.183; (b) 0.751; (c) 0.632.
Example 2 A basketball player scores each free throw with probability 0.35, independently. She takes 20 throws. Find the probability she scores between 5 and 9 throws inclusive. Then find the mean and standard deviation of the number scored.
\(X \sim B(20, 0.35)\). We want \(P(5 \le X \le 9) = P(X \le 9) - P(X \le 4)\).
Using the binomial cumulative distribution function: \(P(X \le 9) = 0.8782\dots\) and \(P(X \le 4) = 0.1182\dots\).
So \(P(5 \le X \le 9) = 0.8782 - 0.1182 = 0.760\).
Mean: \(np = 20 \times 0.35 = 7\).
Variance: \(np(1-p) = 20 \times 0.35 \times 0.65 = 4.55\), so the standard deviation is \(\sqrt{4.55} \approx 2.13\).
Answer: probability 0.760; mean 7; standard deviation 2.13.
Example 3 A random variable \(X \sim B(n, p)\) has mean 12 and variance 7.2. Find \(n\) and \(p\). Then, for this distribution, find \(P(X = 12)\).
The mean gives \(np = 12\). The variance gives \(np(1-p) = 7.2\).
Divide the second equation by the first: \(1 - p = \dfrac{7.2}{12} = 0.6\), so \(p = 0.4\).
Then \(n = \dfrac{12}{0.4} = 30\).
So \(X \sim B(30, 0.4)\) and \(P(X=12) = \dbinom{30}{12}(0.4)^{12}(0.6)^{18} \approx 0.147\) (use the binomial probability function).
Answer: \(n = 30\), \(p = 0.4\), \(P(X=12) = 0.147\).
Common errors
- Common error: finding \(P(X \ge r)\) as \(1 - P(X \le r)\). That removes the value \(r\) too. The correct form is \(1 - P(X \le r-1)\).
- Common error: using the cumulative function for "exactly \(r\)", or the single-value function for "at most \(r\)".
- Common error: using a binomial model without checking the conditions, for example when items are drawn without replacement from a small group.
- Common error: writing the variance as \(np\). The variance is \(np(1-p)\), and the standard deviation is its square root.
- Common error: mixing up \(p\) and \(1-p\) in the formula. The power of \(p\) is the number of successes.
Exam tip: Start by writing \(X \sim B(n, p)\) with the numbers filled in, and say what "success" means. Then translate the wording ("at least", "fewer than", "between") into cumulative form before you touch the calculator.
Check yourself
- Two cards are dealt from a standard pack without replacement. Why is the number of hearts not binomially distributed?
Answer
The trials are not independent. After the first card is dealt, the probability that the second is a heart changes, so \(p\) is not constant. - \(X \sim B(8, 0.5)\). Find \(P(X = 3)\) exactly.
Answer
\(\dbinom{8}{3}(0.5)^3(0.5)^5 = 56 \times \dfrac{1}{256} = \dfrac{7}{32} \approx 0.219\). - \(X \sim B(10, 0.3)\). Find \(P(X \ge 1)\).
Answer
\(1 - P(X=0) = 1 - 0.7^{10} = 1 - 0.02825 = 0.972\). - \(X \sim B(n, p)\) has mean 18 and variance 7.2. Find \(n\) and \(p\).
Answer
\(1 - p = \dfrac{7.2}{18} = 0.4\), so \(p = 0.6\) and \(n = \dfrac{18}{0.6} = 30\).