9C

Variance and standard deviation

The variance and standard deviation of a discrete random variable, the two formulas for variance, and the variance of a linear function aX + b.

Two games can have the same expected gain but feel completely different: one pays $\$1$ often, the other pays $\$1000$ rarely. The mean can't tell them apart. We need a number that measures how spread out the values are around the mean, and that is the variance.

Measuring spread

Each value $x$ is a distance $x - \mu$ from the mean. Squaring makes every distance positive (otherwise they would cancel), and big distances count for more. The variance is the expected value of those squared distances.

Variance and standard deviation
$$\text{Var}(X) = E\big((X - \mu)^2\big) = \sum (x - \mu)^2 P(X = x) \qquad \sigma = \sqrt{\text{Var}(X)}$$

The standard deviation $\sigma$ is in the same units as $X$, which makes it easier to interpret than the variance.

Example 1: using the definition●●

Find the variance and standard deviation for this distribution, which has $\mu = 1.7$ (from 9B).

$x$$0$$1$$2$$3$
$P(X = x)$$0.1$$0.3$$0.4$$0.2$
$(x - \mu)^2$$2.89$$0.49$$0.09$$1.69$
$\text{Var}(X) = 2.89(0.1) + 0.49(0.3) + 0.09(0.4) + 1.69(0.2)$
Multiply each squared distance by its probability, and add.
$= 0.289 + 0.147 + 0.036 + 0.338 = 0.81$
$\sigma = \sqrt{0.81} = 0.9$
Take the square root.

The quicker formula

Variance, rearranged
$$\text{Var}(X) = E(X^2) - \mu^2 \qquad\text{where } E(X^2) = \sum x^2 P(X = x)$$

In words: the mean of the squares minus the square of the mean. It avoids subtracting $\mu$ from every value, which saves a lot of arithmetic when $\mu$ is a messy decimal.

Why the two formulas agree

Expand the square: $\sum (x - \mu)^2 P(X = x) = \sum x^2 P(X = x) - 2\mu\sum xP(X = x) + \mu^2\sum P(X = x)$.

The three sums are $E(X^2)$, $\mu$ and $1$. So the variance is $E(X^2) - 2\mu^2 + \mu^2 = E(X^2) - \mu^2$.

Example 2: three coins●●

$X$ is the number of heads when three coins are tossed. Find $\text{Var}(X)$ and $\sigma$.

$\mu = 1.5$
The distribution is symmetric, so the mean is the centre.
$E(X^2) = 0 \times \tfrac18 + 1 \times \tfrac38 + 4 \times \tfrac38 + 9 \times \tfrac18 = \tfrac{24}{8} = 3$
Square each value, then weight by the probabilities 1/8, 3/8, 3/8, 1/8.
$\text{Var}(X) = 3 - 1.5^2 = 0.75$
Mean of the squares minus the square of the mean.
$\sigma = \sqrt{0.75} \approx 0.866$
Example 3: a fair die●●●

Find the variance and standard deviation of the score on a fair die.

$\mu = 3.5$
Uniform on 1 to 6, so the mean is the middle.
$E(X^2) = \tfrac16(1 + 4 + 9 + 16 + 25 + 36) = \tfrac{91}{6}$
Each square has probability 1/6.
$\text{Var}(X) = \tfrac{91}{6} - \tfrac{49}{4} = \tfrac{182 - 147}{12} = \tfrac{35}{12} \approx 2.92$, and $\sigma \approx 1.71$.

Linear changes

Adding $b$ to every value slides the whole distribution along without changing its spread. Multiplying by $a$ stretches every distance from the mean by $a$, so every squared distance by $a^2$.

Variance of aX + b
$$\text{Var}(aX + b) = a^2\,\text{Var}(X) \qquad \text{SD}(aX + b) = |a|\,\sigma$$
Example 4●

For the distribution in Example 1, $\text{Var}(X) = 0.81$. Find the variance and standard deviation of $Y = 3X - 2$.

$\text{Var}(Y) = 3^2 \times 0.81 = 7.29$
The −2 has no effect on spread; the 3 is squared.
$\text{SD}(Y) = \sqrt{7.29} = 2.7$, which is $3 \times 0.9$.

Your turn

$X$ takes values $1, 2, 3$ with probabilities $0.2$, $0.5$, $0.3$. Find the standard deviation of $X$.

Show the working

$\mu = 0.2 + 1 + 0.9 = 2.1$. $E(X^2) = 0.2 + 2 + 2.7 = 4.9$. $\text{Var}(X) = 4.9 - 4.41 = 0.49$, so $\sigma = 0.7$.

Flashcards
$ ext{Var}(X)$, quick form
$E(X^2) - \mu^2$
$ ext{Var}(aX + b)$
$a^2\,\text{Var}(X)$
Standard deviation
$\sigma = \sqrt{\text{Var}(X)}$, in the same units as $X$
Practice
  1. $X$ is $0$ or $2$, each with probability $0.5$. Find $\text{Var}(X)$.

  2. Which formula gives the variance?

  3. Three coins are tossed and $X$ is the number of heads. Find $E(X^2)$.

  4. For the same $X$, find $\text{Var}(X)$.

  5. $X$ takes the values $2, 4, 6, 8$, each with probability $0.25$. Find $\text{Var}(X)$.

  6. $\text{Var}(X) = 4$. Find $\text{Var}(3X + 1)$.

  7. The standard deviation of $X$ is $3$. The standard deviation of $5 - 2X$ is:

  8. Find the variance of the score on a fair die, correct to two decimal places.

  9. Exam style: $P(X = x) = \dfrac{x}{6}$ for $x = 1, 2, 3$. Find $\text{Var}(X)$ correct to two decimal places.

  10. Exam style: a random variable has $E(X) = 4$ and $\text{Var}(X) = 2$. Find $E(X^2)$.

Formula sheet