Skip to content

How to calculate expected value

5 min read

Short answer

The expected value of a random variable XX is E[X]=∑xx P(X=x),E[X]=\sum_x x\,P(X=x), the average outcome weighted by how likely each one is. It is the long-run average if you repeat the experiment many times, not necessarily a value you can actually get.

Payoffs of a dice game with bar heights equal to probabilities and a balance point at the expected value−$3+$2+$4+$6E = +$0.50bar height = probability
A game's payoffs and their probabilities. The balance point of the bars, $0.50, is the expected value.

Weighted average, not plain average

If all outcomes were equally likely, the expected value would be the ordinary average. When they are not, each outcome counts in proportion to its probability. Multiply every value by its probability and add.

Linearity: the big shortcut

For any random variables, E[X+Y]=E[X]+E[Y]E[X+Y]=E[X]+E[Y] and E[aX+b]=aE[X]+bE[aX+b]=aE[X]+b, even if XX and YY are dependent. This turns many hard problems into easy sums: the expected total of two dice is just 3.5+3.53.5+3.5.

Worked example

You roll a fair die. If the result is even you win that many dollars; if it is odd you lose $3. What is your expected winnings per roll?

The outcomes and their probabilities:

  • 2, 4, 6 each with probability 16\tfrac16, payoffs +2,+4,+6+2,+4,+6.
  • 1, 3, 5 each with probability 16\tfrac16, payoff −3-3.

E=16(2+4+6)+16(−3−3−3)=12−96=0.50.E=\tfrac16(2+4+6)+\tfrac16(-3-3-3)=\tfrac{12-9}{6}=0.50. On average you gain $0.50 per roll, even though no single roll pays exactly that.

Try it yourself

A 2lotterytickethasa1−in−1000chanceofpaying2 lottery ticket has a 1-in-1000 chance of paying 1000 and pays nothing otherwise. What is the expected net gain per ticket?

Show the answer

Expected payout =11000⋅1000=1=\tfrac1{1000}\cdot1000=1 dollar, so the expected net gain is 1-2=-\1$ per ticket.

Keep going with practice

Expectation and variance are part of Vidi's Linear Algebra & Probability course, with graded problems on weighted averages and linearity.