- Practice
- About 21 min
- 5 practice questions
Mathematical expectation: mean and variance
Compute the mean (expected value), E(X²), the variance and the standard deviation of discrete and continuous random variables, and use E(aX + b) = aE(X) + b and Var(aX + b) = a²Var(X).
If something looks wrong, please tell us.
By the end of this lesson you can
- Find E(X) and E(g(X)) for discrete and continuous random variables.
- Compute the variance with Var(X) = E(X²) − [E(X)]² and the standard deviation.
- Prove and use the rules for E(aX + b) and Var(aX + b).
- Interpret the mean as a long-run average and the variance as spread.
Two numbers summarise a distribution: where its centre is and how spread out it is. The mean measures central tendency and the variance measures dispersion. They do not fix the distribution completely (two different distributions can share both), but they are simple and very useful.
From an ordinary average to expectation
The ten numbers 4, 1, 4, 6, 1, 4, 3, 6, 4, 7 (made-up data) have average 40/10 = 4. Grouping equal values: 1 occurs twice, 3 once, 4 four times, 6 twice and 7 once, so the average is also 1 × 2/10 + 3 × 1/10 + 4 × 4/10 + 6 × 2/10 + 7 × 1/10 = (2 + 3 + 16 + 12 + 7)/10 = 4. So an average is the sum of (value) × (proportion). Replacing proportions by probabilities gives the expected value.
Mean, moments and variance
The expected value, mean or mathematical expectation of X, written E(X) or μ, is E(X) = Σ x f(x) if X is discrete and E(X) = ∫₋∞^∞ x f(x) dx if X is continuous. More generally E(g(X)) = Σ g(x) f(x) or ∫ g(x) f(x) dx. With g(x) = xᵏ we get the k-th moment about the origin, E(Xᵏ); with k = 0, E(1) = Σ f(x) = 1. The mean is usually not a value X can actually take; think of it as the long-run average over many repetitions.
The variance is Var(X) = σ² = E[(X − μ)²], the mean of the squared deviations from the mean, and the standard deviation is σ = √Var(X). Both are never negative. A small variance means the values cluster near μ; a large one means they are scattered.
Properties, with proofs
- E(aX + b) = aE(X) + b. For discrete X: E(aX + b) = Σ(ax + b)f(x) = aΣxf(x) + bΣf(x) = aE(X) + b, since Σf(x) = 1. (Replace Σ by ∫ for continuous X.) So E(aX) = aE(X) and E(b) = b.
- Var(X) = E(X²) − [E(X)]². Var(X) = E(X² − 2μX + μ²) = E(X²) − 2μE(X) + μ² = E(X²) − 2μ² + μ² = E(X²) − μ².
- Var(aX + b) = a²Var(X). E(aX + b) = aμ + b, so Var(aX + b) = E[(aX + b − aμ − b)²] = E[a²(X − μ)²] = a²Var(X). So Var(aX) = a²Var(X) and Var(b) = 0: adding a constant shifts the values but does not change their spread.
E(X) = Σ x f(x) or ∫ x f(x) dx; Var(X) = E(X²) − [E(X)]²; E(aX + b) = aE(X) + b; Var(aX + b) = a²Var(X).
Worked example 1: a discrete distribution
Take the pmf from lesson 2: X = 0, 1, 2, 3 with probabilities 0.1, 0.3, 0.5, 0.1.
| x | f(x) | x f(x) | x² f(x) |
|---|---|---|---|
| 0 | 0.1 | 0 | 0 |
| 1 | 0.3 | 0.3 | 0.3 |
| 2 | 0.5 | 1.0 | 2.0 |
| 3 | 0.1 | 0.3 | 0.9 |
| Total | 1 | 1.6 | 3.2 |
So E(X) = 1.6, E(X²) = 3.2 and Var(X) = 3.2 − 1.6² = 3.2 − 2.56 = 0.64, with σ = 0.8. For Y = 5X − 2: E(Y) = 5(1.6) − 2 = 6 and Var(Y) = 25 × 0.64 = 16, so the standard deviation of Y is 4.
Worked example 2: is a game fair?
A player rolls a fair die, wins ₹12 if a 6 shows and loses ₹3 otherwise. Let X be the amount won: X = 12 with probability 1/6 and X = −3 with probability 5/6. E(X) = 12/6 − 15/6 = −3/6 = −₹0.50: in the long run the player loses 50 paise per game, so the game is not fair (a fair game has E(X) = 0). E(X²) = 144/6 + 9 × 5/6 = 24 + 7.5 = 31.5, so Var(X) = 31.5 − 0.25 = 31.25.
Worked example 3: a continuous distribution
f(x) = 2x for 0 < x < 1 (check: ∫₀¹ 2x dx = 1). E(X) = ∫₀¹ x·2x dx = [2x³/3]₀¹ = 2/3. E(X²) = ∫₀¹ x²·2x dx = [x⁴/2]₀¹ = 1/2. Var(X) = 1/2 − (2/3)² = 1/2 − 4/9 = 1/18.
Worked example 4: the exponential lifetime
For f(x) = 3e^(−3x), x > 0, use the gamma integral ∫₀^∞ xⁿ e^(−ax) dx = n!/a^(n+1) (or integrate by parts). E(X) = 3∫₀^∞ x e^(−3x) dx = 3 × 1!/3² = 1/3. E(X²) = 3∫₀^∞ x² e^(−3x) dx = 3 × 2!/3³ = 2/9. Var(X) = 2/9 − 1/9 = 1/9. In general, for f(x) = λe^(−λx), x > 0, the mean is 1/λ and the variance is 1/λ².
Key takeaways: the mean is the probability-weighted average of the values; the variance is the mean squared deviation, most easily found as E(X²) − [E(X)]². A linear change aX + b multiplies the mean by a and adds b, but multiplies the variance by a² and ignores b. For continuous variables, every Σ becomes an ∫.
Check your understanding
-
1. X takes the values 1, 2, 3 with probabilities 0.2, 0.5, 0.3. What is E(X)?
- 2
- 2.1
- 1.9
- 2.3
Show answer
Answer: B. E(X) = 1(0.2) + 2(0.5) + 3(0.3) = 0.2 + 1.0 + 0.9 = 2.1.
-
2. Var(X) = 4. What is Var(3X + 5)?
- 17
- 12
- 36
- 41
Show answer
Answer: C. Var(aX + b) = a²Var(X), and adding 5 does not change the spread. So Var(3X + 5) = 9 × 4 = 36.
-
3. E(X) = 2 and E(X²) = 13. What is the standard deviation of X?
- 9
- 3
- 11
- √13
Show answer
Answer: B. Var(X) = E(X²) − [E(X)]² = 13 − 4 = 9, so the standard deviation is √9 = 3.
-
4. X has pdf f(x) = 3x² on (0, 1). What is E(X)?
- 1/2
- 3/5
- 1/4
- 3/4
Show answer
Answer: D. E(X) = ∫₀¹ x·3x² dx = 3[x⁴/4]₀¹ = 3/4.
-
5. E(X) = 4. What is E(2X − 3)?
- 5
- 8
- 11
- 1
Show answer
Answer: A. E(2X − 3) = 2E(X) − 3 = 8 − 3 = 5.
Sign in to keep track of the lessons you finish.