Skip to content

Expected Value Calculator

Mean, variance and standard deviation of a discrete random variable, or the expected value of a bet.

Your details

Calculation
Second column holds
Outcomes

One row per possible value x with its probability P(x) (0.25), percentage (25) or observed frequency (count).

Results update as you type

Expected value E[X]

1.1

Variance Var(X)
0.49
Standard deviation σ
0.7
Sum of probabilities
1

Step-by-step solution
  1. E(X) = Σ x·P(x) = 0 × 0.2 + 1 × 0.5 + 2 × 0.3 = 1.1
  2. Var(X) = Σ (x − μ)²·P(x) = 0.49, σ = √0.49 = 0.7

The expected value of a random variable is the long-run average you would get if you could repeat the experiment again and again. It is a weighted average: every possible value counts in proportion to its probability. It tells an insurer what a policy costs on average, a teacher what score to expect from a guessing student, and a gambler whether a game is worth playing at all.

This calculator works in two ways. In Probability table mode you list each value xx of a discrete random variable with its probability P(x)P(x). You can type probabilities as decimals (0.25), as percentages (25), or as raw frequencies counted in a survey or an experiment, which the calculator turns into relative frequencies for you. It returns the expected value E(X)E(X), the variance, the standard deviation and the sum of the probabilities, with a table of every product and a bar chart of the distribution. If decimal probabilities do not add up to 1 (within 0.001), it stops with a clear message instead of giving a misleading answer.

In Game or bet mode you only need the net amount you win, the chance of winning and the amount you lose otherwise. You get the expected value per play, the expected result and spread over many plays, the return per unit risked and the win probability that would make the game fair. For bets quoted as odds, the odds calculator converts them to probabilities first.

How to use this calculator

  1. Choose Probability table for any discrete distribution, or Game or bet for a win-or-lose wager.
  2. For a table, say whether the second column holds probabilities, percentages or frequencies.
  3. Enter one row per possible outcome: the value xx (a score, a number of items, a profit that may be negative) and its weight.
  4. Read E(X)E(X) first, then the standard deviation, which shows how far a single result typically falls from that average.
  5. For a bet, enter the net gain, the probability of winning in percent, the amount lost and how many times you will play. The expected result over NN plays is NN times the expected value per play.

The formula

For a discrete random variable XX taking values x1,…,xkx_1, \dots, x_k with probabilities P(xi)P(x_i) that add up to 1:

E(X)=μ=∑i=1kxi P(xi)E(X) = \mu = \sum_{i=1}^{k} x_i\,P(x_i)
Var⁡(X)=σ2=∑i=1k(xi−μ)2 P(xi),σ=σ2\operatorname{Var}(X) = \sigma^2 = \sum_{i=1}^{k} (x_i - \mu)^2\,P(x_i), \qquad \sigma = \sqrt{\sigma^2}

With frequencies fif_i instead of probabilities, each probability is the relative frequency P(xi)=fi/∑fjP(x_i) = f_i / \sum f_j.

For a bet that pays a net gain WW with probability pp and loses LL otherwise:

E=pW−(1−p)L,σ=(W+L)p(1−p)E = pW - (1-p)L, \qquad \sigma = (W+L)\sqrt{p(1-p)}

Over NN independent plays the expected total is N EN\,E and its standard deviation is σN\sigma\sqrt{N}. The game is fair when E=0E = 0, that is when p=L/(W+L)p = L/(W+L).

Worked example

A probability table. A youth team plays 0, 1 or 2 matches a week with probabilities 0.2, 0.5 and 0.3. The expected number of matches is

E(X)=0×0.2+1×0.5+2×0.3=1.1E(X) = 0 \times 0.2 + 1 \times 0.5 + 2 \times 0.3 = 1.1

The variance is (0−1.1)2×0.2+(1−1.1)2×0.5+(2−1.1)2×0.3=0.49(0-1.1)^2 \times 0.2 + (1-1.1)^2 \times 0.5 + (2-1.1)^2 \times 0.3 = 0.49, so the standard deviation is 0.7 match. Over many weeks the team averages 1.1 matches, usually within about one match of that figure. These are the default rows of the calculator.

A fair die. Values 1 to 6, each with probability 1/6, give E(X)=3.5E(X) = 3.5 and σ≈1.7078\sigma \approx 1.7078. No face shows 3.5: an expected value need not be a value the variable can take.

A roulette bet. On an American wheel with 38 pockets, a 1-unit bet on a single number wins 35 units with probability 1/38 (about 2.6316%) and loses the unit otherwise:

E=138×35−3738×1=−238≈−0.0526E = \tfrac{1}{38} \times 35 - \tfrac{37}{38} \times 1 = -\tfrac{2}{38} \approx -0.0526

You lose about 5.26% of every unit staked. Over 100 plays the expected result is -5.26, but the standard deviation is 57.63, so in a short session luck dominates the average.

Expected value versus the most likely outcome

The expected value is an average over many repetitions, not a prediction for one trial. In the roulette example the most likely outcome of a single spin is losing one unit, the rare outcome is winning 35, and the expected value lies in between at about −0.05. Decision makers use it because, by the law of large numbers, the average of many independent results gets closer and closer to E(X)E(X). When you face a one-off decision with a large downside, look at the standard deviation and the worst case too: two choices can have the same expected value and very different risk.

Probabilities, percentages or frequencies?

Use probabilities when you know the exact chance of each value (a fair die, a lottery prize table). Use percentages when a source quotes them that way. Use frequencies when the numbers come from observation, for example 20 households with no car, 50 with one and 30 with two: the calculator divides each count by the total, which gives the empirical distribution. The resulting mean is then the mean of the observed data, the same figure the standard deviation calculator gives for the raw list. For a number of successes in repeated trials, the binomial distribution calculator builds the table for you.

Frequently asked questions

Can an expected value be negative?

Yes. Whenever the values themselves can be negative, as with net profits or losses, the weighted average can fall below zero. A negative expected value for a bet means you lose money on average; nearly every casino game and lottery is built that way.

Why must the probabilities add up to 1?

Because the rows must list every possible outcome exactly once, and one of them is certain to happen. A sum below 1 usually means an outcome is missing; a sum above 1 means an outcome is counted twice or a probability is wrong. The calculator accepts a gap of up to 0.001 for rounding.

What does the standard deviation add?

It measures how spread out the outcomes are around the expected value. A small standard deviation means results stay close to the average; a large one means individual results can be far from it, so the average says less about any single trial.

Is the expected value the same as the mean?

For a probability distribution, yes: the expected value is the mean of the distribution, written μ or E(X). The mean of a sample of data estimates it, and with frequencies entered here the two coincide.

How do I compute the expected value of a lottery ticket?

Make one row per prize with its net gain (prize minus ticket price) and its probability, plus a row for losing the ticket price with the remaining probability. Taxes and shared jackpots lower the real payout, so the true expected value is usually even lower.

Sources

Last updated:

More Statistics calculators

People also use