ProbabilityDiscrete Random Variables

Variance: The Shortcut and the Rules

Var(X) = E[X²] − (E[X])², and Var(aX + b) = a² Var(X).

Not started Jump to practice

The standard deviation of a random variable measures how far $X$ typically lands from its mean. Its square, the variance, is easier to work with, because it is an expected value of a function: $\operatorname{Var}(X) = E[(X - \mu)^{2}]$ with $\mu = E[X]$.

Key idea

$$\operatorname{Var}(X) = E[X^{2}] - (E[X])^{2}, \qquad \operatorname{Var}(aX + b) = a^{2}\operatorname{Var}(X), \qquad \operatorname{SD}(aX + b) = \lvert a \rvert\,\operatorname{SD}(X).$$

Why it works

Shortcut: expand $(X - \mu)^{2} = X^{2} - 2\mu X + \mu^{2}$ and use linearity: $E[X^{2}] - 2\mu \cdot \mu + \mu^{2} = E[X^{2}] - \mu^{2}$.
Linear change: $aX + b$ has mean $a\mu + b$, so its distance from its mean is $(aX + b) - (a\mu + b) = a(X - \mu)$. Squaring gives $a^{2}(X - \mu)^{2}$, and averaging gives $a^{2}\operatorname{Var}(X)$. The shift $b$ moves every value and the mean together, so it disappears.

Worked examples

Worked example: A die

Find the variance and standard deviation of a fair die roll.
  1. $E[X] = \frac{7}{2}$ and $E[X^{2}] = \frac{91}{6}$.
  2. $$\operatorname{Var}(X) = \frac{91}{6} - \frac{49}{4} = \frac{182 - 147}{12} = \frac{35}{12} \approx 2.92$$
  3. $\operatorname{SD}(X) = \sqrt{35/12} \approx 1.71$.

Answer: $\frac{35}{12}$ and about $1.71$

Worked example: A linear change

$X$ is a fair die roll and $Y = 3 - 2X$. Find $E[Y]$, $\operatorname{Var}(Y)$ and $\operatorname{SD}(Y)$.
  1. $E[Y] = 3 - 2 \cdot \frac{7}{2} = -4$.
  2. $\operatorname{Var}(Y) = (-2)^{2} \cdot \frac{35}{12} = \frac{35}{3}$; the $3$ plays no part.
  3. $\operatorname{SD}(Y) = 2 \cdot 1.71 \approx 3.42$: the factor is $\lvert -2 \rvert = 2$.

Answer: $-4$, $\frac{35}{3}$ and about $3.42$

Why it works

Two more facts come straight from the shortcut. Rearranged, it says $E[X^{2}] = \operatorname{Var}(X) + \mu^{2}$. More generally, for any number $c$, $$E[(X - c)^{2}] = \operatorname{Var}(X) + (\mu - c)^{2},$$ because $X - c = (X - \mu) + (\mu - c)$ and the cross term has mean $2(\mu - c)E[X - \mu] = 0$. So the average squared distance from $c$ is smallest when $c = \mu$: the mean is the best single guess when errors are measured by their squares.

Worked example: Changing units

Daily highs have mean $20^\circ\text{C}$ and standard deviation $5^\circ\text{C}$. Find the mean and standard deviation in Fahrenheit, $F = \frac{9}{5}C + 32$.
  1. Mean: $\frac{9}{5} \cdot 20 + 32 = 68^\circ\text{F}$.
  2. Standard deviation: $\frac{9}{5} \cdot 5 = 9^\circ\text{F}$; adding 32 does not change the spread.

Answer: $68^\circ\text{F}$ and $9^\circ\text{F}$ (variance $81$).

Worked example: Squared distance from a target

$X$ has mean 5 and variance 4. Find $E[X^{2}]$ and $E[(X - 2)^{2}]$.
  1. $$E[X^{2}] = \operatorname{Var}(X) + \mu^{2} = 4 + 25 = 29$$
  2. $$E[(X - 2)^{2}] = \operatorname{Var}(X) + (\mu - 2)^{2} = 4 + 9 = 13$$

Answer: 29 and 13

Variance is measured in squared units (square degrees, square dollars), which is hard to picture. The standard deviation, its square root, is back in the original units, so use the SD when describing spread and the variance when calculating.

Common mistake

Writing $\operatorname{Var}(aX + b) = a\operatorname{Var}(X) + b$. With $a = -1$ and $b = 0$ that would make $\operatorname{Var}(-X)$ negative, which is impossible; and adding a constant cannot change how spread out the values are. Check: a variance is never negative, and $\operatorname{Var}(-X) = \operatorname{Var}(X)$.

Practice

Pass with 3 right answers, the last 2 in a row. Each right answer earns 2 XP.

Loading practice…

Builds on

Leads to

Sources and further reading

  • Grinstead and Snell, Introduction to Probability (2nd revised edition, American Mathematical Society; free from Dartmouth College), chapter 6 (Expected Value and Variance), section 6.2
  • MIT OpenCourseWare 18.05, Introduction to Probability and Statistics (Spring 2014), readings on variance and standard deviation
@teddyrookbook GitHub