Mathematics.

foundations of probability

Expected Value

Probability30 minDifficulty4 out of 10

You should know: random variables

Overview

In probability theory, the expected value (also called the expectation, mean, or first moment) is a generalization of the weighted average. It summarizes a random variable's distribution with a single number: the long-run average value you'd observe if you repeated the underlying random experiment infinitely many times. Unlike a simple average, the expected value weights each possible outcome by its probability, not by equal weight.

Intuition

If a random variable takes several possible values, each with its own probability, the expected value asks: 'if I repeated this experiment a huge number of times and averaged all the results, what number would I converge to?' Rolling a fair six-sided die repeatedly and averaging the results converges to 3.5 — not because 3.5 is ever actually rolled, but because it's the probability-weighted center of mass of {1,2,3,4,5,6}. Expectation is exactly a center of mass: each outcome xᵢ is a point with 'mass' pᵢ, and E[X] is where the whole distribution balances.

Interactive Graph

Expected value is the mean of the distribution

Loading visualization…

Formal Definition

Definition

For a discrete random variable X taking values x₁, x₂, ..., xₖ with probabilities p₁, ..., pₖ (summing to 1), the expected value is the probability-weighted sum of its possible values. For a continuous random variable with density f(x), the sum becomes an integral.

E[X]=x1p1+x2p2++xkpk\operatorname{E}[X] = x_1p_1 + x_2p_2 + \cdots + x_kp_k

Weighted average of outcomes, weighted by their probabilities

Discrete expectation
p1+p2++pk=1p_1 + p_2 + \cdots + p_k = 1

The probabilities must sum to 1

E[X]=xf(x)dx\operatorname{E}[X] = \int_{-\infty}^{\infty} x\, f(x)\, dx

The continuous analog, integrating over the probability density

Continuous expectation
E[X]=116+216+316+416+516+616=3.5\operatorname{E}[X] = 1\cdot\tfrac16 + 2\cdot\tfrac16 + 3\cdot\tfrac16 + 4\cdot\tfrac16 + 5\cdot\tfrac16 + 6\cdot\tfrac16 = 3.5

Expected value of a fair six-sided die roll

Fair die example

Notation

NotationMeaning
E[X]\operatorname{E}[X]The expected value of random variable XAlso written: μ, ⟨X⟩
Var(X)=E[(Xμ)2]\operatorname{Var}(X) = \operatorname{E}[(X-\mu)^2]The variance of X — the expected squared deviation from the mean
E[g(X)]\operatorname{E}[g(X)]The expected value of a function of X (law of the unconscious statistician)

Properties

Linearity

E[aX+bY]=aE[X]+bE[Y]\operatorname{E}[aX + bY] = a\operatorname{E}[X] + b\operatorname{E}[Y]

Condition: always holds, even if X and Y are dependent

Constant

E[c]=c\operatorname{E}[c] = c

Condition: for a constant c

Product for independent variables

E[XY]=E[X]E[Y]\operatorname{E}[XY] = \operatorname{E}[X]\operatorname{E}[Y]

Condition: if X and Y are independent

Variance formula

Var(X)=E[X2](E[X])2\operatorname{Var}(X) = \operatorname{E}[X^2] - (\operatorname{E}[X])^2

Applications

Expected value determines the fair price of a bet, insurance premium, or financial derivative under a given probability model.

Worked Examples

  1. Apply the discrete expectation formula.

    E[X]=10(0.2)+0(0.5)+(5)(0.3)=2+01.5=0.5\operatorname{E}[X] = 10(0.2) + 0(0.5) + (-5)(0.3) = 2 + 0 - 1.5 = 0.5

Answer: E[X] = $0.50 — the game favors the player by 50 cents on average.

Practice Problems

Difficulty 3/10

A fair six-sided die is rolled. Find E[X] where X is the value shown.

Difficulty 5/10

A lottery ticket costs $2. It pays $1000 with probability 1/2000, and $0 otherwise. Is the expected net profit positive or negative, and by how much?

Difficulty 6/10

An insurer charges a $300 annual premium. There is a 1% chance of a $20,000 claim in a year (otherwise no claim). What is the insurer's expected profit per policy?

Difficulty 5/10

A contractor's expected material cost is $40k and expected labor cost is $25k. Using linearity of expectation, what is the expected total cost — and does it require the costs to be independent?

Common Mistakes

Common Mistake

Assuming E[X] must be a value X can actually take.

The expected value is a weighted average, not a possible outcome. E[X]=3.5 for a fair die even though a die never shows 3.5 — it's the long-run average, not a single realization.

Common Mistake

Assuming E[XY] = E[X]E[Y] always holds.

This only holds when X and Y are independent. If they're dependent, E[XY] generally differs from E[X]E[Y] by their covariance: E[XY] = E[X]E[Y] + Cov(X,Y).

Quiz

The expected value of a discrete random variable is:
Linearity of expectation, E[X+Y] = E[X]+E[Y], requires:
A game has negative expected value for the player. Over many plays, the player will most likely:

Summary

  • The expected value E[X] is the probability-weighted average of a random variable's possible values.
  • For discrete X: E[X] = Σ xᵢpᵢ. For continuous X: E[X] = ∫ x f(x) dx.
  • Linearity of expectation, E[aX+bY] = aE[X]+bE[Y], holds unconditionally, even when X and Y are dependent.
  • Variance, Var(X) = E[(X−μ)²] = E[X²] − (E[X])², measures spread around the expected value.
  • Expectation underlies fair-game analysis, expected utility theory, and loss functions in machine learning.

References