Educerie

Educerie · IB Diploma · Mathematics: analysis and approaches

IB Mathematics AA 4.8 · SL and HL

The binomial distribution

When the same chance event is tried a fixed number of times, how likely is each possible number of successes, and how many should you expect?

What you will learn

  • Know the four conditions that make a binomial model appropriate.
  • Understand where binomial probabilities come from, by counting routes through a tree.
  • Know the mean np and variance np(1 − p) of a binomial distribution.
  • Understand how words such as "at least" and "fewer than" become whole-number ranges.

You must be able to

  1. Calculate binomial probabilities, single and cumulative, with a GDC.
  2. State the assumptions for a binomial model in the context of the question.
  3. Calculate the mean, variance and standard deviation of a binomial variable.
  4. Calculate n and p from a given mean and variance.
  5. Solve for the least number of trials so that at least one success passes a given probability.
  6. Solve two-stage problems where a binomial probability feeds a conditional or a second model.

In the exam. almost always Paper 2, as 4 to 7 marks inside a longer probability question: define the variable, find P(X=r)\mathrm{P}(X = r), P(X≥r)\mathrm{P}(X \ge r) or a range with your GDC, then use the answer in a later part. Some parts are pure algebra, such as finding nn and pp from a given mean and variance. Section B questions often join this page to the normal distribution (4.9): a normal model gives the probability of one item being faulty, and the binomial counts the faulty items in a batch.

1When the binomial model fits

A binomial random variable = the number of successes in a set of trials. It is the right model only when all four of these hold. Figure 1 lays them out as a checklist.

  1. A fixed number of trials, nn, decided before you start.
  2. Two outcomes per trial, success or failure. "Success" is just the outcome you are counting. It can be a faulty bulb.
  3. The same probability of success, pp, on every trial.
  4. The trials are independent. The result of one does not change the probability for another.
Figure 1 · Four questions before you write X ~ B(n, p) 1 · Fixed number? n trials, decided before you start 2 · Two outcomes? each trial is a success or a failure 3 · Same p? the probability of success is the same every trial 4 · Independent? one trial's result does not change another's All four hold: X = number of successes ~ B(n, p) Fails a test, so not binomial: rolling until the first six (no fixed n) · drawing 5 cards from 20 without replacement (p changes) Four yeses and the number of successes is binomial. One no and it is not.
Figure 1 · Four questions before you write X ~ B(n, p)
  • Practise judging examples, because the exam asks you to.
    • Binomial: guessing a test. A student guesses every answer on a 10-question test with 4 options each. XX is the number correct. n=10n = 10 is fixed, each answer is correct or wrong, p=14p = \tfrac{1}{4} each time, and one guess does not affect the next. X∼B(10,0.25)X \sim \mathrm{B}(10, 0.25).
    • Not binomial: rolling for a six. You roll a die until you get a six, and XX is the number of rolls. There is no fixed nn. The count of trials is the thing that varies.
    • Not binomial: tiles without replacement. You take 4 tiles from 12, of which 5 are blue, without putting any back. The first is blue with probability 512\tfrac{5}{12}, the next 411\tfrac{4}{11} if a blue has gone. pp changes, so the trials are not independent. Put each back and it would be binomial.
    • Doubtful: ferry cancellations. XX is the number of days in a week on which a ferry is cancelled. n=7n = 7 is fixed, with two outcomes. But one storm can cancel several days running, so independence is doubtful. A binomial model is a weak assumption you would have to state.
  • Real samples are usually drawn without replacement. Choose 12 people from a city of 600 000: removing one changes the proportion of the rest negligibly. The binomial is then an excellent approximation, and the exam treats it as the model.
    • When the population is small, as with the 12 tiles, it is not.
  • When a question asks you to state an assumption, name the condition that could fail, in the context's own words.
    • Example: "the probability that a seed germinates is the same for every seed." And: "seeds germinate independently of one another." A bare list of the four conditions does not answer the question.

X∼B(n,p)X \sim \mathrm{B}(n, p) needs: fixed nn, two outcomes, constant pp, independent trials. Define XX in words every time: "XX is the number of seeds, out of 20, that germinate."

2Where the probabilities come from

Example: a student guesses three questions, each with four options. The probability of guessing a question correctly is 14\tfrac{1}{4} and of getting it wrong is 34\tfrac{3}{4}. Let XX be the number correct. Figure 2 draws the tree.

Figure 2 · Three guessed questions, every route through the tree 1/4 C 3/4 W 1/4 C 3/4 W 1/4 C 3/4 W 1/4 C 3/4 W 1/4 C 3/4 W 1/4 C 3/4 W 1/4 C 3/4 W Q1 Q2 Q3 route X prob. CCC 3 1/64 CCW 2 3/64 CWC 2 3/64 CWW 1 9/64 WCC 2 3/64 WCW 1 9/64 WWC 1 9/64 WWW 0 27/64 Three routes give exactly 2 correct, each with probability (1/4)²(3/4) = 3/64, so P(X = 2) = 3 × 3/64 = 9/64.
Figure 2 · Three guessed questions, every route through the tree

There are 23=82^{3} = 8 routes. Take the three routes with exactly two correct: CCW, CWC and WCC. Each has two C branches and one W branch, so each has probability (14)2×34=364\left(\tfrac{1}{4}\right)^{2} \times \tfrac{3}{4} = \tfrac{3}{64}, whatever the order. There are three of them, so

P(X=2)=3×(14)2×343 routes, each with probability 364=964\begin{aligned}\mathrm{P}(X &= 2) = 3 \times \left(\frac{1}{4}\right)^{2} \times \frac{3}{4} && \textcolor{#838c91}{\text{3 routes, each with probability }\tfrac{3}{64}} \\[6pt] &= \frac{9}{64}\end{aligned}

Every route with rr successes out of nn has the same probability, pr(1−p)n−rp^{r}(1-p)^{n-r}. The number of such routes is the number of ways to choose which rr of the nn trials are the successes, nCr{}^{n}\mathrm{C}_{r}. So

P(X=r)=nCr×pr×(1−p)n−r,r=0,1,2,…,n\mathrm{P}(X = r) = {}^{n}\mathrm{C}_{r} \times p^{r} \times (1-p)^{n-r}, \qquad r = 0, 1, 2, \dots, n
  • The four values for three guesses are 2764\tfrac{27}{64}, 2764\tfrac{27}{64}, 964\tfrac{9}{64} and 164\tfrac{1}{64} for X=0,1,2,3X = 0, 1, 2, 3. They add to 6464=1\tfrac{64}{64} = 1, as a probability distribution must.
  • The numbers of routes, 1,3,3,11, 3, 3, 1, are the row of binomial coefficients you met in 1.9. That is why it is the binomial distribution: the probabilities are the terms of the expansion of (q+p)n(q + p)^{n}, where q=1−pq = 1 - p.
    • The triangle of these coefficients carries Pascal's name. The Chinese mathematician Yang Hui wrote about it in the 13th century, long before Pascal.
  • You need this formula to understand the distribution and for the few cases that need no calculator.
    • P(X=0)=(1−p)n\mathrm{P}(X = 0) = (1-p)^{n}, because every trial must fail.
    • P(X=n)=pn\mathrm{P}(X = n) = p^{n}, because every trial must succeed.
    • A small case like the one above.
  • The guide says binomial probabilities in examinations are found with technology, so in the exam you use the GDC.

3Using the GDC, and turning words into numbers

Every GDC has two binomial functions. Their names differ by model, but they do the same two jobs.

What you wantFunctionTI-84 Plus nameCasio name
P(X=r)\mathrm{P}(X = r), one valuebinomial pdfbinompdf(n,p,r)\mathrm{binompdf}(n, p, r)Binomial PD
P(X≤r)\mathrm{P}(X \le r), everything up to and including rrbinomial cdfbinomcdf(n,p,r)\mathrm{binomcdf}(n, p, r)Binomial CD
  • Some models (TI-Nspire, Casio) let the cumulative function take a lower and an upper bound. Others take only the upper bound, and you subtract. Either way, the cumulative function counts up from 0 and includes rr itself. Every mistake here comes from forgetting half of that sentence.
  • Turn the exam's wording into whole numbers first. XX can only be 0,1,2,…0, 1, 2, \dots. So "fewer than 4" and "at most 3" are the same event, and "more than 4" is "at least 5".
  • Figure 3 rings the values for each range phrase. "Between 2 and 6 inclusive" is most often got wrong: it is the cdf at 66 minus the cdf at 11, not at 22.
WordsValues of XXOn the GDC
exactly 444pdf at 44
at most 4, no more than 400 to 44cdf at 44
fewer than 4, less than 400 to 33cdf at 33
at least 4, no fewer than 444 to nn1−1 - cdf at 33
more than 455 to nn1−1 - cdf at 44
between 2 and 6 inclusive22 to 66cdf at 6−6 - cdf at 11
Figure 3 · Turning the words into whole numbers, X ~ B(10, p) at most 4 0 1 2 3 4 5 6 7 8 9 10 P(X ≤ 4) fewer than 4 0 1 2 3 4 5 6 7 8 9 10 P(X ≤ 3) at least 4 0 1 2 3 4 5 6 7 8 9 10 P(X ≥ 4) = 1 − P(X ≤ 3) more than 4 0 1 2 3 4 5 6 7 8 9 10 P(X ≥ 5) = 1 − P(X ≤ 4) 2 to 6 inclusive 0 1 2 3 4 5 6 7 8 9 10 P(2 ≤ X ≤ 6) = P(X ≤ 6) − P(X ≤ 1) Draw the line and ring the values before you press a key. "Fewer than 4" stops at 3.
Figure 3 · Turning the words into whole numbers, X ~ B(10, p)

The "at least" line uses the complement. P(X≥4)\mathrm{P}(X \ge 4) is everything from 44 upwards, which is everything except 00, 11, 22 and 33. So P(X≥4)=1−P(X≤3)\mathrm{P}(X \ge 4) = 1 - \mathrm{P}(X \le 3). The number after "1−1 -" is always one less than the number in the question.

Worked example 1: ten guesses. A student guesses all 10 questions on a test where each has four options. Let XX be the number correct, so X∼B(10,0.25)X \sim \mathrm{B}(10, 0.25). Figure 4 shows the whole distribution.

Figure 4 · The distribution of X ~ B(10, 0.25) 0 1 2 3 4 5 6 7 8 9 10 x, number correct out of 10 guesses 0 0.05 0.1 0.15 0.2 0.25 0.3 P(X = x) 0.056 0.188 0.282 0.250 0.146 0.058 mean np = 2.5 Most of the probability sits at 1, 2, 3 and 4 correct. The mean, np = 2.5, is the balance point.
Figure 4 · The distribution of X ~ B(10, 0.25)
P(X=3)=binompdf(10,0.25,3)=0.250exactly 3\mathrm{P}(X = 3) = \mathrm{binompdf}(10, 0.25, 3) = 0.250 \qquad \textcolor{#838c91}{\text{exactly 3}}P(X≤2)=binomcdf(10,0.25,2)=0.526at most 2\mathrm{P}(X \le 2) = \mathrm{binomcdf}(10, 0.25, 2) = 0.526 \qquad \textcolor{#838c91}{\text{at most 2}}P(X≥5)=1−P(X≤4)=1−binomcdf(10,0.25,4)at least 5=0.0781\begin{aligned}\mathrm{P}(X \ge 5) &= 1 - \mathrm{P}(X \le 4) = 1 - \mathrm{binomcdf}(10, 0.25, 4) && \textcolor{#838c91}{\text{at least 5}} \\[6pt] &= 0.0781\end{aligned}

So a student who passes by getting at least half the questions right has less than an 8% chance of doing it by pure guessing.

Worked example 2: vending machine. A machine hands over the right drink with probability 0.940.94 on each purchase, independently. During a morning 30 people use it. Let DD be the number served correctly, so D∼B(30,0.94)D \sim \mathrm{B}(30, 0.94).

P(D=28)=0.277\mathrm{P}(D = 28) = 0.277P(D≥29)=1−P(D≤28)=0.455\mathrm{P}(D \ge 29) = 1 - \mathrm{P}(D \le 28) = 0.455P(D<27)=P(D≤26)=0.103fewer than 27 stops at 26\mathrm{P}(D < 27) = \mathrm{P}(D \le 26) = 0.103 \qquad \textcolor{#838c91}{\text{fewer than 27 stops at }26}P(25≤D≤28)=P(D≤28)−P(D≤24)=0.537subtract the cdf at 24, not 25\mathrm{P}(25 \le D \le 28) = \mathrm{P}(D \le 28) - \mathrm{P}(D \le 24) = 0.537 \qquad \textcolor{#838c91}{\text{subtract the cdf at }24\text{, not }25}

Write the probability statement, such as P(D≤26)\mathrm{P}(D \le 26), before the number. It shows the whole numbers you chose, so a keying slip can still earn the method mark.

Worked example 3: given that. A lab sets up 14 bacterial cultures. Each grows with probability 0.650.65, independently. Let GG be the number that grow, so G∼B(14,0.65)G \sim \mathrm{B}(14, 0.65). Given that at least 8 grow, find the probability that fewer than 12 grow.

This is conditional probability (4.6) with binomial numbers. The condition G≥8G \ge 8 is the denominator. The numerator is the part of it that also meets G<12G < 12, which is 8≤G≤118 \le G \le 11.

P(G<12∣G≥8)=P(8≤G≤11)P(G≥8)the overlap, over the condition=P(G≤11)−P(G≤7)1−P(G≤7)=0.7320.816=0.897\begin{aligned}\mathrm{P}(G < 12 \mid G \ge 8) &= \frac{\mathrm{P}(8 \le G \le 11)}{\mathrm{P}(G \ge 8)} && \textcolor{#838c91}{\text{the overlap, over the condition}} \\[6pt] &= \frac{\mathrm{P}(G \le 11) - \mathrm{P}(G \le 7)}{1 - \mathrm{P}(G \le 7)} = \frac{0.732}{0.816} = 0.897\end{aligned}

The usual slip is to divide by P(G<12)\mathrm{P}(G < 12) instead, or to leave the denominator out.

A fixed position for the last success

  • Some questions say when a success arrives. Example: "the second hit comes on the sixth shot" for a shooter who hits with probability 0.350.35.
  • That means exactly one hit in the first five shots, in any order, and then a hit on shot six. The first five shots are binomial. The sixth is a single fixed outcome.
P=[5C1×0.35×0.654]×0.35=0.109\mathrm{P} = \left[{}^{5}\mathrm{C}_{1} \times 0.35 \times 0.65^{4}\right] \times 0.35 = 0.109
  • Do not use P(X=2)\mathrm{P}(X = 2) for six shots here. That allows the second hit to come earlier or later.

Percentages and the model

  • Thresholds are often stated as a percentage of the sample. Turn it into a whole number of successes.
  • Example: a survey team phones 40 households, each answering with probability 0.30.3, independently. The results count only if at least 25% of the households answer. 25%×40=1025\% \times 40 = 10, so the results count when A≥10A \ge 10, where A∼B(40,0.3)A \sim \mathrm{B}(40, 0.3). Then P(A≥10)=1−P(A≤9)=0.804\mathrm{P}(A \ge 10) = 1 - \mathrm{P}(A \le 9) = 0.804.
  • If the percentage is not a whole number, use the whole number the words allow. "More than 20% of 25" is more than 5, so X≥6X \ge 6.

4Mean and variance

The formula booklet gives, for X∼B(n,p)X \sim \mathrm{B}(n, p):

E(X)=np\mathrm{E}(X) = np and Var(X)=np(1−p)\mathrm{Var}(X) = np(1-p). The standard deviation is np(1−p)\sqrt{np(1-p)}.

  • The mean is the expected number of occurrences from 4.5 under a new name. Example: guess 10 questions with p=0.25p = 0.25 and you expect 10×0.25=2.510 \times 0.25 = 2.5 correct.
    • No single test gives 2.52.5. E(X)\mathrm{E}(X) is the long-run average, so it need not be a whole number and is not rounded to one. Figure 4 marks it as the balance point of the bars.
  • For ten guesses, Var(X)=10×0.25×0.75=1.875\mathrm{Var}(X) = 10 \times 0.25 \times 0.75 = 1.875, and the standard deviation is 1.875=1.37\sqrt{1.875} = 1.37 (3 s.f.). For the vending machine, E(D)=30×0.94=28.2\mathrm{E}(D) = 30 \times 0.94 = 28.2 and Var(D)=30×0.94×0.06=1.692\mathrm{Var}(D) = 30 \times 0.94 \times 0.06 = 1.692.
  • The most likely value is a whole number next to the mean: D=29D = 29 here, X=2X = 2 for B(10,0.25)\mathrm{B}(10, 0.25).
  • Counting failures instead of successes swaps the roles of pp and 1−p1-p. If M=30−DM = 30 - D is the number of wrong drinks, then M∼B(30,0.06)M \sim \mathrm{B}(30, 0.06).
    • Its mean is 1.81.8, so the two means add to 3030. Its variance is the same 1.6921.692, because p(1−p)p(1-p) does not change when pp and 1−p1-p trade places.

When pp is not given

  • Sometimes the probability has to come from data. The relative frequency of success in a long run of trials is the best estimate of pp.
  • Example: in a sample of 80 roof tiles, 14 are cracked, so take p=1480=0.175p = \tfrac{14}{80} = 0.175. In the next 40 tiles, X∼B(40,0.175)X \sim \mathrm{B}(40, 0.175). The expected number of cracked tiles is 40×0.175=740 \times 0.175 = 7 and the variance is 40×0.175×0.825=5.77540 \times 0.175 \times 0.825 = 5.775.
    • The first 80 tiles only fixed pp. The nn in the model is the number of tiles you are now asked about.
  • The factor p(1−p)p(1-p) is largest when p=0.5p = 0.5 and shrinks towards 0 as pp approaches 0 or 1. When success is almost certain, or almost impossible, the results hardly vary. Figure 5 shows three distributions with n=10n = 10.
    • The peak sits at or next to npnp.
    • The distribution is symmetric when p=0.5p = 0.5.
    • Otherwise its bulk sits towards whichever end pp is close to, with the longer tail stretching the other way.
Figure 5 · Same n = 10, three values of p p = 0.2 (np = 2) 0 2 4 6 8 10 x 0 0.1 0.2 0.3 P(X = x) p = 0.5 (np = 5) 0 2 4 6 8 10 x p = 0.8 (np = 8) 0 2 4 6 8 10 x The peak sits near np. Small p leans left, p = 0.5 is symmetric, large p leans right.
Figure 5 · Same n = 10, three values of p

The guide does not ask you to prove these formulas, only to use them. A common use is finding nn and pp from a given mean and variance. Divide the variance by the mean and nn cancels.

Worked example 4: find n and p. X∼B(n,p)X \sim \mathrm{B}(n, p) with E(X)=15\mathrm{E}(X) = 15 and Var(X)=3.75\mathrm{Var}(X) = 3.75.

np=15andnp(1−p)=3.75np = 15 \quad\text{and}\quad np(1-p) = 3.751−p=3.7515=0.25divide the second equation by the first1 - p = \frac{3.75}{15} = 0.25 \qquad \textcolor{#838c91}{\text{divide the second equation by the first}}p=0.75p = 0.75n=150.75=20n = \frac{15}{0.75} = 20

Check: 20×0.75×0.25=3.7520 \times 0.75 \times 0.25 = 3.75. On Paper 2 the question might go on: find P(X=15)\mathrm{P}(X = 15). With X∼B(20,0.75)X \sim \mathrm{B}(20, 0.75), that is 0.2020.202 (3 s.f.).

  • Two variations are examined.
    • Variance and nn given. pp comes from a quadratic, so there are two values. For n=40n = 40 and Var(X)=6.4\mathrm{Var}(X) = 6.4, see below.
    • The mean limits nn. Because 0≤p≤10 \le p \le 1, the mean npnp can never exceed nn. A binomial with mean 3.53.5 needs n≥4n \ge 4.
40p(1−p)=6.4  ⇒  p2−p+0.16=0divide by 40 and rearrange40p(1-p) = 6.4 \;\Rightarrow\; p^{2} - p + 0.16 = 0 \qquad \textcolor{#838c91}{\text{divide by 40 and rearrange}}p=1±1−0.642=1±0.62,p=0.2 or p=0.8p = \frac{1 \pm \sqrt{1 - 0.64}}{2} = \frac{1 \pm 0.6}{2}, \quad p = 0.2 \text{ or } p = 0.8

Both give the same variance, since swapping success and failure does not change the spread. The context picks one: a given mean, or a statement that p<0.5p < 0.5.

5Finding n: "the least number of trials so that…"

The most common version asks for the smallest nn that makes "at least one success" likely enough. The complement makes it neat: "at least one" is "not none".

Worked example 5: scratch cards. Each card in a scratch game wins a prize with probability 0.150.15, independently. Find the least number of cards a player must buy so that the probability of at least one win is greater than 0.90.9.

Let XX be the number of winning cards out of nn, so X∼B(n,0.15)X \sim \mathrm{B}(n, 0.15).

P(X≥1)=1−P(X=0)=1−0.85nnone win: every card fails\mathrm{P}(X \ge 1) = 1 - \mathrm{P}(X = 0) = 1 - 0.85^{n} \qquad \textcolor{#838c91}{\text{none win: every card fails}}1−0.85n>0.91 - 0.85^{n} > 0.90.85n<0.10.85^{n} < 0.1n>ln⁡0.1ln⁡0.85=14.17…dividing by ln⁡0.85<0 flips the inequalityn > \frac{\ln 0.1}{\ln 0.85} = 14.17\ldots \qquad \textcolor{#838c91}{\text{dividing by }\ln 0.85 < 0\text{ flips the inequality}}n=15n = 15
  • The logarithm step reverses the inequality because ln⁡0.85\ln 0.85 is negative.
  • The GDC is a safer route: tabulate y=1−0.85xy = 1 - 0.85^{x} and read down the table. At n=14n = 14 the value is 0.8970.897, just short. At n=15n = 15 it is 0.9130.913. Figure 6 plots those values.
  • Either way, show both neighbours in your working. 1414 fails and 1515 works is what proves 1515 is the least.
Figure 6 · P(at least one win) as the number of cards grows 0 2 4 6 8 10 12 14 16 18 20 n, number of cards bought 0 0.2 0.4 0.6 0.8 0.9 1 P(at least one win) target 0.9 n = 14: 0.897, just short n = 15: 0.913, first above 0.9 The dots cross 0.9 between n = 14 and n = 15, so 15 cards is the smallest number that works.
Figure 6 · P(at least one win) as the number of cards grows

The same GDC table method handles harder versions where the complement is not a single term, such as "the least nn so that P(X≥3)>0.95\mathrm{P}(X \ge 3) > 0.95". Tabulate 1−binomcdf(n,p,2)1 - \mathrm{binomcdf}(n, p, 2) against nn and find the first value that passes.

Reliability

  • A system that works as long as at least one part works is an "at least one" problem.
  • Example: an alarm relies on independent sensors, each of which detects a fault with probability 0.70.7. Find the least number of sensors that makes the alarm work with probability above 0.9990.999. Here 1−0.3n>0.9991 - 0.3^{n} > 0.999, so 0.3n<0.0010.3^{n} < 0.001 and n>ln⁡0.001÷ln⁡0.3=5.74…n > \ln 0.001 \div \ln 0.3 = 5.74\ldots.
  • Check the neighbours: n=5n = 5 gives 0.99760.9976, which falls short, and n=6n = 6 gives 0.99930.9993. So n=6n = 6.
  • Questions of this kind often ask you to justify a choice between two set-ups. Compute the same probability for each and compare the numbers.

Two-stage problems

  • A binomial count often sits on top of another probability.
  • Example: a machine fills bottles, and the probability that one is underfilled comes first from a normal model (4.9). The number of underfilled bottles in a crate of 24 is then B(24,\mathrm{B}(24, that probability)). The expected number is 2424 times it.
  • Keep the first probability to full calculator accuracy when you use it as pp. Rounding it to two figures can change the third figure of the final answer.
  • When some trials have already happened, only the remaining ones are random. Example: a target of at least 17 successes in 20 trials, with 12 banked from the first 14, needs at least 5 more from the last 6.

Practice questions

39 questions on this note, from easy to hard. Each one you get right lights a star of this topic's constellation.