← Today's challenge

RANDOM VARIABLES · 7 MIN READ

Expected value: how to calculate a long-run average

Expected value is the probability-weighted average of a numerical outcome. It describes the mean across many repetitions, not what must happen on the next trial.

The quick answer

To calculate the expected value of a discrete random variable, multiply each possible value by the probability of that value, then add the results.

E[X] = sum over outcomes x of x × P(X = x)

Expected value is a mathematical average. The average can fall between possible outcomes: a fair die has expected value 3.5 even though you will never roll 3.5.

Worked example 1: one fair die

A fair die has six equally likely faces. The expectation is:

E[roll] = (1 + 2 + 3 + 4 + 5 + 6) / 6 = 3.5

This is the average result if you repeat the experiment many times. It is not a forecast that the next roll will be close to 3.5.

Worked example 2: unequal probabilities

Consider a fictional scoring rule: you earn 9 points with probability 20%, or lose 3 points with probability 80%.

Outcomes and their contributions to expectation
PointsProbabilityWeighted contribution
+90.20+1.80
−30.80−2.40
Expected points1.00−0.60

E[points] = 9 × 0.20 − 3 × 0.80 = −0.6 points

The outcome with the highest score is attractive, but the negative outcome happens much more often. This example illustrates why a probability distribution matters more than its most exciting possible result.

The most useful shortcut: linearity

Expected value is linear. For constants a and b:

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

For two random variables, E[X + Y] = E[X] + E[Y]. Independence is not required for this identity, provided the expectations exist.

For example, two fair dice have expected total 3.5 + 3.5 = 7. The same addition principle works when random variables are dependent; dependence becomes important for many other calculations, such as variances and products.

Why indicator variables are so useful

Define an indicator for an event to equal 1 if that event happens and 0 otherwise. Its expected value is just the probability of the event. If you want the expected number of events in a collection, write that count as a sum of indicators and add their individual probabilities.

For instance, if three fair coins are tossed, let each indicator be 1 when its coin lands heads. Each has expectation 1/2, so the expected number of heads is 1/2 + 1/2 + 1/2 = 1.5. No need to list all eight combinations.

Common mistakes

  • Forgetting the probabilities: The unweighted arithmetic mean is correct only when all outcomes are equally likely.
  • Treating expectation as a likely individual outcome: It is a long-run average, not necessarily a possible observation.
  • Demanding independence for sums: Linearity of expectation holds even if the terms are correlated.
  • Ignoring the units: An expectation measured in points is not interchangeable with a probability measured between zero and one.

Try it yourself

A spinner gives 0 points with probability 1/2, 4 points with probability 1/4, and 8 points with probability 1/4. What is its expected score?

Reveal the worked answer

Multiply and add: 0 × (1/2) + 4 × (1/4) + 8 × (1/4) = 3 points.

For the formal discrete expectation formula, see OpenStax’s chapter on expected value.