A discrete random variable $X$ takes a list of values, each with a probability $p(x)=\Pr(X=x)$. This lesson is about summarising that distribution with two numbers: its centre (the mean) and its spread (the standard deviation).
Learning intentions
Find the expected value (mean) $\mu = E(X) = \sum x\,p(x)$ and read it as a long-run average.
Find the variance using the easy formula $\mathrm{Var}(X) = E(X^2) - [E(X)]^2$.
Find the standard deviation $\mathrm{sd}(X) = \sqrt{\mathrm{Var}(X)}$ and use it to describe spread.
Apply expected value to decide whether a game is worth playing.
Part 1 — Expected value (the mean)
EXPECTED VALUE (MEAN)
$$\mu = E(X) = \sum_x x\cdot \Pr(X=x) = \sum_x x\cdot p(x).$$
Multiply each value by its probability, then add. It is the long-run average of $X$.
Think of the probability distribution as a set of weights sitting on a beam. The mean is the point where the beam balances — the values with more probability pull it towards them.
📺 Walkthrough: the mean $E(X)=\sum x\,p(x)$ as the balancing point of a distribution (worked for the weighted die below, $\mu=4.15$).
EXAMPLE 1 — a weighted die
Find the expected value rolled on a weighted die with this distribution.
$x$
1
2
3
4
5
6
$p(x)$
0.1
0.1
0.1
0.2
0.25
0.25
Check the probabilities add to $1$: $0.1+0.1+0.1+0.2+0.25+0.25 = 1$. ✓
Note the mean need not be a value the die can show — it is the average over many rolls.
EXAMPLE 2 — is the game worth playing?
In a casino game you pay \$4 to roll a fair die. If you roll an even number you get \$5; if you roll a 5 you get \$7; anything else pays nothing. Let $X$ be the amount of money you make per game.
(a) Describe the distribution of $X$ in a table. (b) Find the expected profit (or loss) per game.
(a) Work out the profit (money received $-\$4$ to play) for each outcome:
• Even $\{2,4,6\}$: receive \$5, so profit $= +\$1$, with $\Pr = \tfrac{3}{6}=\tfrac12$.
• Roll a $5$: receive \$7, so profit $= +\$3$, with $\Pr = \tfrac16$.
• Roll $\{1,3\}$: receive \$0, so profit $= -\$4$, with $\Pr = \tfrac{2}{6}=\tfrac13$.
$E(X) = -\dfrac13 \approx -\$0.33$ — an expected loss of about 33 cents per game, so in the long run the game is not worth playing.
Part 2 — Variance and standard deviation
VARIANCE & STANDARD DEVIATION
$$\mathrm{Var}(X) = E\!\big[(X-\mu)^2\big] = E(X^2) - [E(X)]^2, \qquad \mathrm{sd}(X) = \sigma = \sqrt{\mathrm{Var}(X)}.$$
In practice use the right-hand formula: find $E(X^2)=\sum x^2\,p(x)$, then subtract the mean squared.
💡 Two averages to keep separate: $E(X)=\sum x\,p(x)$ uses the values, while $E(X^2)=\sum x^2\,p(x)$ uses the squared values (with the same probabilities). Variance combines them.
📺 Walkthrough: computing $E(X)$, $E(X^2)$, $\mathrm{Var}(X)=E(X^2)-[E(X)]^2$ and $\mathrm{sd}(X)$ step by step (Example 3 below).
EXAMPLE 3 — the full calculation
For the distribution below, find $E(X)$, $E(X^2)$, $\mathrm{Var}(X)$, and hence the standard deviation to two decimal places.
The standard deviation measures how far, on average, the values sit from the mean. A useful rule of thumb: for many distributions, most of the probability lies within two standard deviations of the mean, $[\mu-2\sigma,\ \mu+2\sigma]$ (often quoted as about $95\%$).
EXAMPLE 5 — testing the "95%" claim
For the distribution below, find $\mu$ and $\sigma$ (to two decimal places), then decide on the claim $\Pr(\mu-2\sigma \le X \le \mu+2\sigma) \approx 0.95.$
Every possible value $x = 0,1,2,3,4,5$ lies inside $[-0.14, 5.74]$, so $\Pr(\mu-2\sigma \le X \le \mu+2\sigma) = 1.$
Here the exact probability is $\mathbf{1}$ (100%), not $0.95$. The "$\approx 95\%$" is only a rough guide (it is exact for normal distributions); for this short discrete distribution all of the probability falls within two standard deviations.
EXAMPLE 6 — betting on red at roulette
You bet \$100 on red at roulette (a European wheel: $37$ pockets — $18$ red, $18$ black, $1$ green zero). What are your expected winnings / loss?
Let $X$ be your profit. Red wins \$100; anything else (black or green) loses \$100.
A game costs \$2 to play. You draw one card from a standard deck: an ace pays \$20, any other face-card-or-number pays nothing. Let $X$ be your profit. Find $E(X)$ and state whether the game is fair (a game is fair if $E(X)=0$).
$\Pr(\text{ace}) = \tfrac{4}{52} = \tfrac{1}{13}$. Profit is $+\$18$ (win \$20, less the \$2 cost) with prob $\tfrac{1}{13}$, or $-\$2$ with prob $\tfrac{12}{13}$.
$E(X) = 18\!\left(\tfrac{1}{13}\right) - 2\!\left(\tfrac{12}{13}\right) = \dfrac{18 - 24}{13} = -\dfrac{6}{13} \approx -\$0.46.$
Since $E(X) \ne 0$ (it is negative), the game is not fair — on average you lose about 46 cents per play.
Quick quiz (5 min)
Pick the correct answer for each, then click Mark.
Q1. For $x=0,1,2$ with $p(x)=0.2,0.5,0.3$, the mean $E(X)$ is
Q2. The computational formula for variance is
Q3. If $E(X)=2$ and $E(X^2)=6$, then $\mathrm{Var}(X)$ equals
Q4. If $\mathrm{Var}(X)=0.25$, the standard deviation is
Q5. A game has expected profit $E(X) = -\$0.40$ per play. In the long run you should expect to
Working program — Cambridge §13D
After the quiz, open Chapter 13 and work through these:
Exercise
Set work
13D — Expected value, variance & standard deviation