Expected values explained using fair die example, showing weighted average calculation and formula E(X)=sum xP(X=x)

What Is an Expected Value?

A random variable is a quantity whose value depends on the outcome of an experiment that has not yet been performed, and which is therefore uncertain.

Almost all random variables have an expected value (or “expectation”). It is a fundamental concept in probability theory and in statistics. What does it mean? We illustrate expected values for discrete random variables with a fair die roll.

When we plan to roll a fair die, the result is equally likely to be any of the numbers $ { 1,2,3,4,5,6 } $.

Notice that the number $3.5$ lies exactly in the middle of this list.

If you were to roll the die $100$ times, and find the average of your scores, it is highly likely that this would be “close to” $3.5$. This provides some intuition about the concept. However, the actual definition uses the idea of a “weighted average”.

Let $X$ be the number that will be shown on the die after we roll it. Then we compute the expected value of $X$ as follows. Consider each outcome $X$ might take, then weight each of these by how likely they are, and finally add the resulting terms up. That is,

$$\mathbb{E}(X) = 1 \times \frac{1}{6} + 2 \times \frac{1}{6} + 3 \times \frac{1}{6} +4 \times \frac{1}{6} +5 \times \frac{1}{6} +6 \times \frac{1}{6} = \frac{21}{6} = 3.5$$

In general, the formula is

$$\mathbb{E}(X) = \sum_{\forall x} \ x \ \mathbb{P}(X=x)$$

Where $\forall x$ means the sum is “for all $x$”, i.e. over all values $x$ which $X$ might take.

For continuous random variables (not covered here), the procedure is similar in spirit but somewhat different.

The expectation is also “linear”, which means we can expand out brackets nicely:

$$\mathbb{E}(aX+b) = a \mathbb{E}(X)+b $$

$$\mathbb{E}(X+Y) = \mathbb{E}(X) + \mathbb{E}(Y)$$

Background: