A random variable attaches a number to each outcome of an experiment. Once you have its distribution, two summary numbers — the expectation and the variance — describe almost everything you need.
Discrete random variables
A discrete random variable takes separate, countable values: the score on a die, the number of defective items in a batch.
Notation: capital X X X for the variable, lower-case x x x for a particular value, so P ( X = x ) P(X = x) P ( X = x ) is the probability that X X X takes the value x x x .
Probability distributions
A probability distribution lists every value with its probability. Two conditions must hold:
0 ≤ P ( X = x ) ≤ 1 and ∑ P ( X = x ) = 1 0 \le P(X = x) \le 1 \qquad \text{and} \qquad \sum P(X = x) = 1 0 ≤ P ( X = x ) ≤ 1 and ∑ P ( X = x ) = 1
x x x
1
2
3
4
P ( X = x ) P(X=x) P ( X = x )
0.1
0.2
0.4
0.3
The probabilities total 1 1 1 ✓
Finding an unknown constant. If X X X takes the values 1 , 2 , 3 1, 2, 3 1 , 2 , 3 with P ( X = x ) = k x P(X = x) = kx P ( X = x ) = k x , then
k ( 1 ) + k ( 2 ) + k ( 3 ) = 1 ⇒ 6 k = 1 ⇒ k = 1 6 k(1) + k(2) + k(3) = 1 \quad \Rightarrow \quad 6k = 1 \quad \Rightarrow \quad k = \tfrac16 k ( 1 ) + k ( 2 ) + k ( 3 ) = 1 ⇒ 6 k = 1 ⇒ k = 6 1
Key result The probabilities summing to 1 is what determines any unknown constant. Whenever a distribution contains a k k k , that equation is the first line of the answer.
Expectation
E ( X ) = ∑ x P ( X = x ) E(X) = \sum x\,P(X = x) E ( X ) = ∑ x P ( X = x )
the long-run average value if the experiment were repeated indefinitely.
For the distribution above:
E ( X ) = 1 ( 0.1 ) + 2 ( 0.2 ) + 3 ( 0.4 ) + 4 ( 0.3 ) = 0.1 + 0.4 + 1.2 + 1.2 = 2.9 E(X) = 1(0.1) + 2(0.2) + 3(0.4) + 4(0.3) = 0.1 + 0.4 + 1.2 + 1.2 = 2.9 E ( X ) = 1 ( 0.1 ) + 2 ( 0.2 ) + 3 ( 0.4 ) + 4 ( 0.3 ) = 0.1 + 0.4 + 1.2 + 1.2 = 2.9
For a fair die:
E ( X ) = 1 + 2 + 3 + 4 + 5 + 6 6 = 3.5 E(X) = \frac{1+2+3+4+5+6}{6} = 3.5 E ( X ) = 6 1 + 2 + 3 + 4 + 5 + 6 = 3.5
Common mistake E ( X ) E(X) E ( X ) need not be a value the variable can actually take. A die never shows 3.5, and a family never has 2.4 children — the expectation is an average, not a prediction of any single outcome.
For a function of X X X , weight the function's values by the same probabilities:
E ( g ( X ) ) = ∑ g ( x ) P ( X = x ) E\big(g(X)\big) = \sum g(x)\,P(X = x) E ( g ( X ) ) = ∑ g ( x ) P ( X = x )
E ( X 2 ) = 1 ( 0.1 ) + 4 ( 0.2 ) + 9 ( 0.4 ) + 16 ( 0.3 ) = 0.1 + 0.8 + 3.6 + 4.8 = 9.3 E(X^2) = 1(0.1) + 4(0.2) + 9(0.4) + 16(0.3) = 0.1 + 0.8 + 3.6 + 4.8 = 9.3 E ( X 2 ) = 1 ( 0.1 ) + 4 ( 0.2 ) + 9 ( 0.4 ) + 16 ( 0.3 ) = 0.1 + 0.8 + 3.6 + 4.8 = 9.3
Common mistake E ( X 2 ) E(X^2) E ( X 2 ) is not [ E ( X ) ] 2 \big[E(X)\big]^2 [ E ( X ) ] 2 . Here 9.3 ≠ 2.9 2 = 8.41 9.3 \ne 2.9^2 = 8.41 9.3 = 2. 9 2 = 8.41 , and the gap between them is precisely the variance.
Variance
Var ( X ) = E ( X 2 ) − [ E ( X ) ] 2 \operatorname{Var}(X) = E(X^2) - \big[E(X)\big]^2 Var ( X ) = E ( X 2 ) − [ E ( X ) ] 2
For the distribution above:
Var ( X ) = 9.3 − 8.41 = 0.89 \operatorname{Var}(X) = 9.3 - 8.41 = 0.89 Var ( X ) = 9.3 − 8.41 = 0.89
The standard deviation is 0.89 = 0.943 \sqrt{0.89} = 0.943 0.89 = 0.943 .
For a fair die:
E ( X 2 ) = 1 + 4 + 9 + 16 + 25 + 36 6 = 91 6 Var ( X ) = 91 6 − 49 4 = 35 12 ≈ 2.92 E(X^2) = \frac{1+4+9+16+25+36}{6} = \frac{91}{6} \qquad \operatorname{Var}(X) = \frac{91}{6} - \frac{49}{4} = \frac{35}{12} \approx 2.92 E ( X 2 ) = 6 1 + 4 + 9 + 16 + 25 + 36 = 6 91 Var ( X ) = 6 91 − 4 49 = 12 35 ≈ 2.92
Key result Variance is never negative, so E ( X 2 ) ≥ [ E ( X ) ] 2 E(X^2) \ge \big[E(X)\big]^2 E ( X 2 ) ≥ [ E ( X ) ] 2 always. A negative variance means the two terms have been subtracted the wrong way round.
E ( a X + b ) = a E ( X ) + b E(aX + b) = aE(X) + b E ( a X + b ) = a E ( X ) + b
Var ( a X + b ) = a 2 Var ( X ) \operatorname{Var}(aX + b) = a^2\operatorname{Var}(X) Var ( a X + b ) = a 2 Var ( X )
With E ( X ) = 2.9 E(X) = 2.9 E ( X ) = 2.9 and Var ( X ) = 0.89 \operatorname{Var}(X) = 0.89 Var ( X ) = 0.89 :
E ( 3 X + 2 ) = 3 ( 2.9 ) + 2 = 10.7 E(3X + 2) = 3(2.9) + 2 = 10.7 E ( 3 X + 2 ) = 3 ( 2.9 ) + 2 = 10.7
Var ( 3 X + 2 ) = 9 ( 0.89 ) = 8.01 \operatorname{Var}(3X + 2) = 9(0.89) = 8.01 Var ( 3 X + 2 ) = 9 ( 0.89 ) = 8.01
Key result The + b +b + b vanishes from the variance. Shifting every value by a constant moves the whole distribution without changing its spread — the same fact as adding a constant to a data set.
Common mistake The scale factor is squared in the variance: a 2 a^2 a 2 , not a a a . And it stays positive even when a a a is negative, since Var ( − 2 X ) = 4 Var ( X ) \operatorname{Var}(-2X) = 4\operatorname{Var}(X) Var ( − 2 X ) = 4 Var ( X ) .
The cumulative distribution function
F ( x ) = P ( X ≤ x ) F(x) = P(X \le x) F ( x ) = P ( X ≤ x )
a running total of the probabilities.
x x x
1
2
3
4
P ( X = x ) P(X=x) P ( X = x )
0.1
0.2
0.4
0.3
F ( x ) F(x) F ( x )
0.1
0.3
0.7
1.0
F F F never decreases, and its final value is always 1.
Individual probabilities can be recovered by subtraction:
P ( X = x ) = F ( x ) − F ( x − 1 ) P(X = x) = F(x) - F(x-1) P ( X = x ) = F ( x ) − F ( x − 1 )
so P ( X = 3 ) = 0.7 − 0.3 = 0.4 P(X = 3) = 0.7 - 0.3 = 0.4 P ( X = 3 ) = 0.7 − 0.3 = 0.4 ✓
Common mistake For a discrete variable, P ( X < 3 ) P(X < 3) P ( X < 3 ) and P ( X ≤ 3 ) P(X \le 3) P ( X ≤ 3 ) are different : the first is F ( 2 ) = 0.3 F(2) = 0.3 F ( 2 ) = 0.3 , the second F ( 3 ) = 0.7 F(3) = 0.7 F ( 3 ) = 0.7 . Read the inequality carefully — this distinction disappears only for continuous variables.
Exam tip P ( X > 2 ) = 1 − F ( 2 ) = 0.7 P(X > 2) = 1 - F(2) = 0.7 P ( X > 2 ) = 1 − F ( 2 ) = 0.7 , and P ( 2 < X ≤ 4 ) = F ( 4 ) − F ( 2 ) = 0.7 P(2 < X \le 4) = F(4) - F(2) = 0.7 P ( 2 < X ≤ 4 ) = F ( 4 ) − F ( 2 ) = 0.7 . Working from the cumulative function turns most probability questions into a single subtraction.