Expected Value Calculator
The expected value is the value a discrete random variable takes on average in the long run, and it is computed as E(X) = Σxᵢ·pᵢ. It is really a weighted mean: every possible outcome carries a weight equal to its probability. The long-run return of a gambling game, the pricing of an insurance premium, investment decisions, and inventory planning all rest on this single number.
The expected value alone can be misleading, though: two distributions with the same E(X) can be almost certain or extremely risky. That is why this calculator also returns the variance, the standard deviation, the coefficient of variation, and the mode and median of the distribution; it shows how much each row contributes in a working table and draws the probability distribution as a bar chart.
Expected Value and Variance Formulas
Expected value: E(X) = Σ xᵢ · pᵢ Second moment: E(X²) = Σ xᵢ² · pᵢ Variance (definition): Var(X) = Σ (xᵢ − E(X))² · pᵢ Variance (shortcut): Var(X) = E(X²) − [E(X)]² Standard deviation: σ = √Var(X) Coefficient of var.: CV = σ / |E(X)| Validity condition: 0 ≤ pᵢ ≤ 1 and Σ pᵢ = 1 Linear transform: E(aX + b) = a·E(X) + b, Var(aX + b) = a²·Var(X)
These formulas are for discrete random variables (those with countably many outcomes). For continuous variables the sum becomes an integral: E(X) = ∫x·f(x)dx. If the probabilities do not sum to 1 the distribution is not valid and the calculator refuses to compute.
How to Calculate
- Enter every value the random variable can take (xᵢ) in the first box; gains are positive and losses are negative.
- Enter the probability of each value in the second box, in the same order; the two lists must line up exactly.
- Use the 'Probability format' field to say whether you entered decimals (0.35) or percentages (35).
- Make sure the probabilities sum to 1 (or to 100 in percentage mode); otherwise the calculator returns an error.
- Read the standard deviation next to E(X): between two options with the same expected value, the one with the smaller σ is less risky.
- Inspect the working table to see how much each row contributes to E(X) and to the variance; this is where you see how extreme values inflate the variance.
Worked Examples
Distribution of daily breakdowns
Given the distribution of the number of daily breakdowns of a machine, E(X) = 0×0.35 + 1×0.30 + 2×0.20 + 3×0.10 + 4×0.05 = 1.20 breakdowns. Since E(X²) = 2.80, Var(X) = 2.80 − 1.44 = 1.36 and the standard deviation is 1.17. The single most likely outcome is 0 breakdowns (35%), yet in the long run an average of 1.2 breakdowns per day is expected.
Expected value E(X): 1.20 · Variance Var(X): 1.36 · Standard deviation σ: 1.17
Lottery ticket — a negative expected value
For a ticket bought for 50 TL that returns a net 950 TL with probability 2%, E(X) = -50×0.98 + 950×0.02 = -49 + 19 = -30 TL. The variance is 19,600 and the standard deviation is 140 TL: even though the expected loss is 30 TL, the outcome of a single ticket lands far away from it. The very large coefficient of variation shows just how risky the game is.
Expected value E(X): -30 · Variance Var(X): 19,600 · Standard deviation σ: 140
Sales scenarios entered as percentages
When the probabilities of four sales scenarios are entered as percentages, the calculator converts them to 0.40 / 0.35 / 0.20 / 0.05. Expected sales are E(X) = 0 + 35 + 50 + 25 = 110 units, E(X²) = 28,500, and Var(X) = 28,500 − 12,100 = 16,400, so the standard deviation is 128.06 units. The median of the distribution is 100 and the most likely outcome is 0 units.
Expected value E(X): 110 · Variance Var(X): 16,400 · Standard deviation σ: 128.06