Skip to content

Expected value

The mean is the probability-weighted average of a random variable, and the point where its distribution balances like weights on a beam.

Helps to know firstDiscrete random variables

Helps to know first
This topic

First, the picture

Six equal weights stand on a beam, one for each face of a die. Watch the pivot slide until the beam is level.

Where the average balances

A die's chances as weights on a beam: the mean is where the beam balances.

Six equal weights, one sixth on each face of a die. With the pivot at 1, the beam tips right: more weight lies to the right.

pivot at
1.00
mean, Σ x·p(x)
3.50
0.00 / 8.20 s
Describe this picture

A beam marked 1 to 6 carries six bars, one at each face of a fair die, each 16\tfrac16 tall and labelled 0.17: the die’s probability mass function standing as weights. A triangle under the beam is the pivot, labelled with its position. In the clip the pivot starts at 1 with the beam tipped towards the heavier right side, slides right, and the beam tips less and less until it sits level with the pivot at 3.5, between the bars for 3 and 4. Readouts give the pivot’s position and the mean, ∑x pX(x)\sum x\,p_X(x). After the clip each bar has a round handle on its top: drag one, or focus it and use the arrow keys, and the other bars rescale so that the heights still add to 1, while the pivot moves to the new mean and the beam stays level.

The balance point

The beam balances at 3.5. No roll of a die ever shows 3.5, yet that is the die’s centre: the point where the weights on the left and the right turn the beam equally.

That balance point has a formula. Each value xx pulls with its weight pX(x)p_X(x), and the beam is level where the weighted values average out:

E{X}=∑xx pX(x).\mathbb{E}\{X\}=\sum_x x\,p_X(x).

This is the expected value, or mean, of XX. I also write it μX\mu_X. For the die,

E{X}=1+2+3+4+5+66=3.5.\mathbb{E}\{X\}=\frac{1+2+3+4+5+6}{6}=3.5.

The mean is also the long-run average. Roll the die many times and add up the faces: each face turns up about a sixth of the time, so the average of the rolls settles near 3.5. The law of large numbers makes this precise.

After the clip, drag the bar at 6 up until it holds half the weight. The other five bars shrink to 0.1 each, and the pivot slides to 0.1×(1+2+3+4+5)+0.5×6=4.50.1\times(1+2+3+4+5)+0.5\times6=4.5. The pivot leans toward the heavy bar, but it never leaves the span from 1 to 6.

Watch out

The mean is not the most likely value, nor a value that must be possible. The die’s mean, 3.5, can never be rolled. “Expected” here means “average in the long run”, not “what to expect next”.

Means of the named shapes

Bernoulli. A variable that is 1 with chance pp and 0 otherwise has mean 1×p+0×(1−p)=p1\times p+0\times(1-p)=p.

Geometric. Roll until the first six, with chance pp of a six on each roll. You always make the first roll. With chance 1−p1-p it misses, and then the wait starts over, as long on average as before. So the mean wait mm satisfies m=1+(1−p) mm=1+(1-p)\,m, which gives

E{X}=1p.\mathbb{E}\{X\}=\frac1p.

For a die, p=16p=\tfrac16, so the mean wait is 6 rolls.

Binomial. The mean of Bin(n,p)\mathrm{Bin}(n,p) is npnp. Summing k pX(k)k\,p_X(k) directly takes some algebra; the next section gets it in one line.

Linearity

Change units, and the mean follows. If every value is multiplied by aa and shifted by bb, so is the balance point:

E{aX+b}=a E{X}+b.\mathbb{E}\{aX+b\}=a\,\mathbb{E}\{X\}+b.

More surprising: for any two random variables on the same experiment,

E{X+Y}=E{X}+E{Y}.\mathbb{E}\{X+Y\}=\mathbb{E}\{X\}+\mathbb{E}\{Y\}.

This holds always, whether or not XX and YY affect each other. The reason is that the sum ∑(x+y)Pr⁡{outcome}\sum(x+y)\Pr\{\text{outcome}\} splits into two sums, one for xx and one for yy, and splitting a sum needs no independence. This is linearity of the mean.

Two dice. The sum of two dice has mean 3.5+3.5=73.5+3.5=7.

The binomial in one line. A binomial count is a sum of nn Bernoulli variables, one per try, each with mean pp. So its mean is p+p+⋯+p=npp+p+\dots+p=np. The ten-row board of Discrete random variables at p=12p=\tfrac12 has mean 5, its middle bin.

Hats. Three people leave their hats at a door and each takes one back at random. How many people get their own hat, on average? List all 3!=63!=6 ways the hats can go back. One way gives everyone their own hat: 3 matches. Three ways swap two hats and leave one: 1 match each. Two ways move every hat: 0 matches. The total is 3+1+1+1+0+0=63+1+1+1+0+0=6, so the mean is 6/6=16/6=1.

Linearity gets this without the list. Person kk gets their own hat with chance 13\tfrac13, so the number of matches is a sum of three variables, each 1 with chance 13\tfrac13, and its mean is 3×13=13\times\tfrac13=1. The matches are not independent (if two people have their own hats, so does the third), but linearity does not care. With 100 people, the mean is 100×1100=1100\times\tfrac1{100}=1 again.

The mean of a function

Often you want the mean of something computed from XX: its square, a cost, a prize. Weight each computed value by the chance of xx:

E{g(X)}=∑xg(x) pX(x).\mathbb{E}\{g(X)\}=\sum_x g(x)\,p_X(x).

For the die, the mean of the square is

E{X2}=1+4+9+16+25+366=916=15.17,\mathbb{E}\{X^2\}=\frac{1+4+9+16+25+36}{6}=\frac{91}{6}=15.17,

but the square of the mean is 3.52=12.253.5^2=12.25. They differ.

Watch out

In general E{g(X)}≠g(E{X})\mathbb{E}\{g(X)\}\ne g(\mathbb{E}\{X\}). Only straight-line functions, g(x)=ax+bg(x)=ax+b, pass through the mean. For the die, the mean of 1/X1/X is 2.45/6=0.40832.45/6=0.4083, not 1/3.5=0.28571/3.5=0.2857.

The gap between E{X2}\mathbb{E}\{X^2\} and E{X}2\mathbb{E}\{X\}^2 is not an accident; it measures how spread out XX is, the subject of Variance and standard deviation.

Worked example

1. Roulette. A roulette wheel has 37 numbers. You bet £1 on one number. If it comes up, you get your £1 back plus £35; otherwise you lose the £1. Your net gain GG is +35+35 with chance 137\tfrac1{37} and −1-1 with chance 3637\tfrac{36}{37}:

E{G}=137×35−3637×1=−137=−0.0270.\mathbb{E}\{G\}=\frac{1}{37}\times35-\frac{36}{37}\times1=-\frac{1}{37}=-0.0270.

On average you lose 2.7p per £1 bet, so over 1000 spins of £1 you lose about £27. A game is fair when the mean gain is 0; this one is not, and the gap is the casino’s income.

2. Insurance. A house has a 1 % chance a year of a £5000 loss. The insurer’s mean payout is 0.01×5000=£500.01\times5000=£50. If the premium is £100, the insurer keeps £50 a year on average from each such house, to cover its costs and profit. You pay more than the mean loss to avoid the rare large one.

Try it yourself. Is 3.5 the most likely face of a die? No: it cannot occur at all. Every face has chance 16\tfrac16.

Where you’ll meet this

Pricing and insurance. Premiums, warranties and lottery prizes are set from mean payouts, plus a margin.

Design costs. An engineer choosing between two designs compares their expected costs: the cost of each failure times its chance, summed over the ways things can fail.

Signals. The average power of a signal is a mean, the mean of its square; for a random signal it is E{X2}\mathbb{E}\{X^2\}, not the square of the mean value. How big is a signal in the signal processing course measures it.

Retries and waiting. The mean of the geometric law, 1/p1/p, tells a network engineer how many tries a lossy link needs on average: a link that delivers a packet with chance 0.9 needs 1/0.9=1.111/0.9=1.11 sends per packet.

Where this leads · a dot product

List the values of XX as one vector and the pmf as another. The mean is their dot product: multiply matching entries and add. For the die, (1,2,3,4,5,6)⋅(16,…,16)=3.5(1,2,3,4,5,6)\cdot(\tfrac16,\dots,\tfrac16)=3.5.

Reference card

QuantityFormulaNotes
MeanE{X}=μX=∑xx pX(x)\mathbb{E}\{X\}=\mu_X=\sum_x x\,p_X(x)balance point; long-run average
Mean of a functionE{g(X)}=∑xg(x) pX(x)\mathbb{E}\{g(X)\}=\sum_x g(x)\,p_X(x)not g(E{X})g(\mathbb{E}\{X\}) in general
UnitsE{aX+b}=aE{X}+b\mathbb{E}\{aX+b\}=a\mathbb{E}\{X\}+b
SumsE{X+Y}=E{X}+E{Y}\mathbb{E}\{X+Y\}=\mathbb{E}\{X\}+\mathbb{E}\{Y\}always, independent or not
Bernoullipp
Binomial Bin(n,p)\mathrm{Bin}(n,p)npnpsum of nn Bernoullis
Geometric Geom(p)\mathrm{Geom}(p)1/p1/p6 rolls to a six
Fair gamemean gain 0roulette: −1/37-1/37 per bet

Keep reading with a free account.

By creating an account you accept the terms of use.

Sign in

Already have an account? Use the service you signed up with.

Or keep reading: get new lessons by email

Are you 13 or over?

Accounts and email updates are for people aged 13 or over. We keep only your answer, never your date of birth.

End of the lesson

Where to go next.

Phasorium

Account

Sign inKeep your place on any device

Subjects

Site

Look