Year 12 Methods — Expected Value, Variance & Standard Deviation (13D)

Discrete random variables  •  Cambridge Methods 3&4, Ch 13 §13D  •  Mr Wong
📚 This topic: 🏠 All Y12 Methods topics Calculus quiz solutions

Today's lesson

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

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$123456
$p(x)$0.10.10.10.20.250.25
Check the probabilities add to $1$: $0.1+0.1+0.1+0.2+0.25+0.25 = 1$. ✓
$E(X)=\sum x\,p(x) = 1(0.1)+2(0.1)+3(0.1)+4(0.2)+5(0.25)+6(0.25)$
$= 0.1 + 0.2 + 0.3 + 0.8 + 1.25 + 1.5$
$E(X) = 4.15$
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$.
$x$$-4$$1$$3$
$p(x)$$\tfrac13$$\tfrac12$$\tfrac16$
(b) $E(X) = -4\!\left(\tfrac13\right) + 1\!\left(\tfrac12\right) + 3\!\left(\tfrac16\right) = -\tfrac43 + \tfrac12 + \tfrac12 = -\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.
$x$123
$p(x)$0.50.40.1
(a) $E(X) = 1(0.5)+2(0.4)+3(0.1) = 0.5+0.8+0.3 = 1.6.$
(b) $E(X^2) = 1(0.5)+4(0.4)+9(0.1) = 0.5+1.6+0.9 = 3.0.$
(c) $\mathrm{Var}(X) = E(X^2) - [E(X)]^2 = 3.0 - (1.6)^2 = 3.0 - 2.56 = 0.44.$
(d) $\mathrm{sd}(X) = \sqrt{0.44} = 0.6633\ldots$
$E(X)=1.6,\quad \mathrm{Var}(X)=0.44,\quad \mathrm{sd}(X)\approx 0.66.$
EXAMPLE 4 — with fractions
Find $E(X)$, $E(X^2)$, $\mathrm{Var}(X)$ and $\sigma$ for
$x$123
$p(x)$$\tfrac{5}{12}$$\tfrac{4}{12}$$\tfrac{3}{12}$
$E(X) = 1\!\left(\tfrac{5}{12}\right)+2\!\left(\tfrac{4}{12}\right)+3\!\left(\tfrac{3}{12}\right) = \tfrac{5+8+9}{12} = \tfrac{22}{12} = \tfrac{11}{6}.$
$E(X^2) = 1\!\left(\tfrac{5}{12}\right)+4\!\left(\tfrac{4}{12}\right)+9\!\left(\tfrac{3}{12}\right) = \tfrac{5+16+27}{12} = \tfrac{48}{12} = 4.$
$\mathrm{Var}(X) = 4 - \left(\tfrac{11}{6}\right)^2 = 4 - \tfrac{121}{36} = \tfrac{144-121}{36} = \tfrac{23}{36}.$
$\sigma = \sqrt{\tfrac{23}{36}} = \dfrac{\sqrt{23}}{6} = 0.799\ldots$
$E(X)=\tfrac{11}{6}\approx1.83,\quad \mathrm{Var}(X)=\tfrac{23}{36},\quad \sigma \approx 0.80.$

Part 3 — Using the mean and standard deviation

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.$
$x$012345
$p(x)$0.10.10.20.20.30.1
$\mu = E(X) = 0(0.1)+1(0.1)+2(0.2)+3(0.2)+4(0.3)+5(0.1) = 2.8.$
$E(X^2) = 0+1(0.1)+4(0.2)+9(0.2)+16(0.3)+25(0.1) = 10.0.$
$\mathrm{Var}(X) = 10.0 - 2.8^2 = 10 - 7.84 = 2.16$, so $\sigma = \sqrt{2.16} \approx 1.47.$
Interval: $\mu \pm 2\sigma = 2.8 \pm 2(1.47) = 2.8 \pm 2.94 = [-0.14,\ 5.74].$
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.
$x$$+100$$-100$
$p(x)$$\tfrac{18}{37}$$\tfrac{19}{37}$
$E(X) = 100\!\left(\tfrac{18}{37}\right) - 100\!\left(\tfrac{19}{37}\right) = \dfrac{100(18-19)}{37} = -\dfrac{100}{37}.$
$E(X) = -\dfrac{100}{37} \approx -\$2.70$ per \$100 bet — a long-run loss (the green zero gives the house its edge).

Practice

Practice 1 — the full calculation.

Consider the distribution below. (a) Calculate $E(X)$.   (b) Calculate $E(X^2)$.   (c) Hence find $\mathrm{Var}(X)$.   (d) Hence find $\mathrm{sd}(X)$ to two decimal places.

$x$0123
$p(x)$0.40.20.10.3
(a) $E(X) = 0(0.4)+1(0.2)+2(0.1)+3(0.3) = 1.3.$
(b) $E(X^2) = 0+1(0.2)+4(0.1)+9(0.3) = 3.3.$
(c) $\mathrm{Var}(X) = 3.3 - 1.3^2 = 3.3 - 1.69 = 1.61.$
(d) $\mathrm{sd}(X) = \sqrt{1.61} \approx 1.27.$

Practice 2 — a fair game?

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:

ExerciseSet work
13D — Expected value, variance & standard deviationQ1, Q2, Q3, Q5, Q7, Q9
Chapter 13 reviewMultiple-choice Q1–4, Short-answer Q1, Q2 (mean & sd)

Exit ticket — write in your book

Before you pack up, in your exercise book:
  1. Write the two formulas $E(X)=\sum x\,p(x)$ and $\mathrm{Var}(X)=E(X^2)-[E(X)]^2$ from memory.
  2. For $x=1,2$ with $p(x)=0.5,0.5$, find $E(X)$, $\mathrm{Var}(X)$ and $\mathrm{sd}(X)$.
  3. Explain in one sentence what a negative expected profit tells you about a game.