A lottery ticket costs $5. There’s a 1-in-1,000,000 chance of winning $2,000,000, and otherwise you win nothing. Is this a good bet? Intuition alone won’t answer this cleanly — you need a tool that combines every possible outcome with its probability into a single meaningful number. That tool is the expected value, and its companion, variance, tells you how much any single outcome is likely to differ from that average.
What Is a Random Variable?
Before expected value makes sense, it helps to be precise about what’s being averaged. A random variable is a numerical outcome of a random process — the number of heads in 3 coin flips, the payout of a lottery ticket, the number of defective items in a batch. Random variables are usually denoted with capital letters (X, Y) and their possible specific values with lowercase letters (x).
A discrete random variable takes on a countable set of distinct values (0, 1, 2, 3, …), each with its own probability — exactly the setting for expected value and variance in this post. A continuous random variable, like height or time, can take any value within a range and requires a different mathematical treatment (probability density functions) covered separately.
What Is Expected Value?
The expected value of a discrete random variable is the long-run average outcome if the random process were repeated an enormous number of times — a weighted average of every possible outcome, weighted by how likely it is to occur.
E(X) = ∑ xi × P(xi)
Crucially, the expected value is not a prediction of what will happen on any single trial — you can’t roll “3.5” on a die, but 3.5 is exactly the expected value of a fair six-sided die roll. Expected value describes the long-run average across many repetitions, not any individual outcome.
Worked Example: The Lottery Ticket
Back to the opening puzzle. Define X as the net profit from buying the $5 ticket: either +$1,999,995 (winning, net of the $5 cost) with probability 1/1,000,000, or −$5 (losing) with probability 999,999/1,000,000.
| Outcome | x (net profit) | P(x) |
|---|---|---|
| Win | +$1,999,995 | 0.000001 |
| Lose | −$5 | 0.999999 |
E(X) = (1,999,995 × 0.000001) + (−5 × 0.999999)
E(X) = 1.999995 − 4.999995 = −$3.00
On average, across an enormous number of repetitions, this ticket loses $3 per play. This doesn’t mean any individual player is guaranteed to lose $3 — almost everyone loses exactly $5, and one in a million people wins nearly $2 million — but averaged over the whole population of ticket buyers, $3 per ticket is the expected outcome, and it’s exactly why lotteries are reliably profitable for their organisers.
What Is Variance of a Random Variable?
Expected value tells you the centre; variance tells you the spread — how far individual outcomes typically fall from that expected value.
Var(X) = E[(X − μ)²] = ∑ (xi − μ)² × P(xi)
where μ = E(X). A computationally faster equivalent formula, used constantly in practice, is:
Var(X) = E(X²) − [E(X)]²
The standard deviation of a random variable, as with any dataset, is simply the square root of the variance, bringing the measure back into the original units.
Worked Example: A Simple Game
A game costs nothing to play. You roll a fair die: if it shows 1–4, you win nothing; if it shows 5, you win $10; if it shows 6, you win $20. Find the expected value and variance of the winnings.
| x | P(x) | x × P(x) | x² × P(x) |
|---|---|---|---|
| $0 | 4/6 | 0 | 0 |
| $10 | 1/6 | 1.667 | 16.667 |
| $20 | 1/6 | 3.333 | 66.667 |
| Sum | 1 | 5.00 | 83.33 |
E(X) = $5.00 — the game is worth $5 per play on average.
Var(X) = E(X²) − [E(X)]² = 83.33 − 5² = 83.33 − 25 = 58.33
Standard deviation = √58.33 ≈ $7.64
Despite an expected value of $5, the standard deviation of $7.64 signals substantial variability — consistent with the fact that most plays actually pay $0, occasionally jumping to $10 or $20. Expected value alone would make this look like a mild, predictable game; the variance reveals it’s actually quite streaky.
Properties of Expected Value
Two algebraic properties make expected value calculations far easier in practice. For any constants a and b, and random variables X and Y: E(aX + b) = aE(X) + b — scaling or shifting a random variable scales or shifts its expected value in exactly the same way. And E(X + Y) = E(X) + E(Y) — the expected value of a sum is always the sum of the expected values, regardless of whether X and Y are independent. This second property, called linearity of expectation, is one of the most powerful and widely used shortcuts in all of probability, because it holds even when the variables are correlated with each other — a property variance notably does not share.
Real-World Applications
Expected value is the mathematical foundation of the entire insurance industry: insurers calculate the expected payout across their policyholder pool and price premiums above that expectation, which is precisely how insurance remains profitable for the company while still protecting any individual policyholder from a catastrophic loss. In business decision-making, expected value is used to evaluate projects with uncertain outcomes — a venture with a 30% chance of a $10 million profit and a 70% chance of a $2 million loss has an expected value of (0.30 × 10M) + (0.70 × −2M) = $3M − $1.4M = $1.6M, informing whether it’s worth pursuing even though any single outcome is either a big win or a loss. In finance, the expected return of an investment portfolio is a direct application of linearity of expectation across multiple assets, while the variance of that portfolio is the mathematical definition of risk used throughout modern portfolio theory.
Common Mistakes
Treating expected value as a guaranteed outcome. As the lottery example shows, no individual ticket buyer experiences “−$3” — they either lose $5 or win nearly $2 million. Expected value describes the long-run average across repetitions, not any single trial.
Forgetting to weight outcomes by their probabilities. A common error is simply averaging the possible values (ignoring how likely each is) rather than the probability-weighted average that the formula actually requires.
Using the wrong variance formula shortcut. The computational formula Var(X) = E(X²) − [E(X)]² requires calculating E(X²) correctly — squaring each x value before multiplying by its probability, not squaring the already-computed E(X) and calling it E(X²), which is a completely different (and always smaller) quantity.
Practice Question
An insurance company sells a policy for $500. If the policyholder makes a claim (probability 0.05), the company pays out $8,000. Find the insurance company’s expected profit per policy.
Answer: Let X = company’s profit. If no claim (probability 0.95): profit = $500. If claim (probability 0.05): profit = 500 − 8,000 = −$7,500.
E(X) = (500 × 0.95) + (−7,500 × 0.05) = 475 − 375 = $100
The company expects to profit $100 per policy on average, across a large number of policies sold — even though any individual policy either nets a clean $500 profit or a $7,500 loss.
References
1. Ross, S.M. (2020) A First Course in Probability. Pearson.
2. Moore, D.S., McCabe, G.P. and Craig, B.A. (2021) Introduction to the Practice of Statistics. W.H. Freeman.
3. Wackerly, D., Mendenhall, W. and Scheaffer, R.L. (2014) Mathematical Statistics with Applications. Cengage.
4. Markowitz, H. (1952) ‘Portfolio Selection’, Journal of Finance, 7(1), pp. 77–91.
5. Triola, M.F. (2022) Elementary Statistics. Pearson.
