Uni-Sine
MathematicsStatistics

Expected value calculator

An expected value calculator finds the long-run average of a random variable: what you would get on average if you repeated the situation many times. E(X) = Σ x P(x), each outcome times its probability, added up. Type each outcome and its probability into our calculator and it gives E(X), the variance and the standard deviation, after checking the probabilities add up to 1.

Probabilities can be typed as decimals or fractions, such as 1/6, and the calculator shows a working table of x P(x) and x² P(x). It opens on a four-outcome example with E(X) = 1.7.

Try it

Expected Value Calculator

Find the expected value and variance of a random variable

Go to its page

How to use the expected value calculator

  1. In the table, type each outcome in the x column and its probability in P(X = x). Use one row per outcome; Enter adds a new row.
  2. Probabilities can be decimals, such as 0.25, or fractions, such as 1/4. You can also paste two columns from a spreadsheet.
  3. If the probabilities do not add up to 1, the calculator says what they add up to, so you can find the mistake.
  4. Read E(X), E(X²), Var(X) and the standard deviation, with the working table and steps underneath.

The chart plots the distribution with the mean and spread marked. Up to 50 outcomes fit in the table. For practice, Practice and help sets random E(X) and Var(X) questions with worked solutions.

The expected value formula

E(X) = \sum xP(x)Multiply each outcome by its probability, then add

The variance measures how spread out the outcomes are around E(X), and the standard deviation is its square root:

\text{Var}(X) = E(X^2) - [E(X)]^2
E(X^2) = \sum x^2P(x)

The expected value does not have to be a possible outcome. The expected number of heads in one coin toss is 0.5, even though you can only get 0 or 1.

Worked examples you can check in the calculator

Example 1: goals in a match

A team's goals per match follow this distribution:

Goals, x0123
P(X = x)0.150.350.30.2
x P(x)00.350.60.6
x² P(x)00.351.21.8

Adding the rows: E(X) = 1.55 goals and E(X²) = 3.35. So Var(X) = 3.35 − 1.55² = 0.9475 and the standard deviation is √0.9475 = 0.973. Type the four rows into the calculator to see the same table.

Example 2: is a game worth playing?

A game costs $2 to play. You roll a dice and win $10 if it shows a six. Take X as your profit: +$8 with probability 1/6, and −$2 with probability 5/6.

E(X) = 8 \times \frac{1}{6} + (-2) \times \frac{5}{6} = \frac{8 - 10}{6} = -0.33

On average you lose about 33 cents a game, so it is not a fair game. Type 8 with 1/6 and −2 with 5/6: the calculator gives E(X) = −0.333 and a standard deviation of 3.73. A game is fair when its expected profit is 0.

Example 3: a raffle

500 raffle tickets are sold at $5 each. There is one prize of $1,000 and two of $250. For one ticket, the profit is $995 with probability 1/500, $245 with probability 2/500, and −$5 otherwise:

E(X) = 995(0.002) + 245(0.004) + (-5)(0.994) = -2

Each ticket loses $2 on average, which is the raffle's profit per ticket. The same method works for insurance and for betting: an expected value calculator for betting is just this table with the stake as a loss and each payout as a gain.

Now try one in the course, then press Mark to check it:

Calculate the expected value of a distribution and judge if a game is fair.

Press Mark to have your answer marked in the Probability course.

Finding a missing probability

Questions often give a table with one unknown, k. Because the probabilities must add up to 1, set their sum to 1 and solve. For P(X = x) = 0.2, 0.35, k and 0.15, k = 1 − 0.7 = 0.3. Then type the full table into the calculator. If you type the wrong k, it tells you what the probabilities add up to instead.

Expected value of a binomial or other named distribution

Some distributions have a shortcut. A binomial distribution B(n, p) has E(X) = np, and a Poisson distribution with rate λ has E(X) = λ. For example, the expected number of sixes in 30 rolls is 30 × 1/6 = 5. The Probability Calculator shows these for each distribution, and our probability calculator guide covers them. For the variance of a list of data rather than a distribution, see the variance calculator guide.

Common mistakes

  • Probabilities that do not sum to 1. Check the total first. The calculator will not give an answer until it is 1.
  • Forgetting to subtract the cost. For a game, use profit, not the prize. A $10 win on a $2 game is a profit of $8.
  • Using Var(X) = E(X²) − E(X). The mean must be squared: E(X²) − [E(X)]².
  • Squaring the probabilities. In E(X²), square the outcomes, not the probabilities.
  • Expecting E(X) to be an outcome. It is an average, so it is often a value X can never take.

Practise in a short timed paper

Expected value and random variables come up in AP Statistics practice, and in A-level Maths: Statistics in the UK. Each daily paper is a short timed paper of 8 questions worth 25 to 35 marks, and the papers mix topics. The Probability course teaches expected value with a dice game before its practice question.

Common questions

How do you calculate expected value?
Multiply each possible outcome by its probability and add the results: E(X) = Σ x P(x). The probabilities must add up to 1.
What does expected value mean?
The average result you would get if you repeated the situation a very large number of times. It is a long-run average, not a prediction for one go.
Can expected value be negative?
Yes. A negative expected profit means you lose money on average, as with most lottery tickets and casino games.
How do you find the variance of a random variable?
Work out E(X²) = Σ x² P(x), then subtract the square of E(X): Var(X) = E(X²) − [E(X)]².
What is a fair game?
A game whose expected profit is 0, so neither the player nor the house gains in the long run.
Can I type fractions?
Yes. Type probabilities such as 1/6 or 5/36 directly into the table.

Revision cards

Say the answer first, then flip the card to check it.

Where to go next

  • Solve it

    Expected Value Calculator

    Find the expected value and variance of a random variable

    Open the tool
  • Learn it

    Probability

    Distributions, expected values and the maths behind uncertainty

    Start the course
  • Test it

    AP Statistics

    A new exam-style paper every day, with instant marking and a mark scheme

    Start today's paper
Read next
Maths · StatisticsP-value calculator: z, t and chi-square testsFree p-value calculator: run a z, t, chi-square or F test from your data or summary values and get the p-value, the critical value and a plain conclusion.