Prob and StatsRandom Variables

Standard Deviation of a Random Variable

Measure how much a random variable typically varies from its mean.

Not started Jump to practice

Two games can have the same expected value and feel completely different: one pays about the same every time, the other swings wildly. The standard deviation you learned for data has a twin for random variables.

Key idea

The variance of a discrete random variable is $$\sigma^2 = \sum (x - \mu)^2 P(x),$$ and its standard deviation is $\sigma = \sqrt{\sigma^2}$, a typical distance of $X$ from its mean. A shortcut: $\sigma^2 = E(X^2) - \mu^2$.

Why it works

It is the data formula with probabilities in place of "divide by the count": each squared distance from the mean is weighted by how often it happens in the long run. (No $n - 1$ appears, because here we know the true probabilities and the true mean.) The shortcut comes from expanding $(x - \mu)^2 = x^2 - 2\mu x + \mu^2$ and using $\sum xP(x) = \mu$ and $\sum P(x) = 1$.

Worked example: A small distribution

$X$ takes the values 0, 1, 2 with probabilities $0.25, 0.5, 0.25$. Find $\sigma$.
  1. Mean: $$\mu = 0(0.25) + 1(0.5) + 2(0.25) = 1$$
  2. Squared distances: $(0 - 1)^2 = 1$, $(1 - 1)^2 = 0$, $(2 - 1)^2 = 1$.
  3. Weighted: $$\sigma^2 = 1(0.25) + 0(0.5) + 1(0.25) = 0.5$$
  4. $\sigma = \sqrt{0.5} \approx 0.71$.

Answer: $\sigma \approx 0.71$

Worked example: One die

Find the standard deviation of one roll of a fair die.
  1. $\mu = 3.5$.
  2. Squared distances: $6.25, 2.25, 0.25, 0.25, 2.25, 6.25$; each has probability $\frac{1}{6}$.
  3. $\sigma^2 = \frac{17.5}{6} \approx 2.917$.
  4. $\sigma \approx 1.71$.

Answer: $\sigma \approx 1.71$

Worked example: Same mean, different risk

Game A pays \$45 or \$55, each with probability $\frac12$. Game B pays \$20 or \$80, each with probability $\frac12$. Compare.
  1. Both have mean \$50.
  2. A: every payout is 5 from the mean, so $\sigma_A = 5$. B: every payout is 30 from the mean, so $\sigma_B = 30$.
  3. B is much riskier: its outcomes land far from the mean.

Answer: Same mean; $\sigma = 5$ versus $\sigma = 30$.

One die: values spread from 1 to 6 around the mean 3.5, a typical distance of about 1.7.

Common mistake

Forgetting to weight by probability (just averaging the squared distances as if every value were equally likely), or forgetting the final square root. Check: σ should look like a typical distance from the mean, in the same units as 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

  • OpenStax, Introductory Statistics 2e, section 4.2 Mean or Expected Value and Standard Deviation
@teddyrookbook GitHub