gizmobench

Expected Value Calculator

Put one outcome on each line with its probability and this returns the expected value, the variance, the standard deviation and the sum of the probabilities it actually used. The arithmetic runs on exact fractions rather than decimals, which is the part most pages get wrong: six probabilities of 1/6 add to exactly 1 here, the mean of a fair die prints as 3.5, and the variance stays 35/12 instead of a long decimal. Probabilities that do not add up to 1 are never quietly rescaled. They are refused, with the total they make, and a separate weights mode divides counts or odds by their total and shows both that total and every probability it derived. Under the box, a table lists each outcome, its probability and the probability times value term that went into the mean, so the working is there to read line by line.

Expected value
3.5
6 outcomes · variance 35/12 · SD 1.707825
E[X]
3.5
Variance
35/12
SD
1.707825
Probabilities
Sum to 1
Second column

Each line carries a probability, and they have to add up to exactly 1. Anything else is refused with the sum it actually makes, rather than being quietly rescaled behind your back.

The expected value of 6 outcomes is 3.5. The variance is 35/12, about 2.916667, and the standard deviation is about 1.707825. The probabilities sum to 1.

One outcome to a line: the value, then its probability, separated by a comma, a tab or a space. Decimals, fractions like 1/6, percentages like 25%, exponent notation like 1e3, currency symbols and brackets for a negative are all read, up to 100 outcomes and 40 characters a number. The arithmetic runs on exact fractions rather than decimals, so the expected value and the variance are exact, and a rounded decimal is only ever shown beside one of them, marked as about. The standard deviation is the square root of the variance: exact when that root is, and rounded to six decimal places when it is not. Nothing you type leaves this browser.

ValueProbabilityp times value
11/61/6
21/61/3
31/60.5
41/62/3
51/65/6
61/61
Total13.5

E[X squared] is 91/6, so the variance is 91/6 minus 3.5 squared, which is 35/12, about 2.916667. The standard deviation is the square root of that, 1.707825 rounded to six decimal places.

Worked examples

  • Fair six-sided diesix outcomes at 1/6
    E 3.5, variance 35/12
  • Values 10 and 2, weights 3 and 1normalised to 0.75 and 0.25
    E 8, variance 12
  • Probabilities summing to 0.9not a distribution
    These probabilities sum to 0.9, not 1. Switch to weights to divide them by their total, or change the numbers so they add up to exactly 1.
What this number is. An expected value is a long-run average: a single trial returns one of the outcomes listed, never the average itself. A fair die never lands on 3.5, and outcomes of 100 or -50 on a fair coin have an expected value of 25 with a standard deviation of 75: the spread is the part an average hides. Nothing on this page is a recommendation about a bet, a wager or any other decision.
Accuracy. Exact arithmetic on the finite list of outcomes you enter, with the variance taken as E[X²] minus E[X]² and kept as a fraction wherever it is one. Probabilities must sum to 1, or you must explicitly choose to normalise weights, and the page prints the sum it actually used. It is arithmetic on a distribution you supplied and recommends no wager, bet or decision.

Common questions

How do you calculate expected value?
Multiply each outcome by its probability and add the results. For a fair six-sided die that is 1 and 2 and 3 and 4 and 5 and 6, each at 1/6, which comes to 3.5. The table under the calculator prints every probability times value term on its own row and totals them, so the sum is there to check rather than to take on trust.
Why does this refuse probabilities that do not add up to 1?
Probabilities must add up to 1 to describe a distribution, and a list that comes to 0.9 is not one. Rescaling it without saying so would answer a different question from the one you asked, so the page refuses and prints the total it found. The sums are exact fractions, so six sixths is exactly 1 and 0.1, 0.2, 0.3 and 0.4 is exactly 1, with none of the drift a decimal calculator picks up along the way. If those figures are counts or odds rather than probabilities, switch the control to weights and they are divided by their total instead.
What if I have weights or counts instead of probabilities?
Choose Weights and enter any figures at or above zero. They are divided by their total to make probabilities, and the readout says what that total was. Values 10 and 2 with weights 3 and 1 become probabilities 0.75 and 0.25, an expected value of 8 and a variance of 12. Weights that are all zero have no total to divide by, and that is refused rather than read as equal chances.
How is the variance calculated here?
As E[X squared] minus E[X] squared, on exact fractions. For the fair die E[X squared] is 91/6 and the mean is 3.5, so the variance is 35/12, about 2.916667. It is the variance of the distribution you entered, so no n-1 correction is applied: that correction belongs to a sample drawn from a population, and a list of outcomes with probabilities already is the population.
Does the expected value tell me what happens on a single trial?
No. It is a long-run average of the outcomes weighted by their probabilities, and a single trial returns one of the outcomes on your list, never the average itself: a fair die never lands on 3.5. Outcomes of 100 or -50 on a fair coin have an expected value of 25 and a standard deviation of 75, three times the average, which is the spread the average hides. The page describes the distribution you typed and makes no recommendation about a wager, a bet or any other decision.
Why is the answer sometimes a fraction and sometimes a decimal?
Both are exact, and the shorter form wins. A fraction whose decimal ends inside twelve places prints as that decimal, so 7/2 prints as 3.5 and 3/4 prints as 0.75. One that repeats prints as the fraction, so the die's variance stays 35/12 and the rounded companion, 2.916667, is shown beside it rather than in place of it. The standard deviation is the exception: the square root of a fraction is usually irrational, so it is given exactly when the variance is a perfect square, like the 75 above, and rounded to six decimal places otherwise, like the die's 1.707825.
How many outcomes can I enter, and in what formats?
Up to 100 outcomes, one to a line, with the value and its probability separated by a comma, a tab or a space, so two columns pasted from a spreadsheet work as they are. Decimals, fractions like 1/6, percentages like 25%, exponent notation like 1e3, a leading currency symbol and brackets around a negative are all read. One number may run to 40 characters and one paste to 20,000. Anything unreadable is named with its line number instead of being dropped.
Does anything I type leave my browser?
No. The whole calculation runs on this page, and the only copy kept anywhere is the draft this browser remembers, so your list is still there when you come back. Start over, above the tool, forgets it.

Exact arithmetic on the finite list of outcomes you enter, with the variance taken as E[X²] minus E[X]² and kept as a fraction wherever it is one. Probabilities must sum to 1, or you must explicitly choose to normalise weights, and the page prints the sum it actually used. It is arithmetic on a distribution you supplied and recommends no wager, bet or decision.