The mathematical expectation (also known as the expectation, the expected value or the mean) of a random variable is the average value taken by a random variable over an infinite number of trials.
The expectation is a linear function, meaning for instance that the expectation of a sum is the sum of the expectations.
We will compute an estimate of the expected value of a random variable recording the number of dots on the top face of a die by rolling the die an infinite number times and computing the average score.
Expected value: 3.5
Value observed for this trial:
Empirical average:
Number of rolls:
Estimation error:
More generally, for any function $f : \Y \rightarrow \R$, we have $$ \E_Y [ f(Y) ] = \sum_{y\in\Y} f(y) \ P( Y = y ) . $$
More generally, for any function $f : \X \rightarrow \R$, we have $$ \E_X [ f(X) ] = \int_{\X} f(x)\, p_X(x) dx . $$