Skip to content
Part IA Easter Term

Linearity of Expectation

The Linearilty Property

Expectation preserves linearity. For any random variables XX and YY, and constants aa and bb:

E[aX+b]=aE[X]+bE[aX + b] = aE[X] + b

E[X+Y]=E[X]+E[Y]E[X + Y] = E[X] + E[Y]

E[aX+bY]=aE[X]+bE[Y]E[aX + bY] = aE[X] + bE[Y]

Crucially: XX and YY need NOT be independent. Linearity holds regardless of dependence.

Proof for Constants

E[aX+b]=x(ax+b)p(x)=axxp(x)+bxp(x)=aE[X]+b1=aE[X]+bE[aX + b] = \sum_x (ax + b) p(x) = a\sum_x x p(x) + b\sum_x p(x) = aE[X] + b \cdot 1 = aE[X] + b

Proof for Sum of Two Variables

For discrete XX and YY:

E[X+Y]=xy(x+y)p(x,y)=xyxp(x,y)+xyyp(x,y)E[X + Y] = \sum_x \sum_y (x + y) p(x, y) = \sum_x \sum_y x p(x, y) + \sum_x \sum_y y p(x, y)

=xxyp(x,y)+yyxp(x,y)=xxpX(x)+yypY(y)=E[X]+E[Y]= \sum_x x \sum_y p(x, y) + \sum_y y \sum_x p(x, y) = \sum_x x p_X(x) + \sum_y y p_Y(y) = E[X] + E[Y]

Why This Matters

Linearity is perhaps the most useful property of expectation. Many problems that would otherwise be intractable become straightforward.

Example: Transformed Die

Roll a fair die. Let Y=3X+1Y = 3X + 1.

We could compute E[Y]E[Y] directly: values are {4,7,10,13,16,19}\{4, 7, 10, 13, 16, 19\} with equal probability, giving E[Y]=4+7+10+13+16+196=696=11.5E[Y] = \frac{4+7+10+13+16+19}{6} = \frac{69}{6} = 11.5.

But using linearity:

E[Y]=E[3X+1]=3E[X]+1=3(3.5)+1=11.5E[Y] = E[3X + 1] = 3E[X] + 1 = 3(3.5) + 1 = 11.5

Indicator Trick

Many problems become easy by expressing the quantity of interest as a sum of indicators.

Example: Matching Problem

nn people throw hats into a pile, then each picks one randomly. Expected number who get their own hat?

Let IiI_i = indicator that person ii gets their own hat. Then:

X=i=1nIiX = \sum_{i=1}^{n} I_i

is the number of matches.

E[Ii]=P(person i gets own hat)=1nE[I_i] = P(\text{person } i \text{ gets own hat}) = \frac{1}{n}

By linearity:

E[X]=i=1nE[Ii]=n1n=1E[X] = \sum_{i=1}^{n} E[I_i] = n \cdot \frac{1}{n} = 1

Regardless of nn, the expected number of matches is 1.

Example: Expected Number of Aces

Draw 5 cards from a standard deck. Expected number of aces?

Let IiI_i = indicator that card ii is an ace.

E[Ii]=P(card i is ace)=452=113E[I_i] = P(\text{card } i \text{ is ace}) = \frac{4}{52} = \frac{1}{13}

E[number of aces]=i=15E[Ii]=5113=513E[\text{number of aces}] = \sum_{i=1}^{5} E[I_i] = 5 \cdot \frac{1}{13} = \frac{5}{13}

Example: Email Spam

100 emails, each independently has probability 0.4 of being spam. Expected number of spam emails?

Let IiI_i indicate email ii is spam.

E[Ii]=0.4E[I_i] = 0.4

E[spam count]=100×0.4=40E[\text{spam count}] = 100 \times 0.4 = 40

Linearity Extends to nn Variables

By induction:

E[i=1nXi]=i=1nE[Xi]E\left[\sum_{i=1}^{n} X_i\right] = \sum_{i=1}^{n} E[X_i]

Regardless of dependence among the XiX_i.

Caution: Products and Functions

Linearity does NOT extend to products:

E[XY]E[X]E[Y] in generalE[XY] \neq E[X] E[Y] \text{ in general}

Equality holds if XX and YY are independent.

Linearity does NOT extend to arbitrary functions:

E[g(X)]g(E[X]) in generalE[g(X)] \neq g(E[X]) \text{ in general}

Counterexample: E[X2]E[X]2E[X^2] \neq E[X]^2 for a die roll.

Application: Sums of Identical Distributions

If X1,X2,,XnX_1, X_2, \ldots, X_n are i.i.d. with mean μ\mu:

E[X1+X2++Xn]=nμE[X_1 + X_2 + \cdots + X_n] = n\mu

This is the foundation of the Law of Large Numbers.

Probabilistic Method

Linearity enables the probabilistic method: to prove existence of an object with property PP, show E[X]>0E[X] > 0 for some non-negative random variable XX, where X>0X > 0 implies property PP. Then there must exist some outcome with X>0X > 0.

Summary

PropertyFormula
Scaling and shiftE[aX+b]=aE[X]+bE[aX + b] = aE[X] + b
AdditivityE[X+Y]=E[X]+E[Y]E[X + Y] = E[X] + E[Y]
GeneralE[iXi]=iE[Xi]E[\sum_i X_i] = \sum_i E[X_i]
No independence neededHolds for dependent variables