Expected Value Calculator Formula

Understand the math behind the expected value calculator. Each variable explained with a worked example.

Formulas Used

Expected Value E(X)

expected_value = ev

Variance

variance_val = ev2 - pow(ev, 2)

Standard Deviation

std_dev = sqrt(abs(ev2 - pow(ev, 2)))

Sum of Probabilities

prob_sum = p1 + p2 + p3

Variables

VariableDescriptionDefault
x1Outcome 110
p1Probability 10.2
x2Outcome 220
p2Probability 20.5
x3Outcome 350
p3Probability 30.3
evDerived value= x1 * p1 + x2 * p2 + x3 * p3calculated
ev2Derived value= pow(x1, 2) * p1 + pow(x2, 2) * p2 + pow(x3, 2) * p3calculated

How It Works

How to Calculate Expected Value

Formula

E(X) = Sum of (xi * pi)

The expected value is the long-run average outcome of a random variable. Multiply each possible outcome by its probability and sum the products. It represents the "center of gravity" of the probability distribution. The variance is E(X^2) - [E(X)]^2.

Worked Example

A game pays $10 with probability 0.2, $20 with probability 0.5, and $50 with probability 0.3.

x1 = 10p1 = 0.2x2 = 20p2 = 0.5x3 = 50p3 = 0.3
  1. 01E(X) = 10*0.2 + 20*0.5 + 50*0.3
  2. 02= 2 + 10 + 15 = 27
  3. 03E(X^2) = 100*0.2 + 400*0.5 + 2500*0.3 = 20 + 200 + 750 = 970
  4. 04Var(X) = 970 - 27^2 = 970 - 729 = 241
  5. 05SD = sqrt(241) ≈ 15.5242

Frequently Asked Questions

Does the expected value have to be a possible outcome?

No. The expected value is a weighted average and often falls between outcomes. For example, the expected value of a fair die roll is 3.5, which is not a possible outcome.

What if probabilities do not sum to 1?

For a valid probability distribution, probabilities must sum to exactly 1. If they do not, either the distribution is incomplete or there is an error in the inputs.

How is expected value used in decision making?

Expected value helps compare options by their long-run average payoff. In finance, it estimates average returns. In gambling, a positive expected value means a profitable bet on average.

Ready to run the numbers?

Open Expected Value Calculator