Expected Value, Variance and Standard Deviation of a Discrete Distribution
After reading this you can compute the expected value, variance and standard deviation of any discrete random variable by hand, and read what those three numbers tell you about the outcomes.
What expected value means
The expected value of a random variable is the long-run average of its outcomes, weighted by how likely each outcome is. Suppose a bet pays +100 with probability 0.1, +50 with probability 0.2, 0 with probability 0.5, and -20 with probability 0.2. You will not win exactly the same amount twice, but if you played thousands of times the average payout would settle near a single number. That number is the expected value.
Here it works out to 16. No single play returns 16 (the outcomes are 100, 50, 0 and -20), yet 16 is the center that the running average converges to. Expected value is a property of the distribution, not of any one trial.
When to use it and when not
Use expected value when outcomes are numeric and you can list every possibility with a probability. Dice, lottery tickets, insurance payouts, and simple investment models all fit. The outcomes must be countable and each must carry a probability, and the probabilities must sum to 1.
Do not use it for a single high-stakes decision where you cannot repeat the gamble. A bet with expected value +5 but a 1% chance of losing your rent is a bad idea even though the average is positive. Expected value ignores your tolerance for a rare disaster. It also says nothing about the spread of outcomes on its own, which is why you also compute variance and standard deviation.
Expected value is linear. If Y = aX + b, then E[Y] = a\,E[X] + b. Doubling every payout and adding 10 doubles the expected value and adds 10. This holds even when outcomes are dependent, which makes it one of the most reliable rules in probability.
The formulas and the intuition behind them
For a discrete random variable with outcomes x_i and probabilities p_i, the expected value is the probability-weighted sum:
Each outcome x_i is multiplied by its weight p_i, and you add the products. An outcome with probability 0.5 pulls the average toward itself twice as hard as one with probability 0.25.
Variance measures how far outcomes typically fall from the mean, in squared units. Write \mu = E[X]. Then:
Each squared deviation (x_i - \mu)^2 is weighted by its probability. Squaring means large deviations count far more than small ones: a point 20 away from the mean contributes 400, while a point 5 away contributes only 25.
A faster equivalent formula computes the mean of the squares and subtracts the square of the mean:
Standard deviation is the square root of the variance, which returns you to the original units:
Worked example with the demo data
Use the outcomes 100, 50, 0, -20 with probabilities 0.1, 0.2, 0.5, 0.2. These are the values behind the Demo button.
- Check the probabilities sum to 1:
0.1 + 0.2 + 0.5 + 0.2 = 1.0. Good. - Expected value:
100(0.1) + 50(0.2) + 0(0.5) + (-20)(0.2) = 10 + 10 + 0 - 4 = 16. So \mu = 16. - Squared deviations from 16:
(100-16)^2 = 7056,(50-16)^2 = 1156,(0-16)^2 = 256,(-20-16)^2 = 1296. - Weight and sum:
7056(0.1) + 1156(0.2) + 256(0.5) + 1296(0.2) = 705.6 + 231.2 + 128 + 259.2 = 1324. So the variance is1324. - Standard deviation: \sigma = \sqrt{1324} \approx 36.39.
Check with the second formula. E[X^2] = 100^2(0.1) + 50^2(0.2) + 0 + (-20)^2(0.2) = 1000 + 500 + 0 + 80 = 1580. Then 1580 - 16^2 = 1580 - 256 = 1324. The two methods agree.
Reading and interpreting the three numbers
The expected value of 16 tells you the center. Over many repetitions, average around 16 per play. The standard deviation of about 36.39 tells you the typical spread around that center. Because 36.39 is more than twice the mean, individual results scatter widely: winning 100 and losing 20 both happen regularly.
A useful sanity check is that the mean must lie between the smallest and largest outcomes, here between -20 and 100. The value 16 passes. Variance is always zero or positive; it is zero only when every outcome equals the mean, meaning no randomness at all.
Standard deviation shares the units of the outcomes, so it is easier to interpret than variance. If outcomes are dollars, \sigma \approx 36.39 is dollars, while the variance 1324 is dollars squared, which has no everyday meaning.
See how spread changes with the probabilities
The mean can stay fixed while the spread grows or shrinks. Moving probability toward the extreme outcomes widens the standard deviation; moving it toward the center narrows it.
Common mistakes
The errors below are the ones that change answers most often.
- Probabilities that do not sum to 1
- If your weights sum to
0.9or1.1, every result is off. Add them first. The demo probabilities sum to exactly1.0. - Confusing outcomes with counts
- Expected value weights by probability, not by frequency counts. If you have raw counts, divide each by the total to get probabilities before applying the formula.
- Forgetting to square in the variance
- Summing (x_i - \mu)\,p_i without squaring always gives 0, because deviations above and below the mean cancel. The squaring is what makes variance measure spread.
- Reporting variance as if it were spread in original units
- Variance is in squared units. Take the square root to compare it with the outcomes.
- Assuming the mean is a likely outcome
- In the demo the mean is 16, but 16 is not even a possible outcome. The mean is a balance point, not a prediction of any single trial.
Related calculators
Expected value needs probabilities as input, and several other tools produce them. Use the Probability calculator to combine independent or conditional events into the weights you feed here. When outcomes come from counting arrangements, the Combinations and Permutations calculator gives the counts you convert into probabilities. For dice payouts, the Dice Probability calculator gives exact sum probabilities that plug straight into the expected value formula. To update probabilities after new evidence, see the Bayes' Theorem calculator.
Frequently asked questions
Can expected value be negative or a non-integer?
Yes to both. If the demo outcome for 100 dropped to -100, the expected value would fall to -4. Expected values are routinely fractional, such as 3.5 for one fair die, even though a die never shows 3.5.
What is the difference between expected value and the average of my data?
The sample average is computed from observed data. Expected value is computed from the theoretical probabilities. With enough trials the sample average converges to the expected value, which is the law of large numbers.
Why square the deviations instead of taking absolute values?
Squaring gives variance clean algebraic properties, including the identity \mathrm{Var}(X) = E[X^2] - (E[X])^2 and the rule that variances of independent variables add. Absolute deviation is a valid spread measure too, but it lacks these properties.
How do probabilities and outcomes need to line up?
By position. The first probability belongs to the first outcome, the second to the second, and so on. In the demo, 0.1 pairs with 100 and 0.2 pairs with -20. Mixing up the order changes the mean.
Does adding a constant to every outcome change the variance?
No. Adding 10 to every outcome shifts the mean by 10 but leaves the variance and standard deviation unchanged, because every deviation from the mean stays the same size. Multiplying every outcome by 2 doubles the standard deviation and quadruples the variance.