18.4 Mean and Variance of a Binomial Distribution

SL 4.8

In this section you will learn
  • the mean \(\mathrm{E}(X) = np\) and the variance \(\mathrm{Var}(X) = np(1 - p)\) of \(X \sim \mathrm{B}(n, p)\)
  • how to find \(n\) and \(p\) when the mean and variance are given
  • how to use the mean, the mode and binomial probabilities together in applications

The formulae

If a coin with \(\mathrm{P}(\text{head}) = 0.3\) is tossed 50 times, we “expect” about \(50 \times 0.3 = 15\) heads. This is the mean of \(\mathrm{B}(50,\, 0.3)\). In general, \(\mathrm{E}(X)\) is the average value of \(X\) over a large number of repeats of the whole experiment, and \(\mathrm{Var}(X)\) measures how spread out the values of \(X\) are.

Mean and variance of \(X \sim \mathrm{B}(n, p)\) In the formula booklet

\[ \mathrm{E}(X) = np \qquad\qquad \mathrm{Var}(X) = np(1 - p) \]

The standard deviation is \(\sqrt{np(1 - p)}\). Some books write \(q = 1 - p\), so \(\mathrm{Var}(X) = npq\).

  • \(X\): the number of successes, \(X \sim \mathrm{B}(n, p)\)
  • \(n\): the number of trials
  • \(p\): the probability of success in one trial
  • \(q\): the probability of failure in one trial, \(q = 1 - p\)

Notice that \(\mathrm{Var}(X) = \mathrm{E}(X) \times (1 - p)\), so the variance is always less than the mean. Dividing gives a quick way to find \(p\):

\[ \frac{\mathrm{Var}(X)}{\mathrm{E}(X)} = \frac{np(1 - p)}{np} = 1 - p . \]

The IB syllabus says the formal proof is not required.

For one trial, let \(Y = 1\) for a success and \(Y = 0\) for a failure. Then

\[ \mathrm{E}(Y) = 1 \times p + 0 \times (1 - p) = p, \qquad \mathrm{Var}(Y) = \mathrm{E}(Y^2) - p^2 = p - p^2 = p(1 - p) . \]

A binomial variable is the sum of \(n\) such independent variables: \(X = Y_1 + Y_2 + \cdots + Y_n\). Means always add, and for independent variables variances also add. So \(\mathrm{E}(X) = np\) and \(\mathrm{Var}(X) = np(1 - p)\).

Example 1 \(X \sim \mathrm{B}(n, p)\) with \(\mathrm{E}(X) = 10\) and \(\mathrm{Var}(X) = 6\). Find \(n\) and \(p\).

\[ np = 10 \quad (1) \qquad\qquad np(1 - p) = 6 \quad (2) \]

\((2) \div (1)\): \(\;1 - p = \dfrac{6}{10} = 0.6\), so \(p = 0.4\). Then \(n = \dfrac{10}{0.4} = 25\).

Applications

Example 2 A machine makes bolts, and 4% of the bolts are faulty, independently. The bolts are packed in boxes of 50.

(a) Find the expected number of faulty bolts in a box.

(b) Find the probability that a box contains at least 1 but fewer than 4 faulty bolts.

(c) A box is returned if it contains more than 4 faulty bolts. Find the probability that a box is returned.

(d) Find the most likely number of faulty bolts in a box.

Let \(X\) be the number of faulty bolts in a box. \(X \sim \mathrm{B}(50,\, 0.04)\).

(a) \(\mathrm{E}(X) = 50 \times 0.04 = 2\).

(b) $(1 X ) = $ binomCdf\((50, 0.04, 1, 3) = 0.731\).

(c) \(\mathrm{P}(X > 4) = \mathrm{P}(X \ge 5) = 1 - \mathrm{P}(X \le 4) = 0.0490\) (3 s.f.).

(d) Look at the table of binomPdf\((50, 0.04)\):

\(x\) \(0\) \(1\) \(2\) \(3\) \(4\)
\(\mathrm{P}(X = x)\) \(0.1299\) \(0.2706\) \(0.2762\) \(0.1842\) \(0.0902\)

The largest probability is at \(x = 2\), so the most likely number (the mode) is \(2\) (see Figure 1).

Figure 1: The distribution \(\mathrm{B}(50,\, 0.04)\). The mode, \(2\), is shown in red.

Here the mode equals the mean, but this is not always true; \(\mathrm{P}(X = 1)\) is very close.

Example 3 A factory has 120 machines. In any week, each machine needs a repair with probability \(p\), independently. \(X\) is the number of machines that need a repair in a week.

(a) Given that \(40\,\mathrm{Var}(X) = 3\,[\mathrm{E}(X)]^2\), show that \(p = 0.1\).

(b) Find the probability that fewer than 15 machines need a repair in a week.

(a) \(X \sim \mathrm{B}(120, p)\), so \(\mathrm{E}(X) = 120p\) and \(\mathrm{Var}(X) = 120p(1 - p)\).

\[ 40 \times 120p(1 - p) = 3 \times (120p)^2 \;\Longrightarrow\; 4800p(1 - p) = 43\,200p^2 . \]

Divide by \(4800p\) (as \(p \ne 0\)): \(\;1 - p = 9p\), so \(10p = 1\) and \(p = 0.1\).

(b) $(X < 15) = (X ) = $ binomCdf\((120, 0.1, 0, 14) = 0.782\).

Example 4 A multiple-choice test has 25 questions. Each question has five options, and only one is correct. A student guesses every answer at random.

(a) Find the probability that the student gets at least 5 but fewer than 10 correct answers.

(b) Each correct answer earns 4 marks, and each wrong answer loses 1 mark. Find the expected score.

Let \(X\) be the number of correct answers. \(X \sim \mathrm{B}(25,\, 0.2)\).

(a) $(5 X ) = $ binomCdf\((25, 0.2, 5, 9) = 0.562\).

(b) The expected number correct is \(\mathrm{E}(X) = 25 \times 0.2 = 5\), so the expected number wrong is \(25 - 5 = 20\).

\[ \text{Expected score} = 4 \times 5 - 1 \times 20 = 0 . \]

Random guessing gives, on average, a score of \(0\): the penalty is designed to make guessing “fair”. (With the result of 18.2: the score is \(S = 4X - (25 - X) = 5X - 25\), so \(\mathrm{E}(S) = 5 \times 5 - 25 = 0\).)

Common errors

✗ Wrong ✓ Right Why
\(\mathrm{Var}(X) = np\) \(np(1 - p)\) \(np\) is the mean.
Standard deviation \(= np(1 - p)\) \(\sqrt{np(1 - p)}\) The standard deviation is the square root of the variance.
“The most likely value is always \(np\)” Check the table of probabilities \(np\) need not be a whole number, and the mode can differ from the mean.
From \(np = 10\) and \(np(1 - p) = 6\): \(p = 0.6\) \(1 - p = 0.6\), so \(p = 0.4\) The ratio \(\frac{\mathrm{Var}}{\mathrm{E}}\) gives \(1 - p\), not \(p\).

Exercises

1 \(X \sim \mathrm{B}(20,\, 0.35)\). Find \(\mathrm{E}(X)\), \(\mathrm{Var}(X)\) and the standard deviation of \(X\).

\(\mathrm{E}(X) = 20 \times 0.35 = 7\). \(\;\mathrm{Var}(X) = 7 \times 0.65 = 4.55\). Standard deviation \(= \sqrt{4.55} = 2.13\) (3 s.f.).

2 \(X \sim \mathrm{B}(n, p)\) with \(\mathrm{E}(X) = 12\) and \(\mathrm{Var}(X) = 7.2\). Find \(n\) and \(p\).

\(1 - p = \dfrac{7.2}{12} = 0.6\), so \(p = 0.4\) and \(n = \dfrac{12}{0.4} = 30\).

3 \(X \sim \mathrm{B}(n, p)\) has mean \(6\) and standard deviation \(2\). Find \(n\) and \(p\).

\(\mathrm{Var}(X) = 4\). \(\;1 - p = \dfrac{4}{6} = \dfrac{2}{3}\), so \(p = \dfrac{1}{3}\) and \(n = 6 \div \dfrac{1}{3} = 18\).

4 A fair dice is thrown 90 times. Find the mean and the variance of the number of sixes.

\(X \sim \mathrm{B}\left(90, \frac{1}{6}\right)\). \(\;\mathrm{E}(X) = 15\), \(\;\mathrm{Var}(X) = 15 \times \dfrac{5}{6} = 12.5\).

5 \(X \sim \mathrm{B}(16, p)\) with \(p < 0.5\) and \(\mathrm{Var}(X) = 3\). Find \(p\) and \(\mathrm{E}(X)\).

\(16p(1 - p) = 3 \Rightarrow 16p^2 - 16p + 3 = 0 \Rightarrow (4p - 1)(4p - 3) = 0\), so \(p = \frac{1}{4}\) or \(\frac{3}{4}\).

Since \(p < 0.5\), \(p = \dfrac{1}{4}\) and \(\mathrm{E}(X) = 16 \times \dfrac{1}{4} = 4\).

6 8% of flights from an airport are late, independently. On one day there are 75 flights. Find the expected number of late flights, and the probability that the number of late flights is greater than this.

\(X \sim \mathrm{B}(75,\, 0.08)\), \(\;\mathrm{E}(X) = 6\).

$(X > 6) = (X ) = $ binomCdf\((75, 0.08, 7, 75) = 0.394\).

7 A test has 30 multiple-choice questions, each with four options. A student guesses every answer. A correct answer earns 4 marks and a wrong answer loses 1 mark. Find the expected score.

\(X \sim \mathrm{B}(30,\, 0.25)\), \(\;\mathrm{E}(X) = 7.5\) correct and \(22.5\) wrong (on average).

Expected score \(= 4 \times 7.5 - 22.5 = 7.5\) marks.

8 \(X \sim \mathrm{B}(40, p)\) and \(\mathrm{Var}(X) = 0.8\,\mathrm{E}(X)\). Find \(p\), \(\mathrm{E}(X)\) and \(\mathrm{P}\big(X = \mathrm{E}(X)\big)\).

\(1 - p = 0.8\), so \(p = 0.2\) and \(\mathrm{E}(X) = 8\).

$(X = 8) = $ binomPdf\((40, 0.2, 8) = 0.156\).

9 \(X \sim \mathrm{B}(15,\, 0.3)\). Find the mean of \(X\) and the most likely value of \(X\).

\(\mathrm{E}(X) = 4.5\). From the GDC: \(\mathrm{P}(X = 3) = 0.170\), \(\mathrm{P}(X = 4) = 0.219\), \(\mathrm{P}(X = 5) = 0.206\).

The most likely value is \(4\). (The mean \(4.5\) is not a possible value.)

10 \(X \sim \mathrm{B}(10, p)\) with \(\mathrm{Var}(X) = 2.1\) and \(\mathrm{P}(X = 10) < \mathrm{P}(X = 0)\). Find \(p\) and \(\mathrm{P}(X \le 2)\).

\(10p(1 - p) = 2.1 \Rightarrow 10p^2 - 10p + 2.1 = 0 \Rightarrow p = \dfrac{10 \pm \sqrt{100 - 84}}{20} = \dfrac{10 \pm 4}{20}\), so \(p = 0.3\) or \(0.7\).

\(\mathrm{P}(X = 10) = p^{10}\) and \(\mathrm{P}(X = 0) = (1 - p)^{10}\), so \(p^{10} < (1 - p)^{10}\) means \(p < 0.5\). Hence \(p = 0.3\).

$(X ) = $ binomCdf\((10, 0.3, 0, 2) = 0.383\).