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$.
- Mean: $$\mu = 0(0.25) + 1(0.5) + 2(0.25) = 1$$
- Squared distances: $(0 - 1)^2 = 1$, $(1 - 1)^2 = 0$, $(2 - 1)^2 = 1$.
- Weighted: $$\sigma^2 = 1(0.25) + 0(0.5) + 1(0.25) = 0.5$$
- $\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.
- $\mu = 3.5$.
- Squared distances: $6.25, 2.25, 0.25, 0.25, 2.25, 6.25$; each has probability $\frac{1}{6}$.
- $\sigma^2 = \frac{17.5}{6} \approx 2.917$.
- $\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.
- Both have mean \$50.
- A: every payout is 5 from the mean, so $\sigma_A = 5$. B: every payout is 30 from the mean, so $\sigma_B = 30$.
- B is much riskier: its outcomes land far from the mean.
Answer: Same mean; $\sigma = 5$ versus $\sigma = 30$.
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.