Lesson 7: Discrete Random Variables and Expected ValueAP
🎧 Listen to this lesson
A random variable X assigns a number to each outcome of a random process. For a discrete random variable, we describe it with a probability distribution: a table of values and their probabilities, which must each lie between 0 and 1 and sum to 1. Two numbers summarise the distribution, and the AP exam cares about both and about how they behave when variables are transformed or combined: the mean (expected value) and the standard deviation.
Mean and standard deviation of a discrete random variable
The mean (expected value) μ_X = Σ x_i p_i is the long-run average value of X over many repetitions — a probability-weighted average. It need not be a value X can actually take: a fair die has mean 3.5, and no face shows 3.5. The variance σ_X² = Σ (x_i − μ_X)² p_i weights squared distances from the mean, and the standard deviation σ_X is its square root, interpretable as the typical distance from the mean in the long run.
Worked example 1 (a raffle). A school sells 1,000 raffle tickets at $2 each. Prizes: one $500 grand prize, two $100 prizes, ten $10 prizes. Let X = a buyer's net gain. The distribution: X = 498 with probability 0.001; X = 98 with probability 0.002; X = 8 with probability 0.010; X = −2 with probability 0.987. E(X) = 498(0.001) + 98(0.002) + 8(0.010) + (−2)(0.987) = 0.498 + 0.196 + 0.080 − 1.974 = −1.20. The expected value is −$1.20: in the long run, a buyer loses on average $1.20 per ticket — the raffle is a fundraising device, not an investment. For spread: E(X²) = 498²(0.001) + 98²(0.002) + 8²(0.010) + 4(0.987) ≈ 248.00 + 19.21 + 0.64 + 3.95 = 271.80, so σ_X² = 271.80 − (−1.20)² = 270.36 and σ_X ≈ $16.44. The standard deviation dwarfs the mean loss: individual outcomes swing wildly even though the *average* outcome is a small, predictable loss. That contrast — stable mean, large per-trial spread — is the foundation of the insurance industry.
Transforming and combining random variables
Two rules cover nearly every exam question:
- Linear transformation Y = a + bX: μ_Y = a + bμ_X, but σ_Y = |b|σ_X. Adding a constant shifts the centre but does not change the spread at all.
- Combining independent variables: μ_{X+Y} = μ_X + μ_Y always. For spread, variances add, standard deviations do not: σ²_{X+Y} = σ²_X + σ²_Y, and σ²_{X−Y} = σ²_X + σ²_Y too (the variance of a difference is still a sum — subtracting a wobbly quantity cannot make the total steadier).
Worked example 2. A bakery's daily muffin demand D has μ_D = 40 and σ_D = 6. Each muffin contributes $1.50 profit, so daily profit P = 1.5D has μ_P = 1.5 × 40 = $60 and σ_P = 1.5 × 6 = $9. Over two independent days, total demand T = D1 + D2 has μ_T = 80 and σ_T = √(6² + 6²) = √72 ≈ 8.49 muffins. Note what did not happen: the two-day SD is not 12. Independent ups and downs partially cancel — variance grows with the number of trials, but standard deviation grows only with its square root. This is the mathematical seed of the law of large numbers and of every sampling distribution in Unit 5.
Real-world application
Insurance is expected value with a business model. A term-life policy might cost $300 a year with a 0.001 probability of paying out $250,000: the insurer's expected payout per policy is 0.001 × 250,000 = $250, so the expected profit is $50 per policy — multiplied by a million policies, with variability per policy averaged away. Casinos, warranty pricing and clinical-trial planning (expected number of adverse events) all run on exactly the arithmetic of this lesson.
Common mistakes
- Adding standard deviations. σ_{X+Y} is never σ_X + σ_Y for independent variables; add variances, then take the square root at the end.
- Subtracting variances for a difference. Var(X − Y) = Var(X) + Var(Y) for independent X and Y. The minus sign does not survive squaring.
- Expecting E(X) to be a possible outcome. "Expected" means long-run average; 3.5 on a die is correct and unremarkable.
- Forgetting the distribution check. Probabilities in any proposed distribution must sum to 1 — the exam plants tables that sum to 0.97 to test whether you check.
AP Exam Experience
Question 1. A random variable X has distribution: X = 0, 1, 2, 3 with probabilities 0.5, 0.3, 0.15, 0.05. The expected value of X is:
- (A) 1.5
- (B) 0.75
- (C) 0.85
- (D) 1.0
- (E) 6.0
Answer: (B). E(X) = 0(0.5) + 1(0.3) + 2(0.15) + 3(0.05) = 0.30 + 0.30 + 0.15 = 0.75. Choice (A) is the plain average of the values, which ignores the probabilities — the weighting is the whole point.
Question 2. If Y = 5 + 3X, where μ_X = 10 and σ_X = 2, then μ_Y and σ_Y are:
- (A) μ_Y = 35, σ_Y = 11
- (B) μ_Y = 35, σ_Y = 6
- (C) μ_Y = 35, σ_Y = 2
- (D) μ_Y = 53, σ_Y = 6
- (E) μ_Y = 15, σ_Y = 6
Answer: (B). μ_Y = 5 + 3(10) = 35. The added constant 5 does not affect spread, and the multiplier scales the SD: σ_Y = |3| × 2 = 6. Choice (A) wrongly adds 5 to the SD as well.
Question 3. X and Y are independent with σ_X = 3 and σ_Y = 4. The standard deviation of X − Y is:
- (A) 1
- (B) 5
- (C) 7
- (D) 25
- (E) −1
Answer: (B). Var(X − Y) = 9 + 16 = 25, so SD = 5. The difference of independent variables is *more* variable than either alone, and choice (D) is the variance, not the standard deviation — the final square root is a classic last-step slip.
Free-response question. A carnival game uses a spinner with four regions. The payout X (in dollars) for one play is: $0 with probability 0.50, $5 with probability 0.30, $10 with probability 0.15, and $25 with probability 0.05. The game costs $5 to play. (a) Compute the expected payout E(X) and interpret it in context. (b) Compute the standard deviation of the payout. (c) A player says: "The expected payout is not a possible prize, so expected value is useless." Respond to the player, referring to the long run. (d) Taking the $5 cost into account, is the game favourable to the player, the carnival, or fair? Justify.
Scoring guideline.
- Part (a): Essentially correct if E(X) = 0(0.50) + 5(0.30) + 10(0.15) + 25(0.05) = 1.50 + 1.50 + 1.25 = $4.25, interpreted as the average payout per play over many plays approaching $4.25. Partially correct if the computation is right but no long-run interpretation is given. Incorrect if the values are averaged without weights.
- Part (b): Essentially correct if E(X²) = 0 + 25(0.30) + 100(0.15) + 625(0.05) = 7.5 + 15 + 31.25 = 53.75, Var = 53.75 − 4.25² = 53.75 − 18.0625 = 35.6875, and σ ≈ $5.97. Partially correct if the variance is correct but the square root is omitted (the answer is then the variance, not the SD).
- Part (c): Essentially correct if it explains that expected value describes the average over many repetitions — the player will not win $4.25 on any single spin, but over hundreds of spins the average payout per spin settles near $4.25 (law of large numbers). Incorrect if it claims he will win about $4.25 total or on the next spin.
- Part (d): Essentially correct if net expected gain = 4.25 − 5.00 = −$0.75 per play, so the game favours the carnival by about 75 cents per play in the long run. Partially correct if the comparison is made but the long-run qualification is absent.
Deeper dive: why casinos and insurers sleep well — the √n effect
The raffle's σ of about $16.44 describes one ticket. But the school sells all 1,000 tickets, and the organiser's *average* payout per ticket has standard deviation σ/√n = 16.44/√1000 ≈ $0.52. The total economics become almost deterministic: the organiser keeps roughly $1.20 per ticket, give or take about fifty cents of average wobble. This is precisely the insurer's position: individual policies are wildly variable (a $250,000 payout or nothing), but the *average* claim across a million policies is predictable to the cent. The mathematical engine — means have spread σ, averages of n independent copies have spread σ/√n — is the same one that will power sampling distributions in Unit 5. When a problem gives you a choice between reasoning about a total and reasoning about an average, remember they differ only by the factor n in the centre and √n in the spread: μ_total = nμ, σ_total = σ√n; μ_average = μ, σ_average = σ/√n.
Second worked example: a dice game, priced exactly
A fair die is rolled once. You win, in dollars, the number showing, and pay $4 to play. Let X be your net gain: X takes values −3, −2, −1, 0, 1, 2 (for rolls 1–6), each with probability 1/6. E(X) = (−3 − 2 − 1 + 0 + 1 + 2)/6 = −3/6 = −$0.50. Equivalently, by the transformation rules: the face value F has μ_F = 3.5, and X = F − 4, so μ_X = 3.5 − 4 = −0.50 — and σ_X = σ_F ≈ 1.71, unchanged, because subtracting a constant slides the distribution without stretching it. A "fair" price for this game would be $3.50; at $4 the house edge is 50 cents per roll. Now scale it: a casino running this game 100,000 times expects to keep about $50,000, with the standard deviation of the *total* kept equal to σ√n = 1.71 × √100000 ≈ $541 — a rounding error next to the expected take. Expected value tells you the destination; standard deviation tells you how bumpy the road is; the casino's business model is that for them, the road is short and smooth.
📊 Interactive
Interactive — hover or explore the chart above.
🎬 Watch & Learn
Free YouTube video lessons on “Discrete Random Variables and Expected Value” — pick a result below:
- AP Statistics — Discrete Random Variables and Expected Value: full video lesson
- Discrete Random Variables and Expected Value on Khan Academy
- Discrete Random Variables and Expected Value on jbstatistics
- Discrete Random Variables and Expected Value on StatQuest
- Exam practice & worked examples: Discrete Random Variables and Expected Value