How to calculate expected value

The expected value E[X]E[X] is the probability-weighted average of all possible values of a discrete random variable XX. It applies when you have a finite or countably infinite set of mutually exclusive outcomes, each with a known probability.

The setup

Identify the random variable XX, its possible values xix_i, and the corresponding probabilities P(X=xi)P(X = x_i). Ensure that all probabilities are non-negative and that the sum of all probabilities equals exactly 1 (P(X=xi)=1\sum P(X = x_i) = 1).

The steps

  1. List all mutually exclusive outcomes x1,x2,,xnx_1, x_2, \dots, x_n. 2. Determine the probability pi=P(X=xi)p_i = P(X = x_i) for each outcome. 3. Multiply each outcome by its probability to compute xipix_i p_i. 4. Sum these products to find the expected value: E[X]=i=1nxipiE[X] = \sum_{i=1}^{n} x_i p_i.

Checking the result

Verify that the calculated expected value falls strictly within the inclusive range of the minimum and maximum possible outcomes: min(xi)E[X]max(xi)\min(x_i) \le E[X] \le \max(x_i). If E[X]E[X] is outside this range, check your multiplication or probability sum.

Common errors

A frequent error is forgetting to verify that the probabilities sum to 1 before calculating. Another common mistake is treating the expected value as a guaranteed outcome for a single trial; it represents the long-term arithmetic mean as the number of trials approaches infinity.

Worked example

Calculate the expected value of rolling a standard, fair six-sided die.

Let XX be the outcome of the roll. The possible values are xi{1,2,3,4,5,6}x_i \in \{1, 2, 3, 4, 5, 6\}. The probability for each outcome is P(X=xi)=1/6P(X=x_i) = 1/6. The expected value formula is E[X]=i=16xiP(X=xi)E[X] = \sum_{i=1}^6 x_i P(X=x_i). Substituting the values yields E[X]=1(1/6)+2(1/6)+3(1/6)+4(1/6)+5(1/6)+6(1/6)E[X] = 1(1/6) + 2(1/6) + 3(1/6) + 4(1/6) + 5(1/6) + 6(1/6). Factoring out the probability gives E[X]=(1+2+3+4+5+6)/6E[X] = (1 + 2 + 3 + 4 + 5 + 6) / 6. Summing the numerator results in E[X]=21/6=3.5E[X] = 21 / 6 = 3.5.

FAQ

Run your own problem

References: OpenStax Introductory Statistics, Chapter 4 · Introduction to Probability by Bertsekas and Tsitsiklis

See also