Skip to content

Expected value: the mean of a distribution

Textbook

For a finite-valued random variable $X$, expected value is $\mathbb E[X]=\sum_x xP(X=x)$. The sum runs over distinct possible values, each multiplied by its probability. Other notation includes $E[X]$, $E(X)$, and $M(X)$.

For equally likely values 2, 4, and 6, the expectation is 4. For a fair coin taking values 0 and 1, it is $1/2$, even though a toss never produces that value. Expectation describes a distribution; it does not promise the next observation.

For a function of the variable, $\mathbb E_{X\sim D}[g(X)]$ states which distribution supplies the averaging weights. In particular, $\mathbb E[\mathbf1\{A\}]=P(A)$. This connects a classifier’s error probability with the expected indicator of error.

For an infinite set of values, a finite expectation requires absolute integrability, $\mathbb E[|X|]<\infty$. With density $p_X$, the expectation is $\mathbb E[X]=\int_{-\infty}^{+\infty}x\,p_X(x)\,dx$ under that condition. A density at a point is not the probability of that value. A particular sample’s mean is a different object and can differ from expectation.

In a finite model, nonnegative weights sum to one, so expectation lies between the smallest and largest possible values. Increasing every value by $c$ increases expectation by $c$, because the extra contributions total $c\sum_xP(X=x)=c$. Equal probabilities are a special case in which the weighted sum becomes the ordinary arithmetic mean of the list of possible values; unequal probabilities require their actual weights.

Definitions and notation: Mathematics for Computer Science; Mathematics for Machine Learning.

Related concept: classification error.

Related concepts: Random variables: a number for each outcome, Arithmetic mean of observations.

In plain language

Expected value adds possible values using their probabilities as weights. It resembles the average price of a basket accounting for the quantity of each item; a list of price tags alone is insufficient. A fair coin with outcomes 0 and 1 has expectation 0.5 even though half a coin is not an available outcome. The name slightly betrays the translator: expectation describes the center of a specified distribution rather than promising that result in one trial.

Example

In this constructed model, $X$ takes 2, 4, and 6 with equal probability. Its expectation combines weighted contributions.

Expected value: the mean of a distribution

Distribution

Each value receives weight 1/3.

Step 1 of 4: Distribution

Read all steps
  1. Distribution

    Each value receives weight 1/3.

    Values
    246
    Probabilities
    1/31/31/3
  2. First contribution

    Value 2 contributes 2/3.

    Contributions
    2/3current——
  3. All contributions

    Each remaining value is multiplied by its probability.

    Contributions
    2/3included4/3included6/3current
  4. Sum

    The contributions sum to 4. A particular sample can have a different mean.

    Expectation
    4included

The numbers $2/3$, $4/3$, and $6/3$ are contributions, not probabilities; they may exceed one. The probabilities themselves remain $1/3$ and total one. The answer 4 lies between 2 and 6, checking the result’s bounds. Simply adding 2, 4, and 6 would give 12, but would discard the probability weights and would not be this model’s expectation.

An expectation is determined by the variable, its possible values, and the distribution supplying the weights.

The original text of this free article is published under CC BY-NC-ND 4.0.

Previous / next

Previous
Random variables: a number for each outcome
Next
Variance: the mean squared deviation
  • Natural Numbers: Counting Discrete Objects

    Which values count discrete objects, and why the zero convention must be stated.

    Read article
    Math
  • Integers: Counting on Both Sides of Zero

    Positive and negative integers, zero, and the limits of integer division.

    Read article
    Math
  • Rational Numbers: Ratios of Integers

    Numbers as ratios of integers: equivalent fractions and the nonzero denominator requirement.

    Read article
    Math