Skip to main content
Examonaut

Topic 1 · Lesson 2 of 3

Linear functions and games of chance

Expectation and variance of aX + b

If you change every value of XX by the same rule Y=aX+bY = aX + b, the mean changes by the same rule, but the spread is only affected by the multiplier:

E(aX+b)=aE(X)+bVar(aX+b)=a2Var(X)\text{E}(aX + b) = a\text{E}(X) + b \qquad \text{Var}(aX + b) = a^2\text{Var}(X)

Adding bb slides the whole distribution along without changing its spread. Multiplying by aa stretches every distance from the mean by ∣a∣|a|, so the variance (a squared distance) is multiplied by a2a^2. For example, if Var(X)=3\text{Var}(X) = 3, then Var(5−2X)=(−2)2×3=12\text{Var}(5 - 2X) = (-2)^2 \times 3 = 12: the sign of aa never makes a variance negative.

These rules are used for coding, for instance to scale exam marks. If raw marks XX have mean 40 and standard deviation 8, and scaled marks Y=aX+bY = aX + b should have mean 50 and standard deviation 12, then 8a=128a = 12 gives a=1.5a = 1.5 (taking a>0a > 0), and 40a+b=5040a + b = 50 gives b=−10b = -10.

Expected winnings

In a game of chance, let the random variable be the player's profit (what they receive minus what they pay). Then:

  • E(profit)>0\text{E}(\text{profit}) > 0: the game favours the player in the long run;
  • E(profit)<0\text{E}(\text{profit}) < 0: it favours the organiser;
  • E(profit)=0\text{E}(\text{profit}) = 0: the game is fair.

A game is fair when the cost to play equals the expected amount received. If WW is the amount received and the game costs cc, the profit is W−cW - c and E(W−c)=E(W)−c\text{E}(W - c) = \text{E}(W) - c. The cost does not change the variance: Var(W−c)=Var(W)\text{Var}(W - c) = \text{Var}(W).

Worked example

A fair price

A bag has 4 red and 2 blue counters. A player takes two at random, without replacement, and receives £3 if both are red, £1.50 if they are different colours and nothing if both are blue. Find the cost that gives the organiser an average profit of 40p per game.

Show solution
  1. P(RR)=46×35=0.4\text{P}(\text{RR}) = \frac{4}{6} \times \frac{3}{5} = 0.4; P(different)=2×46×25=815\text{P}(\text{different}) = 2 \times \frac{4}{6} \times \frac{2}{5} = \frac{8}{15}; P(BB)=26×15=115\text{P}(\text{BB}) = \frac{2}{6} \times \frac{1}{5} = \frac{1}{15}.
  2. E(W)=3(0.4)+1.5×815+0=1.2+0.8=2\text{E}(W) = 3(0.4) + 1.5 \times \frac{8}{15} + 0 = 1.2 + 0.8 = 2, that is £2.
  3. The organiser's average profit is c−2=0.4c - 2 = 0.4, so the game should cost £2.40.

Worked example

E(3^X)

A fair coin is tossed twice and XX is the number of heads. A player pays £4 and receives £3X3^X. Is the game fair?

Show solution

X∼B(2,0.5)X \sim \text{B}(2, 0.5), so P(X=0,1,2)=14,12,14\text{P}(X = 0, 1, 2) = \frac{1}{4}, \frac{1}{2}, \frac{1}{4}.

E(3X)=14(1)+12(3)+14(9)=4\text{E}(3^X) = \frac{1}{4}(1) + \frac{1}{2}(3) + \frac{1}{4}(9) = 4

The expected profit is 4−4=04 - 4 = 0, so the game is fair. Notice that E(3X)≠3E(X)=31=3\text{E}(3^X) \neq 3^{\text{E}(X)} = 3^1 = 3: a player who "used the average number of heads" would think the game unfair.

Worked example

Choosing a strategy

A player rolls a fair four-sided dice (numbered 1 to 4), and may keep the score or roll once more and keep the second score. Rolling again whenever the first score is 2 or less gives

Show solution
E=14(3+4)+12×2.5=1.75+1.25=3\text{E} = \frac{1}{4}(3 + 4) + \frac{1}{2} \times 2.5 = 1.75 + 1.25 = 3

The first term covers keeping a 3 or 4; the second covers rolling again (probability 12\frac{1}{2}), when the expected second score is 2.5. Comparing other thresholds (roll again only on a 1, or on 3 or less, both give 2.875) shows this is the best strategy. Questions like this test whether you can split an expectation into cases, each weighted by its probability.

The discrete uniform distribution

If XX is equally likely to take each of the values 1,2,…,n1, 2, \ldots, n, then

E(X)=n+12Var(X)=n2−112\text{E}(X) = \frac{n + 1}{2} \qquad \text{Var}(X) = \frac{n^2 - 1}{12}

These follow from ∑r=12n(n+1)\sum r = \frac{1}{2}n(n + 1) and ∑r2=16n(n+1)(2n+1)\sum r^2 = \frac{1}{6}n(n + 1)(2n + 1). For a fair dice (n=6n = 6), the mean is 3.5 and the variance 3512\frac{35}{12}.

Practise this topic

Both are part of Premium.