Prefer to click through the interactive model?

Expected value — study guide

The same fragments the interactive model serves, read in order. One source, two views.

The one number a random process averages out to

A random variable takes a different value nearly every time you check it, and if you stopped there you would have nothing to write down but a shrug. Expected value is the fix: it is the single number a random variable settles toward when you average many independent trials of it, with every possible outcome pulled toward the average in proportion to how often it actually shows up.

That "in proportion" clause is the whole idea, and it is one most people already trust from ordinary averaging: like a course grade weighted by credit hours: a class that counts for more moves the final average more than one that counts for less. An outcome that happens constantly should move the average more than one that almost never happens, and expected value is just that intuition turned into arithmetic on random outcomes instead of grades or scores.

Expected value does not predict what the next trial will do. It predicts what a long run of trials, averaged together, settles near — a distinction the rest of this concept leans on hard. How far any one trial is likely to stray from that settled number is a separate question this page leaves alone.

Multiply by probability, then add

value times probability, then added 2 x 1/2 = 1 + 5 x 3/10 = 1.5 + 10 x 1/5 = 2 = 4.5 = E(X) outcome 2 outcome 5 outcome 10 total
Three outcome contributions, 2 times one half is 1, 5 times three tenths is 1.5, and 10 times one fifth is 2, stack into a single total of 4.5, the expected value, with each term scaled by its outcome's probability before the terms are added.

Expected value has one formula, and it is short enough to say in a breath: multiply each outcome by its own probability, then add the results. For a random variable X that can land on outcomes x1 through xn, E(X) = x1·P(x1) + x2·P(x2) + ... + xn·P(xn). Every term is one outcome's size times how often that outcome actually happens.

The multiplying is what makes it weighted instead of a plain average. An outcome with a small probability contributes only a small slice of its value to the total, while a likely outcome contributes nearly all of its value — the same "more likely counts for more" idea, just written as value times probability instead of left as a feeling. The figure on this page carries out exactly that scaling for three outcomes, then stacks the scaled contributions into their sum.

That sum only means what it claims to mean because the probabilities feeding it are honest weights: every outcome's probability sits between 0 and 1, and the full set of them adds to exactly 1. Skip that requirement and the "average" the formula produces stops corresponding to anything real; keep it, and the formula's output is also called the mean of X, written μ in most textbooks and E(X) in most code.

Working it out by hand

A fair six-sided die is the cleanest object to run the formula on, because every one of its six faces is equally likely: each face carries probability 1/6. Lay the six terms out and the formula does the rest: E(X) = 1·(1/6) + 2·(1/6) + 3·(1/6) + 4·(1/6) + 5·(1/6) + 6·(1/6).

Add the six numerators first, since the denominator is shared: 1 + 2 + 3 + 4 + 5 + 6 = 21, so the whole sum collapses to 21/6. Divide that out and you get 3.5 — the expected value of a single roll of a fair die.

Every step there was ordinary arithmetic: six equal fractions, one shared denominator, one division at the end. Nothing about a fair die is special to the formula except that equal probabilities make the sum easy to add by hand; an unfair die, with six different probabilities, runs through the identical formula and just takes longer to add.

The point where the outcomes balance

the beam balances only at the true weighted mean value 2, p=1/2 value 5, p=3/10 value 10, p=1/5 fulcrum at 4.5 = E(X) 0 2 5 10
A balance beam levels only when its fulcrum sits at 4.5, the point where masses at 2 (weight one half), 5 (weight three tenths), and 10 (weight one fifth) exactly balance, the expected value of the weighted distribution.

Every expected-value calculation is a weighted sum, and that weighted sum can also be pictured on a number line instead of written as arithmetic: put a mass at each outcome's value, sized by how probable that outcome is, and ask where the whole arrangement balances. The figure on this page does exactly that for a variable with three outcomes — 2, 5, and 10 — weighted 1/2, 3/10, and 1/5.

Work the formula on those three outcomes and you get E(X) = 2·(1/2) + 5·(3/10) + 10·(1/5) = 1 + 1.5 + 2 = 4.5. Slide a fulcrum under the number line at 4.5 and the beam sits level: the heavier mass at 2 and the lighter masses further out balance exactly there, not one hair to either side.

That is not a coincidence or a loose metaphor — the center-of-mass formula from physics has the identical shape as the expected-value formula, position times weight, summed. Expected value is a weighted average in the fullest sense of the phrase: the same operation whether the weights are probabilities on outcomes or masses on a beam.

Why 'expected' means long-run, not next

running average of die rolls, trial by trial trials, left to right expected value 3.5 roll 1 settles at 3.5
A running average of die rolls swings wide across the first few trials, then narrows step by step and settles onto the horizontal expected-value line at 3.5 as the trial count grows.

Roll a single die once and you get a whole number between 1 and 6 — never 3.5, because 3.5 is not one of the six things a die can do. The word "expected" in expected value does not mean "the outcome you should expect right now"; it means the number a running average settles toward the more times you repeat the trial.

That settling behavior has a name — the law of large numbers — and it is not a hopeful guess, it is a theorem: as the number of independent trials grows, the running average settles toward the true expected value — with probability one, the gap eventually shrinks below any margin you name. The everyday version of the same idea is one most people already trust: like a sports team's season scoring average settling into a stable number even though any single game bounces all over the place.

The figure on this page plots that settling directly for the die: after just a few rolls the running average swings wide, high one stretch and low the next, but as more rolls pile on, the swings narrow and the line pulls in tight around 3.5. No single roll ever proves the die is fair or unfair; the running average, given enough rolls, gives ever-stronger evidence.

A number the variable can never actually land on

Expected value is a computed average, and a computed average has no obligation to be one of the numbers being averaged. That gap between "the number the formula produces" and "the numbers a single trial can actually produce" is worth seeing somewhere the stakes are real money, because that is where it tends to confuse people.

Picture a carnival game that costs nothing to try: one time in five you win $3, and the other four times in five you win nothing. Run the formula on the two outcomes: E(X) = 3·(1/5) + 0·(4/5) = 3/5, which is $0.60. No single play of that game ever pays out sixty cents — you walk away with either $3 or $0, full stop.

$0.60 is still the right number to reason with, because it is what the game pays out on average over many plays, and averages over many plays are exactly what expected value is built to describe. Anyone who plays this particular game a thousand times should expect a total payout close to $600, even though not one of those thousand plays produced sixty cents on its own.

Where this number does the deciding

Any time a choice has to be made between options whose payoffs are uncertain, expected value is the number that turns "which is better" into arithmetic instead of a guess. Compare two options by their expected values and, run enough times, the higher one wins out — which is why the formula shows up everywhere a decision gets made under uncertainty rather than under certainty.

That reach is wide. The same weighted-sum idea is what decision theory and reinforcement learning mean by "expected reward" or "expected cost" — no new mathematics, just this formula applied to whatever numbers the situation hands it: a payout, a time saved, a risk taken on. A system built to choose actions that lead somewhere good, human or automated, is very often built to compare expected values and pick the largest one.

That is also as far as this page goes. How much a variable's outcomes actually spread out around its expected value, and what that spread implies for how much to trust any one estimate, is a different question with its own machinery — one worth carrying the weighted-sum formula into, not one this page answers.