IB Diploma Mathematics AA · Statistics and probability
Discrete random variables
1What a random variable is
A random variable $X$ is a number decided by chance, such as the score on a die. It is discrete if it takes separate values you can list.
Its probability distribution lists each value $x$ with its probability $P(X = x)$. It can be a table, a graph or a formula.
Two rules always hold:
- Every probability is between 0 and 1.
- The probabilities add to 1: $\sum P(X = x) = 1$.
Finding an unknown probability
- $X$ takes the values 1, 2, 3, 4 with probabilities $0.1$, $0.3$, $k$, $0.2$.
- $0.1 + 0.3 + k + 0.2 = 1$, so $k = 0.4$.
- $P(X \ge 3) = 0.4 + 0.2 = 0.6$.
Check yourself
A distribution has probabilities 0.2, 0.5 and k. What is k?
Show the answer
0.3
The probabilities must add to 1.
2Expected value
A discrete probability distribution and its expected value
The expected value $E(X)$ is the long-run mean of $X$ if the experiment is repeated many times:
$$E(X) = \sum x \, P(X = x)$$
The expected value
- Using the table above: $E(X) = 1(0.1) + 2(0.3) + 3(0.4) + 4(0.2)$.
- $E(X) = 0.1 + 0.6 + 1.2 + 0.8 = 2.7$.
$E(X)$ does not have to be a value that $X$ can take. You will never roll 3.5 on a die, but that is the expected score.
Check yourself
What is the expected score on a fair six-sided die?
Show the answer
3.5
(1 + 2 + 3 + 4 + 5 + 6)/6 = 3.5.
3Fair games
In a game, let $X$ be the player's gain (winnings minus cost). The game is fair if $E(X) = 0$.
Is the game fair?
- It costs £3 to play. Roll a die, and win £10 if you roll a six.
- Gain: $+7$ with probability $\frac{1}{6}$, $-3$ with probability $\frac{5}{6}$.
- $E(X) = 7 \times \frac{1}{6} - 3 \times \frac{5}{6} = \frac{7 - 15}{6} = -1.33$.
- The player loses £1.33 per game on average. The game is not fair; it favours the organiser.
- For a fair game the prize would need to be £18: then $15 \times \frac{1}{6} - 3 \times \frac{5}{6} = 0$.
Check yourself
A game is fair when:
Show the answer
The expected gain is 0
On average, nobody wins or loses money.
4Variance of a random variable (HL)
At HL you also need the spread of a distribution:
$$\text{Var}(X) = E(X^2) - [E(X)]^2 \quad \text{where} \quad E(X^2) = \sum x^2 P(X = x)$$
The variance
- Same table: $E(X^2) = 1(0.1) + 4(0.3) + 9(0.4) + 16(0.2) = 8.1$.
- $\text{Var}(X) = 8.1 - 2.7^2 = 8.1 - 7.29 = 0.81$.
- Standard deviation: $\sqrt{0.81} = 0.9$.
For a linear change of the variable:
$$E(aX + b) = aE(X) + b \qquad \text{Var}(aX + b) = a^2\,\text{Var}(X)$$
Check yourself
Var(X) = 4. What is Var(3X + 1)?
Show the answer
36
Var(aX + b) = a² Var(X) = 9 × 4.
5Finding an unknown probability
The probabilities in a distribution must add to 1.
$P(X = 1) = 0.1$, $P(X = 2) = k$, $P(X = 3) = 2k$, $P(X = 4) = 0.3$
- $0.1 + k + 2k + 0.3 = 1$, so $3k = 0.6$ and $k = 0.2$.
- $E(X) = 1(0.1) + 2(0.2) + 3(0.4) + 4(0.3) = 0.1 + 0.4 + 1.2 + 1.2 = 2.9$.
Check yourself
If probabilities 0.2, 0.3 and $k$ form a distribution, what is $k$?
Show the answer
0.5
Sum to 1.
6Expected winnings
A game
- It costs 2 euros to play. You roll a die: a six wins 10 euros; otherwise you win nothing.
- Net gain: 8 euros with probability $\frac{1}{6}$; $-2$ euros with probability $\frac{5}{6}$.
- $E(\text{gain}) = 8 \times \frac{1}{6} - 2 \times \frac{5}{6} = \frac{8 - 10}{6} = -\frac{1}{3}$ euro.
- On average, a player loses about 33 cents per game.
Check yourself
A game is fair when the expected gain is what?
Show the answer
Zero
No long-run advantage.
7Going deeper: a full distribution problem, and designing a fair game
$X$ takes the values 0, 1, 2, 3 with probabilities 0.1, $k$, 0.4, 0.2.
- Probabilities sum to 1: $0.1 + k + 0.4 + 0.2 = 1$, so $k = 0.3$.
- $E(X) = 0(0.1) + 1(0.3) + 2(0.4) + 3(0.2) = 1.7$.
- $E(X^2) = 0 + 1(0.3) + 4(0.4) + 9(0.2) = 3.7$.
- $\text{Var}(X) = E(X^2) - [E(X)]^2 = 3.7 - 2.89 = 0.81$ (HL).
- Standard deviation: $\sqrt{0.81} = 0.9$.
- $P(X \ge 2) = 0.4 + 0.2 = 0.6$.
- $P(X = 3 \mid X \ge 2) = \frac{0.2}{0.6} = \frac{1}{3}$.
Worked example (a game): a player pays 5 to roll a fair die. A six wins 12, a five wins 6, and anything else wins nothing.
- Expected winnings: $12 \times \frac{1}{6} + 6 \times \frac{1}{6} + 0 = 3$.
- Expected profit for the player: $3 - 5 = -2$ per game.
- Over 100 games the player expects to lose about 200.
- Making it fair: keep the prize for a five at 6 and let the prize for a six be $x$. A fair game needs $\frac{x}{6} + 1 = 5$, so $x = 24$.
- A game is fair when the expected profit is zero.
Linear changes (HL)
- $E(aX + b) = aE(X) + b$.
- $\text{Var}(aX + b) = a^2\,\text{Var}(X)$. Adding a constant moves the distribution without spreading it.
- For the first example: $E(2X + 3) = 2(1.7) + 3 = 6.4$ and $\text{Var}(2X + 3) = 4 \times 0.81 = 3.24$.
Probability functions. A distribution may be given as a formula, for example $P(X = x) = \frac{x}{10}$ for $x = 1, 2, 3, 4$.
- Check: $\frac{1 + 2 + 3 + 4}{10} = 1$.
- $E(X) = \frac{1 + 4 + 9 + 16}{10} = 3$.
Interpreting an expected value
- $E(X)$ is the long-run mean over many trials. It need not be a value $X$ can take: the expected score on a fair die is 3.5.
- Do not round an expected value to a whole number.
Common mistakes
- Forgetting that the probabilities must sum to 1 before anything else is calculated.
- Calculating $E(X^2)$ as $[E(X)]^2$.
- Leaving out the cost of playing when working out profit.
Check yourself
X takes the values 1, 2 and 3 with probabilities 0.2, 0.5 and 0.3. What is E(X)?
Show the answer
2.1
1 × 0.2 + 2 × 0.5 + 3 × 0.3 = 0.2 + 1.0 + 0.9.
Now test yourself
This lesson has a 8-question quiz and 5 exam-style questions with mark schemes in Impera. Free, with your progress saved.
Practise in Impera