Expected Value Calculator
Work out the expected value, variance and standard deviation of a discrete random variable โ or the fair price of a game โ from its outcomes and probabilities.
Enter each possible value of X and its probability. Probabilities must add to 1.
| Value x | Probability P(X = x) | |
|---|---|---|
Enter the net amount you win (+) or lose (−) for each outcome and its probability. Probabilities must add to 1.
| Net amount ($) | Probability | |
|---|---|---|
E(X) = 0.7500 โ the long-run average of X. In a single trial you will see 0, 1, 2 or 3 โ never 0.75.
Calculation
- Outcomes: n = 4. Probabilities sum to 1.0000.
- E(X) = 0 × 0.5000 + 1 × 0.3000 + 2 × 0.1500 + 3 × 0.0500 = 0.7500.
- E(X²) = 0 × 0.5000 + 1 × 0.3000 + 4 × 0.1500 + 9 × 0.0500 = 1.3500.
- Var(X) = E(X²) − E(X)² = 1.3500 − 0.7500² = 1.3500 − 0.5625 = 0.7875.
- SD(X) = √0.7875 = 0.8874.
- Most likely outcome: 0 (probability 0.5000). P(X > E(X)) = 0.5000.
Distribution bar chart
Each bar is one outcome; its height is the probability. The dashed red line is E(X) โ the long-run average, not a value that ever comes up.
Contribution of each outcome
Each outcome contributes x × P(X = x) to the expected value and x² × P(X = x) to E(X²). The two totals are E(X) and E(X²).
| Outcome x | P(X = x) | x × P(X = x) | x² × P(X = x) |
|---|---|---|---|
| 0 | 0.5000 | 0.0000 | 0.0000 |
| 1 | 0.3000 | 0.3000 | 0.3000 |
| 2 | 0.1500 | 0.3000 | 0.6000 |
| 3 | 0.0500 | 0.1500 | 0.4500 |
| Total | 1.0000 | 0.7500 | 1.3500 |
Long-run simulation โ 1,000 draws
One thousand draws from this distribution, made with a fixed seed (12,345) so the picture is reproducible. The running average settles near E(X) = 0.7500.
The simulation runs when the page loads.
The expected value is the long-run average of a random variable — what you get if you repeat the same gamble thousands of times and average the results. It is not a prediction for a single trial: in the example below the expected value is 0.75, a number that can never actually come up.
How to use the expected value calculator
- Choose a mode: “Discrete random variable” for a list of values and probabilities, or “Game / fair price” for the amounts you win or lose on each outcome.
- Enter each outcome and its probability — in Discrete mode the values of X, in Game mode the net amount won (+) or lost (−) on each outcome. Use “+ Add outcome” for more rows, or a preset: “Load: fair die”, “Load: lottery” and “Load: coin flip”.
- Click Calculate and read the headline expected value, then check the tiles for E(X²), the variance, the standard deviation and, in Game mode, the fair price.
- Read the calculation ledger for every step, the bar chart, the contribution table and the 1,000-draw simulation to see the long run in action.
Try it now: X = 0, 1, 2, 3 with probabilities 0.5, 0.3, 0.15, 0.05 → E(X) = 0.75, E(X²) = 1.35, Var(X) = 0.7875, SD(X) = 0.8874.
What is expected value?
For a discrete random variable X that takes values x with probabilities P(X = x), the expected value is
E(X) = Σ x · P(X = x) — each value weighted by how often it comes up. It is the centre of gravity of the distribution: values with high probability pull it towards them, rare values barely move it. A fair die has E(X) = (1 + 2 + 3 + 4 + 5 + 6) / 6 = 3.5, and a binomial count of n trials with success probability p has E(X) = n · p. The Poisson distribution is the one where the expected value and the variance are the same number.
The expected value is a property of the distribution, not of one trial. Roll a die once and you get a whole number; roll it a thousand times and the average of your rolls lands near 3.5. That gap — between what happens once and what happens on average — is the whole point of the idea, and it is why the calculator also shows the variance: the average alone does not tell you how wild the ride is.
How E(X²), the variance and the standard deviation are calculated
The expected value is only the first moment. The second moment, E(X²), is the same idea applied to the squares:
E(X²) = Σ x² · P(X = x), and the variance follows from it: Var(X) = E(X²) − E(X)². The standard deviation is the square root, SD(X) = √Var(X), which puts the spread back into the original units. Variance measures the gamble’s risk: two games can have the same expected value and wildly different variances, and the one with the bigger variance is the one that can ruin you — or make you — in a single sitting.
A useful check: if every outcome is the same number, the variance is zero. If the outcomes are far apart, the variance is large. The variance is never negative, and it is zero only when X is constant.
The fair price of a game
Suppose a game pays out according to X, and you must pay to play. The fair price is the price that makes the expected net gain zero — which is just E(X), when E(X) is the expected net gain per play. Pay the fair price and you break even on average; pay more and the game loses money on average; pay less and it wins money on average. Casinos and lotteries live on the gap between the price they charge and the fair price.
Fair price is the expected value wearing a price tag. For a game, E(X) is the expected net gain per play, so charging E(X) to play makes that gain zero. In the dice game below, E(X) = 0.8333, so the fair price is $0.83. In the lottery below, the expected prize is $0.20, so a fair ticket costs $0.20 — and the $2 ticket on sale loses $1.80 per play on average.
Worked examples
Example 1: a four-outcome random variable
Let X take the values 0, 1, 2, 3 with probabilities 0.5, 0.3, 0.15, 0.05.
E(X) = 0 × 0.5 + 1 × 0.3 + 2 × 0.15 + 3 × 0.05 = 0 + 0.3 + 0.3 + 0.15 = 0.75. E(X²) = 0 × 0.5 + 1 × 0.3 + 4 × 0.15 + 9 × 0.05 = 0 + 0.3 + 0.6 + 0.45 = 1.35. Var(X) = 1.35 − 0.75² = 1.35 − 0.5625 = 0.7875. SD(X) = √0.7875 = 0.8874. The most likely outcome is 0 (probability 0.5), and P(X > E(X)) = P(X = 1) + P(X = 2) + P(X = 3) = 0.3 + 0.15 + 0.05 = 0.5. Notice that E(X) = 0.75 is not a possible value of X and is not the most likely outcome — that is the subject of the first question below.
Example 2: the dice game (Game mode)
Win $10 on a 6, lose $1 otherwise. The net outcomes are +$10 with probability 1/6 and −$1 with probability 5/6. Use “Game / fair price” mode, or “Load: dice game”.
E(X) = 10 × (1/6) − 1 × (5/6) = 10/6 − 5/6 = 5/6 = 0.8333 per roll. E(X²) = 100 × (1/6) + 1 × (5/6) = 105/6 = 17.5. Var(X) = 17.5 − 0.8333² = 17.5 − 0.6944 = 16.8056. SD(X) = √16.8056 = 4.0995. The fair price to play is $0.83.
The standard deviation ($4.10) is nearly five times the average gain ($0.83). That is the shape of most gambling: most single plays lose $1, and the occasional $10 win does the heavy lifting. The expected value says the game is favourable; the variance says it will still feel like losing most of the time.
Example 3: the lottery (Discrete mode)
A $2 ticket wins $100 with probability 0.001 and $10 with probability 0.01. The net outcomes — prize minus the $2 ticket — are +$98 (probability 0.001), +$8 (probability 0.01) and −$2 (probability 0.989). Use “Load: lottery” in Game mode, or enter the three net outcomes in Discrete mode.
E(X) = 98 × 0.001 + 8 × 0.01 − 2 × 0.989 = 0.098 + 0.08 − 1.978 = −1.80 per ticket. E(X²) = 9,604 × 0.001 + 64 × 0.01 + 4 × 0.989 = 9.604 + 0.64 + 3.956 = 14.2. Var(X) = 14.2 − (−1.80)² = 14.2 − 3.24 = 10.96. SD(X) = √10.96 = 3.3106. You lose $1.80 per ticket on average.
The expected prize is 100 × 0.001 + 10 × 0.01 = 0.10 + 0.10 = $0.20, so a fair ticket costs $0.20. The $2 ticket sells for ten times its fair price — that gap is the lottery’s profit, and it is exactly the $1.80 you lose per ticket.
Edge cases
A fair die. Use “Load: fair die”: X = 1, 2, 3, 4, 5, 6, each with probability 1/6. E(X) = 3.5, E(X²) = 91/6 = 15.1667, Var(X) = 15.1667 − 12.25 = 2.9167, SD(X) = 1.7078. The expected value 3.5 is not a face of the die — it is the average over many rolls.
A coin flip. Use “Load: coin flip” in Game mode: win $5 on heads (probability 0.5), lose $3 on tails (probability 0.5). E(X) = 5 × 0.5 − 3 × 0.5 = 1.0, E(X²) = 25 × 0.5 + 9 × 0.5 = 17, Var(X) = 17 − 1 = 16, SD(X) = 4. The fair price to play is $1.00.
Probabilities that do not add to 1. The calculator warns you and does not silently rescale. Try X = 0, 1 with probabilities 0.5 and 0.4, which sum to 0.9: a warning appears, and E(X) is computed from the probabilities exactly as entered, 0 × 0.5 + 1 × 0.4 = 0.4. Fix the probabilities so they sum to 1 for a valid distribution — the simulation will not run until they do.
One outcome. X = 5 with probability 1 gives E(X) = 5, Var(X) = 0 and SD(X) = 0. A sure thing has no spread.
The simulation. The 1,000-draw simulation at the bottom of the calculator uses a fixed seed (12,345), so it gives the same picture every time the page loads. For the first example the running average after 1,000 draws is 0.7970 — close to E(X) = 0.75, but not exactly it. That gap is the point: a simulation is an experiment, and its running average wobbles around the true expected value. The more draws, the smaller the wobble.
The geometric distribution counts the trials until the first success, and its expected value is 1/p — the same long-run-average idea applied to a waiting time. Every distribution in that guide has an expected value, and the calculator above works out any of them from the values and probabilities.
Frequently asked questions
Is the expected value the most likely outcome?
No. The expected value is a long-run average; the most likely outcome is the mode — the value with the highest probability. In the first example, E(X) = 0.75 but the most likely outcome is 0 (probability 0.5), and 0.75 is not even a value X can take. For a fair die, E(X) = 3.5 but no face shows 3.5. The expected value tells you where the average lands over many trials, not what to expect from one.
What is a fair price?
The price that makes the expected net gain zero — equal to E(X) when E(X) is the expected net gain per play. In the dice game, E(X) = 0.8333, so the fair price to play is $0.83: pay that and you break even on average; pay more and the game loses money. For a lottery ticket, the fair price is the expected prize — $0.20 for the ticket in the third example — so a $2 ticket loses $1.80 per play on average.
The formulas on this page are the standard definitions of expected value, variance and standard deviation for a discrete random variable. All worked examples on this page were recomputed by hand and with the calculator above. Last updated 19 November 2026.
See all 91 free statistics tools.
Next steps
More Tools to Explore
Keep going with the calculators that pair with expected value — binomial and Poisson probabilities, Bayes' theorem, z-scores and standard deviation.
Binomial Probability Calculator
Work out exact and range binomial probabilities for a count of successes.
Poisson Distribution Calculator
Exact and range Poisson probabilities for rare events.
Bayes' Theorem Calculator
Work out a posterior probability from a prior, a test result or odds.
Standard Deviation Calculator
Mean, variance and standard deviation from raw data or summary stats.
Z-Score Calculator
Turn any raw score into a z-score and read off its percentile in seconds.
One-Sample T-Test Calculator
Test a sample mean against a value, with a t statistic, p-value and confidence interval.
Explore All Tools →
Browse all 91 free statistics tools — every calculator on this site in one place.