# What is the expected value?

Computes the expected value (mean), variance, and standard deviation of a discrete random variable from its outcomes and their probabilities.

- Page: https://www.acalculator.org/statistics/expected-value-calculator
- JSON spec: https://www.acalculator.org/statistics/expected-value-calculator.json
- Version: 565d224a87c9

## Default answer

Example with the default inputs (Outcomes and probabilities [Value (x) 10, Probability P(x) 1/5; Value (x) 0, Probability P(x) 1/2; Value (x) -5, Probability P(x) 3/10]): The expected value is 0.5, with a standard deviation of 5.220153.

## Inputs

| Key | Label | Description |
| --- | --- | --- |
| outcomes | Outcomes and probabilities | One row per outcome: its value and its probability. The probabilities must add up to 1. |

## Outputs

| Key | Label | Description |
| --- | --- | --- |
| ev | Expected value E(X) | The probability-weighted average of the values: Σ x × P(x). |
| variance | Variance σ² | The probability-weighted average of the squared distances from the expected value: Σ (x − μ)² × P(x). |
| sd | Standard deviation σ | The square root of the variance. |
| count | Outcomes | How many outcomes (rows) there are. |

## Method

E(X) = μ = Σ x × P(x); σ² = Σ (x − μ)² × P(x); σ = √σ².

## Assumptions

- Each probability is from 0 to 1, and together they add up to exactly 1.
- The sums are exact on the decimals and fractions you type, then rounded once for display.

## Worked examples

1. outcomes = {"x":10,"p":"0.2"} or {"x":0,"p":"0.5"} gives ev = 0.5, variance = 27.25, sd = 5.220153. Source: OpenStax, Introductory Statistics 2e, §4.2 Mean or Expected Value and Standard Deviation. https://openstax.org/books/introductory-statistics-2e/pages/4-2-mean-or-expected-value-and-standard-deviation.
2. outcomes = {"x":0,"p":"0.2"} or {"x":1,"p":"0.5"} gives ev = 1.1, variance = 0.49, sd = 0.7. Source: OpenStax, Introductory Statistics 2e, §4.2 Mean or Expected Value and Standard Deviation. https://openstax.org/books/introductory-statistics-2e/pages/4-2-mean-or-expected-value-and-standard-deviation, Example 4.3 (μ = 1.1, σ = 0.7).
3. outcomes = {"x":-2,"p":"0.99999"} or {"x":100000,"p":"0.00001"} gives ev = -0.99998. Source: OpenStax, Introductory Statistics 2e, §4.2 Mean or Expected Value and Standard Deviation. https://openstax.org/books/introductory-statistics-2e/pages/4-2-mean-or-expected-value-and-standard-deviation, Example 4.5 (−1.99998 + 1 = −0.99998).
4. outcomes = {"x":1,"p":"1/6"} or {"x":2,"p":"1/6"} gives ev = 3.5, variance = 2.916667, sd = 1.707825. Source: OpenStax, Introductory Statistics 2e, §4.2 Mean or Expected Value and Standard Deviation. https://openstax.org/books/introductory-statistics-2e/pages/4-2-mean-or-expected-value-and-standard-deviation.

## FAQ

### What is expected value?

The expected value is the average result you would get per trial if you repeated a random experiment many times. It weights each possible value by its probability, so a rare big win counts less than a common small loss.

### How do I calculate expected value?

Multiply each value by its probability and add the products: E(X) = Σ x × P(x). A game that pays $10 with probability 0.2, $0 with probability 0.5, and −$5 with probability 0.3 has E(X) = 2 + 0 − 1.5 = $0.50.

### Do the probabilities have to add up to 1?

Yes. The rows must list every possible outcome once, so their probabilities add up to exactly 1. If they do not, the calculator shows the total so you can find the mistake. Use fractions such as 1/6 or 1/3 when a decimal would not add up exactly.

### Can the expected value be a value that never happens?

Yes. One roll of a die has an expected value of 3.5, which no roll can show. It is an average over many rolls, not a prediction of one.

### What does a negative expected value mean?

A negative expected value means you lose on average. A $2 ticket with a 0.00001 chance of winning $100,000 has an expected value of about −$1 per play, so a player loses about a dollar a game in the long run.

### What do the variance and standard deviation tell me?

They measure how far results typically land from the expected value. Two bets can have the same expected value, but the one with the larger standard deviation has bigger swings from game to game.

## Sources

- OpenStax, Introductory Statistics 2e, §4.2 Mean or Expected Value and Standard Deviation. https://openstax.org/books/introductory-statistics-2e/pages/4-2-mean-or-expected-value-and-standard-deviation
- Grinstead and Snell, Introduction to Probability, 1997, Chapter 6 Expected Value and Variance. https://math.dartmouth.edu/~prob/prob/prob.pdf
