Mathematics · Book 2 · Grades 10–12

High School Mathematics

High School Mathematics · Grades 10–12

18Probability and Random Variables

Probability models experiments whose outcome is uncertain: a die roll, a card drawn, a game played. This chapter sets up the vocabulary on finite sets, then introduces the central character of all of probability theory: the random variable and its expectation. These notions are reviewed and deepened in Chapter 33, and conditional probabilities follow in Chapter 32.

18.1 Probability on a finite set

Definition 18.1 (Probability model)

An experiment with finitely many outcomes is modelled by its sample space Ω={ω1,,ωn}\Omega = \{\omega_1, \dots, \omega_n\} (the set of outcomes) together with a probability P\P assigning to each outcome ωi\omega_i a number pi0p_i \geq 0, with p1++pn=1p_1 + \dots + p_n = 1. An event is a subset AΩA \subseteq \Omega, and

P(A)=ωiApi.\P(A) = \sum_{\omega_i \in A} p_i .

When all outcomes are equally likely (pi=1np_i = \frac1n: the uniform model),

P(A)=number of outcomes in Anumber of outcomes in Ω.\P(A) = \frac{\text{number of outcomes in } A} {\text{number of outcomes in } \Omega}.

Example 18.2

Roll two distinguishable dice: Ω\Omega is the set of the 3636 ordered pairs (i,j)(i, j) with 1i,j61 \leq i, j \leq 6, all equally likely. The event SS = “the sum is 77” contains the 66 pairs (1,6)(1,6), (2,5)(2,5), (3,4)(3,4), (4,3)(4,3), (5,2)(5,2), (6,1)(6,1), so P(S)=636=16\P(S) = \frac{6}{36} = \frac16. The event “the sum is 1212” contains only (6,6)(6,6): probability 136\frac{1}{36}. Choosing the right sample space — ordered pairs, not unordered — is what makes the uniform model applicable.

Proposition 18.3 (Rules of probability)

For events A,BΩA, B \subseteq \Omega:

P()=0,P(Ω)=1,P(Aˉ)=1P(A),\P(\emptyset) = 0, \qquad \P(\Omega) = 1, \qquad \P(\bar A) = 1 - \P(A),
P(AB)=P(A)+P(B)P(AB),\P(A \cup B) = \P(A) + \P(B) - \P(A \cap B),

where Aˉ\bar A is the complement of AA (all outcomes not in AA). In particular, P(AB)=P(A)+P(B)\P(A \cup B) = \P(A) + \P(B) when AA and BB are incompatible (AB=A \cap B = \emptyset).

Proof. The empty event contains no outcome (empty sum), and Ω\Omega contains them all (total sum 11). Every outcome is in exactly one of AA, Aˉ\bar A, so P(A)+P(Aˉ)=1\P(A) + \P(\bar A) = 1. For the union: summing the pip_i over AA and then over BB counts the outcomes of ABA \cap B twice; subtracting P(AB)\P(A \cap B) corrects the double count.

Example 18.4

In a class, 60%60\% study music (MM), 45%45\% play a sport (SS), and 25%25\% do both. The proportion doing at least one is P(MS)=0.60+0.450.25=0.80\P(M \cup S) = 0.60 + 0.45 - 0.25 = 0.80, so 20%20\% do neither (complement).

18.2 Random variables

Definition 18.5 (Random variable, distribution)

A random variable on Ω\Omega is a function XX assigning a number to each outcome. Its distribution is the table of its possible values x1,,xkx_1, \dots, x_k together with their probabilities

P(X=xi)=P({ω:X(ω)=xi}),i=1kP(X=xi)=1.\P(X = x_i) = \P\bigl(\{\omega : X(\omega) = x_i\}\bigr), \qquad \sum_{i=1}^k \P(X = x_i) = 1 .

Example 18.6

A game: pay 22 euros, roll one fair die, receive the value shown if it is at least 55, nothing otherwise. Let GG be the gain (received minus paid). The outcomes 1,2,3,41, 2, 3, 4 give G=2G = -2; the outcome 55 gives G=3G = 3; the outcome 66 gives G=4G = 4. The distribution of GG:

gg2-23344
P(G=g)\P(G = g)46\dfrac4616\dfrac1616\dfrac16

Method 18.7 (Building a distribution table)

List the possible values of XX; for each value, collect the outcomes producing it and add their probabilities; check that the row of probabilities sums to 11.

18.3 Expectation

Definition 18.8 (Expectation)

The expectation (or mean) of XX is the average of its values weighted by their probabilities:

E(X)=i=1kP(X=xi)  xi.\E(X) = \sum_{i=1}^{k} \P(X = x_i)\; x_i .

Remark 18.9

E(X)\E(X) is what the mean of a huge number of independent repetitions of the experiment would be — the precise version of this statement is the law of large numbers, proved in Chapter 34. Note the formal analogy with the mean of a dataset with frequencies (Definition 17.1): probabilities play the role of the relative frequencies nin\frac{n_i}{n}.

Example 18.10

For the game of Example 18.6:

E(G)=46×(2)+16×3+16×4=8+3+46=160.17.\E(G) = \frac46 \times (-2) + \frac16 \times 3 + \frac16 \times 4 = \frac{-8 + 3 + 4}{6} = -\frac16 \approx -0.17 .

On average the player loses about 1717 cents per game: the game is unfavorable. A game is called fair when the expected gain is 00.

Proposition 18.11 (Linearity)

For all reals a,ba, b:

E(aX+b)=aE(X)+b.\E(aX + b) = a\,\E(X) + b .

Proof. The variable aX+baX + b takes the value axi+ba x_i + b with probability P(X=xi)\P(X = x_i), so

E(aX+b)=iP(X=xi)(axi+b)=aiP(X=xi)xi+biP(X=xi)=1=aE(X)+b.\E(aX + b) = \sum_i \P(X = x_i)(a x_i + b) = a \sum_i \P(X = x_i)\,x_i + b \underbrace{\sum_i \P(X = x_i)}_{=\,1} = a\,\E(X) + b .

18.4 Variance and standard deviation

Definition 18.12 (Variance)

The variance of XX measures the spread of its values around the expectation m=E(X)m = \E(X):

V(X)=E((Xm)2)=i=1kP(X=xi)(xim)2,σ(X)=V(X).\V(X) = \E\bigl((X - m)^2\bigr) = \sum_{i=1}^{k} \P(X = x_i)\,(x_i - m)^2, \qquad \sigma(X) = \sqrt{\V(X)} .

Proposition 18.13 (Shortcut formula)

V(X)=E(X2)E(X)2.\V(X) = \E(X^2) - \E(X)^2 .

Proof. Expand (xim)2=xi22mxi+m2(x_i - m)^2 = x_i^2 - 2m\,x_i + m^2 inside the sum:

V(X)=iP(X=xi)xi22miP(X=xi)xi+m2iP(X=xi)=E(X2)2m2+m2,\V(X) = \sum_i \P(X = x_i)\,x_i^2 - 2m \sum_i \P(X = x_i)\,x_i + m^2\sum_i \P(X = x_i) = \E(X^2) - 2m^2 + m^2 ,

which is E(X2)m2\E(X^2) - m^2. This is the random-variable version of the identity proved for datasets in Proposition 17.7.

Proposition 18.14 (Affine transformation)

V(aX+b)=a2V(X)\V(aX + b) = a^2\,\V(X) and σ(aX+b)=aσ(X)\sigma(aX + b) = \abs a\,\sigma(X).

Proof. By linearity, aX+baX + b deviates from its expectation am+ba m + b by (aX+b)(am+b)=a(Xm)(aX + b) - (am + b) = a(X - m): every deviation is scaled by aa, hence every squared deviation by a2a^2, and so is their weighted mean. The shift bb has disappeared — shifting a variable does not change its spread.

Example 18.15

For the game of Example 18.6: E(G2)=46×4+16×9+16×16=16+9+166=416\E(G^2) = \frac46 \times 4 + \frac16 \times 9 + \frac16 \times 16 = \frac{16 + 9 + 16}{6} = \frac{41}{6}, so

V(G)=416(16)2=416136=245366.8,σ(G)2.6.\V(G) = \frac{41}{6} - \left(-\frac16\right)^2 = \frac{41}{6} - \frac{1}{36} = \frac{245}{36} \approx 6.8, \qquad \sigma(G) \approx 2.6 .

The loss of 0.170.17 per game on average comes with swings of typical size 2.62.6 euros — expectation without standard deviation tells only half the story.

The distribution of the gain G of , and its expectation (G) = -1/6 (dashed): the balance point of the probability masses.
The distribution of the gain GG of Example 18.6, and its expectation E(G)=16\E(G) = -\frac16 (dashed): the balance point of the probability masses.

18.5 Exercises

Exercise 18.1

A card is drawn from a standard 5252-card deck. Compute the probability of drawing: a heart; a king; a heart or a king; neither a heart nor a king.

Solution

Solution of Exercise 18.1.

Uniform model on 5252 cards. Hearts: 1352=14\frac{13}{52} = \frac14. Kings: 452=113\frac{4}{52} = \frac{1}{13}. Heart or king: 13+4152=1652=413\frac{13 + 4 - 1}{52} = \frac{16}{52} = \frac{4}{13} (the king of hearts is counted once). Neither: 1413=9131 - \frac{4}{13} = \frac{9}{13}.

Exercise 18.2

Two fair dice are rolled and their sum SS is recorded. Using the 3636-outcome model of Example 18.2, compute P(S=6)\P(S = 6), P(S10)\P(S \geq 10) and P(S is even)\P(S \text{ is even}).

Solution

Solution of Exercise 18.2.

S=6S = 6: the pairs (1,5),(2,4),(3,3),(4,2),(5,1)(1,5), (2,4), (3,3), (4,2), (5,1), so P(S=6)=536\P(S = 6) = \frac{5}{36}.

S10S \geq 10: three pairs for 1010, two for 1111, one for 1212: P(S10)=636=16\P(S \geq 10) = \frac{6}{36} = \frac16.

SS even: sums 2,4,6,8,10,122, 4, 6, 8, 10, 12 have 1+3+5+5+3+1=181 + 3 + 5 + 5 + 3 + 1 = 18 pairs: probability 1836=12\frac{18}{36} = \frac12.

Exercise 18.3

A random variable has distribution

xx1-1002255
P(X=x)\P(X=x)0.30.30.20.20.40.4pp

Find pp, then compute E(X)\E(X).

Solution

Solution of Exercise 18.3.

The probabilities sum to 11: p=10.30.20.4=0.1p = 1 - 0.3 - 0.2 - 0.4 = 0.1. Then

E(X)=0.3×(1)+0.2×0+0.4×2+0.1×5=0.3+0.8+0.5=1.\E(X) = 0.3 \times (-1) + 0.2 \times 0 + 0.4 \times 2 + 0.1 \times 5 = -0.3 + 0.8 + 0.5 = 1 .

Exercise 18.4

XX satisfies E(X)=3\E(X) = 3 and V(X)=4\V(X) = 4. Give the expectation, variance and standard deviation of Y=2X5Y = 2X - 5.

Solution

Solution of Exercise 18.4.

E(Y)=2×35=1\E(Y) = 2 \times 3 - 5 = 1; V(Y)=22×4=16\V(Y) = 2^2 \times 4 = 16; σ(Y)=4\sigma(Y) = 4.

Exercise 18.5 ★★

A wheel of fortune has 1010 equal sectors: 55 show 00 euros, 33 show 22 euros, 22 show 55 euros. Playing costs 22 euros. Give the distribution of the gain GG (winnings minus stake), compute E(G)\E(G), and decide whether the game is favorable.

Solution

Solution of Exercise 18.5.

The winnings are 00, 22, 55 euros with probabilities 0.50.5, 0.30.3, 0.20.2; subtracting the 22-euro stake, GG takes the values 2,0,3-2, 0, 3:

gg2-20033
P(G=g)\P(G=g)0.50.50.30.30.20.2

E(G)=1+0+0.6=0.4\E(G) = -1 + 0 + 0.6 = -0.4: the player loses 4040 cents per game on average — unfavorable.

Exercise 18.6 ★★

An urn contains 33 red and 22 blue balls; two balls are drawn without replacement. Let XX be the number of red balls drawn. Build the distribution of XX (enumerate the 2020 ordered draws, or use a tree), and compute E(X)\E(X).

Solution

Solution of Exercise 18.6.

Drawing in order: P(X=2)=35×24=310\P(X = 2) = \frac35 \times \frac24 = \frac{3}{10} (red then red); P(X=0)=25×14=110\P(X = 0) = \frac25 \times \frac14 = \frac{1}{10} (blue then blue); hence P(X=1)=1310110=610\P(X = 1) = 1 - \frac{3}{10} - \frac{1}{10} = \frac{6}{10}. Then

E(X)=0×110+1×610+2×310=1210=1.2,\E(X) = 0 \times \frac1{10} + 1 \times \frac6{10} + 2 \times \frac3{10} = \frac{12}{10} = 1.2 ,

consistent with intuition: 35\frac35 of the two draws are red on average.

Exercise 18.7 ★★

For the wheel of Exercise 18.5, compute V(G)\V(G) and σ(G)\sigma(G).

Solution

Solution of Exercise 18.7.

E(G2)=0.5×4+0.3×0+0.2×9=3.8\E(G^2) = 0.5 \times 4 + 0.3 \times 0 + 0.2 \times 9 = 3.8, so by the shortcut formula V(G)=3.8(0.4)2=3.80.16=3.64\V(G) = 3.8 - (-0.4)^2 = 3.8 - 0.16 = 3.64 and σ(G)1.9\sigma(G) \approx 1.9 euros.

Exercise 18.8 ★★

An insurance company sells a policy for 8080 euros. With probability 0.050.05 the client claims 10001000 euros, with probability 0.010.01 the client claims 50005000 euros, otherwise nothing. Let BB be the company’s benefit on one policy. Give the distribution of BB, compute E(B)\E(B), and interpret.

Solution

Solution of Exercise 18.8.

The benefit is 8080 minus the claim:

bb8080920-9204920-4920
P(B=b)\P(B=b)0.940.940.050.050.010.01

E(B)=75.24649.2=20\E(B) = 75.2 - 46 - 49.2 = -20: at this price the company loses 2020 euros per policy on average. The premium is too low for the risks covered (it would need to exceed 100100 euros for a positive expected benefit).

Exercise 18.9 ★★

A multiple-choice question has 44 answers, one correct. A correct answer scores +1+1; to discourage guessing, a wrong answer scores x<0x < 0. A student answers at random. For which value of xx is the student’s expected score zero?

Solution

Solution of Exercise 18.9.

The random score is +1+1 with probability 14\frac14 and xx with probability 34\frac34:

E=14+3x4=0    x=13.\E = \frac14 + \frac{3x}{4} = 0 \iff x = -\frac13 .

With the penalty 13-\frac13, random guessing brings nothing on average.

Exercise 18.10 ★★

Two fair coins are tossed. Ann proposes: “if both coins match, I pay you 11 euro; if they differ, you pay me 11 euro.” Compute the expected gain of each player. Is the game fair? Same question with three coins, where Ann pays 22 euros if all three match.

Solution

Solution of Exercise 18.10.

Two coins: they match (HH or TT) with probability 24×2=12\frac24 \times 2 = \frac12. The player’s gain is +1+1 or 1-1 with equal probabilities: expectation 00 for both players — the game is fair.

Three coins: all match (HHH or TTT) with probability 28=14\frac{2}{8} = \frac14. The player receives 22 with probability 14\frac14 and pays 11 with probability 34\frac34: E=2434=14\E = \frac24 - \frac34 = -\frac14. The game favours Ann by 2525 cents per round; it would be fair if she paid 33 euros for a triple match.

Exercise 18.11 ★★★

A lottery sells 10001000 tickets at 55 euros each. One ticket wins 20002000 euros, five tickets win 200200 euros, twenty tickets win 2525 euros.

  1. Give the distribution of the organizer’s total revenue minus prizes, and of a single player’s gain GG.
  2. Compute E(G)\E(G) and the total expected profit of the organizer. Check that the two answers are consistent.
Solution

Solution of Exercise 18.11.

1. The organizer receives 1000×5=50001000 \times 5 = 5000 euros and pays out 2000+5×200+20×25=35002000 + 5 \times 200 + 20 \times 25 = 3500 euros in all: the profit is the constant 15001500 (no randomness once all tickets are sold). A single player’s gain GG (prize minus the 55-euro ticket):

gg1995199519519520205-5
P(G=g)\P(G=g)11000\dfrac{1}{1000}51000\dfrac{5}{1000}201000\dfrac{20}{1000}9741000\dfrac{974}{1000}

2.

E(G)=1995+5×195+20×20974×51000=1995+975+40048701000=1.5.\E(G) = \frac{1995 + 5 \times 195 + 20 \times 20 - 974 \times 5}{1000} = \frac{1995 + 975 + 400 - 4870}{1000} = -1.5 .

Each player expects to lose 1.501.50 euros; over 10001000 players that is 15001500 euros — exactly the organizer’s profit. The books balance: what the players lose on average is precisely what the organizer collects.

18.6 Problem: The unfinished game

Problem 18.1

Weekend problem — Pascal, Fermat and the fair split of an interrupted bet: the birth of expectation, the magic of linearity, and what expectation cannot see

In 1654 the Chevalier de Méré — the same gambler whose dice bets opened the Middle School volume’s probability problem — asked Blaise Pascal a deeper question: two equally skilled players must stop their series at the score of 55 to 33, six wins taking the 6464-pistole pot. How should the pot be split fairly? The letters between Pascal and Fermat answering it founded the concept at the heart of this chapter: expectation (Definition 18.8). You will re-derive their answer both ways, then meet linearity’s party trick and expectation’s one blind spot.

Part I — Expectation fluency.

  1. Roll a fair die; your gain is (face 3- 3) euros. Build the distribution table of the gain GG (Method 18.7) and compute E(G)\E(G).
  2. Compute V(G)V(G) with the shortcut formula (Proposition 18.13) and σ(G)\sigma(G) (two decimals).
  3. Without any new table, give E(2G1)\E(2G - 1) and V(2G1)V(2G - 1) (Proposition 18.14).
  4. A stall charges mm euros to roll two dice and pockets you the sum in euros. What is the fair price mm? The stall charges 88: what is your expected loss per game?
  5. A laptop worth 800800 euros has a 5%5\,\% chance of destruction each year. Compute the fair insurance premium, and the insurer’s expected profit per policy if it charges 6060 euros.

Part II — Splitting the pot. Score 5533, first to 66 wins the 6464 pistoles, rounds are fair coin flips.

  1. Two tempting wrong answers: split 5:35 : 3 (proportionally to rounds won), or give everything to the leader. Say in one sentence each what is unfair about them.
  2. Fermat’s method: player A needs 11 more win, B needs 33; imagine playing exactly 33 more rounds regardless. List the 88 equally likely outcomes, mark who wins the series in each, and deduce the fair split of the 6464 pistoles.
  3. The subtle point Fermat had to defend: the real game might stop after one round — why is it nevertheless legitimate to reason on all 33 imaginary rounds?
  4. Pascal’s method, backwards from the end: compute A’s fair share at the (hypothetical) scores 5555, then 5544, then 5533, each time averaging the two equally likely futures. Compare with question 7.
  5. Same question at the score 4433: how many imaginary rounds, which outcomes give B the series, and what is the fair split?
  6. State the principle the two methods share — the fair value of an uncertain future is its expectation — and name two modern industries running entirely on it (question 5 shows one).
  7. A sanity check for every score: explain, with the linearity of expectation (Proposition 18.11), why the two players’ fair shares must always add up to exactly the 6464-pistole pot.

Part III — Linearity’s party trick.

  1. Recover E(sum of two dice)=7\E(\text{sum of two dice}) = 7 in one line with linearity (Proposition 18.11), no 3636-cell table. For the variance of the sum, the rule V(X+Y)=V(X)+V(Y)V(X + Y) = V(X) + V(Y) needs the dice to be independent (admitted): compute it.
  2. The hat-check party: nn guests throw their hats in a pile and each takes one back at random. Let XX count the guests who recover their own hat. For one fixed guest, what is the probability of recovering their own hat? Summing these nn chances (linearity!), compute E(X)\E(X). The answer should surprise you: it does not depend on nn.
  3. Verify E(X)=1\E(X) = 1 by brute force for n=2n = 2 and n=3n = 3 (list the 22 and 66 equally likely hat-assignments and average the counts).
  4. The guests’ recoveries are far from independent (if n1n - 1 guests got their own hats back, the last one must too). Where exactly did question 14’s computation not require independence? State linearity’s superpower.

Part IV — What expectation cannot see.

  1. Two 55-euro scratch cards: card A wins 1010 euros with probability 12\frac12; card B wins 10001\,000 euros with probability 0.0050.005. Check that both gains have the same expectation, then compute both variances. Which card do real people buy, and what are they buying?
  2. The St Petersburg game: flip until the first tails; if the first tails occurs at flip nn you receive 2n2^n euros. Compute the contribution of each nn to the expectation and the expectation itself. Would you pay 10001\,000 euros to play once? What does the clash teach about expectation?
  3. Insurance from the customer’s side: pay 2020 euros, or face a 1%1\,\% risk of losing 10001\,000? Compare the two expectations, and explain why buying the insurance can still be rational (what can a single family not “average over”?).
  4. Finale — expectation’s biography, one sentence per chapter: born in 1654 to split a pot; its superpower, linearity, which adds expectations without asking independence (the hats); its blind spot, risk, which variance measures (cards, St Petersburg, insurance); and its coronation next year, when the law of large numbers explains exactly why the house always wins.
Solution

Solution of Problem 18.1.

1. GG takes 2,1,0,1,2,3-2, -1, 0, 1, 2, 3, each with probability 16\frac16: E(G)=21+0+1+2+36=12\E(G) = \frac{-2 - 1 + 0 + 1 + 2 + 3}{6} = \frac12 euro.

2. E(G2)=4+1+0+1+4+96=196\E(G^2) = \frac{4 + 1 + 0 + 1 + 4 + 9}{6} = \frac{19}{6}; V(G)=19614=35122.92V(G) = \frac{19}{6} - \frac14 = \frac{35}{12} \approx 2.92; σ(G)1.71\sigma(G) \approx 1.71.

3. E(2G1)=2×121=0\E(2G - 1) = 2 \times \frac12 - 1 = 0; V(2G1)=4V(G)=353V(2G - 1) = 4\,V(G) = \frac{35}{3}.

4. E(sum)=7\E(\text{sum}) = 7: fair price 77 euros. At 88, the expected loss is 11 euro per game.

5. Fair premium: 0.05×800=400.05 \times 800 = 40 euros. Charging 6060: expected profit 2020 euros per policy.

6. Splitting 5:35:3 rewards the past — but the pot belongs to whoever wins the future, and B might still win. Giving all to A treats a probable win as certain — B’s small chance is worth something.

7. Rounds to play: 33; outcomes (A-win/B-win per round): AAA, AAB, ABA, ABB, BAA, BAB, BBA, BBB. Player B takes the series only by winning all three: BBB alone. A wins the series in 77 of 88 cases: fair split 64×78=5664 \times \frac78 = 56 pistoles for A, 88 for B.

8. Playing the extra, pointless rounds changes nobody’s victory: once A has her sixth win, later rounds are ceremony. But fixing the horizon at exactly 33 rounds makes all 88 outcomes equally likely — honest counting needs same-length stories, and padding them out costs nothing.

9. At 5555: one deciding round, 3232 each. At 5544: A gets 64+322=48\frac{64 + 32}{2} = 48. At 5533: the next round leads to 6464 (A wins it) or to the 5544 position worth 4848: A’s share 64+482=56\frac{64 + 48}{2} = 56 — Fermat’s 56:856 : 8, re-derived by walking backwards.

10. A needs 22, B needs 33: play 44 imaginary rounds (1616 outcomes). B takes the series with 33 or 44 B-wins: 4+1=54 + 1 = 5 outcomes. Split: BB: 64×516=2064 \times \frac{5}{16} = 20; AA: 4444.

11. The fair present value of an uncertain future payoff is its expectation — probability-weighted average of what may come. Insurance (question 5) and finance (pricing uncertain payoffs) are this sentence turned into industries; so are casinos, from the other side of the table.

12. The pot always ends up somewhere: the two shares are random variables summing to the constant 6464, so by linearity EA+EB=64\E_A + \E_B = 64 — fair shares exhaust the pot, at every score.

13. Linearity: E(X+Y)=3.5+3.5=7\E(X + Y) = 3.5 + 3.5 = 7, table-free — true even for glued-together dice. Variance of one die: E(X2)3.52=916494=3512\E(X^2) - 3.5^2 = \frac{91}{6} - \frac{49}{4} = \frac{35}{12}; for independent dice V(X+Y)=3512+3512=356V(X + Y) = \frac{35}{12} + \frac{35}{12} = \frac{35}{6}.

14. Each fixed guest recovers their own hat with probability 1n\frac1n (their hat is one among nn). Summing over the nn guests: E(X)=n×1n=1\E(X) = n \times \frac1n = 1 — one lucky guest on average, whether the party has two hats or two thousand.

15. n=2n = 2: assignments: both right (X=2X = 2) or swapped (X=0X = 0): E=1\E = 1. n=3n = 3: the six assignments give X=3,1,1,1,0,0X = 3, 1, 1, 1, 0, 0: E=66=1\E = \frac{6}{6} = 1.

16. The computation added the expectations of the nn individual indicators (“guest ii got their hat”), and linearity adds expectations unconditionally — dependence would wreck a product or a variance, but never a sum of expectations. That is linearity’s superpower: no independence questions asked.

17. Both gains: E=0.5×105=0\E = 0.5 \times 10 - 5 = 0 and 0.005×10005=00.005 \times 1000 - 5 = 0. Variances (of the gain): A: E(G2)=0.5×25+0.5×25=25\E(G^2) = 0.5 \times 25 + 0.5 \times 25 = 25; B: 0.005×9952+0.995×2549750.005 \times 995^2 + 0.995 \times 25 \approx 4\,975: σA=5\sigma_A = 5, σB70.5\sigma_B \approx 70.5. People buy B: what they purchase is not expectation (zero in both) but the spread — a small chance of a life-changing right tail.

18. First tails at flip nn has probability 2n2^{-n} and pays 2n2^n: each nn contributes 2n×2n=12^{-n} \times 2^n = 1 to the expectation, which is therefore 1+1+1+1 + 1 + 1 + \dots: infinite. Yet no sane person pays 10001\,000 to play once: with probability 1516\frac{15}{16} the payout is at most 1616. Expectation summarizes the long run of repeatable bets; a once-in-a-lifetime game with a wild tail is not priced by its mean.

19. Expectations: insure 20-20; go bare 0.01×1000=10-0.01 \times 1000 = -10. The naked strategy wins on average — for someone who can absorb the loss and repeat the bet many times. A family that cannot survive the 1000-1\,000 is not in the averaging business: it pays 1010 extra to delete the variance. Insurers average; households buy certainty.

20. Born splitting a pot between two impatient gamblers; empowered by linearity, which sums hopes without asking permission of dependence; blind to risk, which variance — the lotteries, the Petersburg game, the family’s policy — must measure instead; and crowned next year by the law of large numbers, which explains why the averages always, eventually, collect.