Expected Value Calculator: Variance and Standard Deviation

Enter outcomes and probabilities to get the expected value, variance, and standard deviation of a discrete distribution, with a probability check that shows the running sum and one-click normalize.

Mode
Outcome xProbability p Actions

Probability check Σp = 0

Add outcomes and their probabilities to see the expected value.

Export

E[X] = μ = Σ xᵢ·pᵢ; σ² = Σ (xᵢ - μ)²·pᵢ; σ = √σ² How?

How this is calculated

The expected value is the probability-weighted mean of the outcomes. Because the probabilities define the entire distribution, this is a population: there is no sample, so no n - 1 (Bessel) correction is applied. The variance is computed in deviation form, Σ (xᵢ - μ)²·pᵢ, rather than the algebraic identity E[X²] - μ². The two are equal, but the deviation form avoids the catastrophic cancellation that E[X²] - μ² suffers when the mean is large relative to the spread.

Expected value is a long-run average over many independent trials, not a prediction of the next draw. The standard deviation reports how far a single result can land from that average, in the same units as the outcomes.

Probabilities are validated: each must lie in [0, 1], and their sum is checked against 1 within a tolerance of 1e-9 (so 0.1 + 0.2 + 0.7 counts as exact). A sum other than 1 is never silently accepted. The running sum is shown, and one click normalizes each probability by dividing it by Σp.

Formula: E[X] = μ = Σ xᵢ·pᵢ; σ² = Σ (xᵢ - μ)²·pᵢ; σ = √σ²

Gambler's Ruin and the Gambler's Fallacy

Gambler's Ruin models a bankroll that changes by $1 per step: you win a step with probability p and lose it with probability q = 1 - p, starting at i and cashing out at a target N, with absorbing barriers at 0 and N. For a fair game (p = 1/2) the probability of reaching N before ruin is i/N and the expected number of steps is i(N - i). For a biased game it uses the ratio ρ = q/p. This is bankroll arithmetic, and it says nothing about the memory of the trials.

The Gambler's Fallacy is the belief that independent trials have memory: that a run of losses makes a win "due", or that a streak of reds makes black more likely next spin. Independent trials have no memory. Each spin of a fair American roulette wheel lands on any one number with probability 1/38 regardless of what came before, so a past streak does not shift the next outcome. Gambler's Ruin is about the bankroll; the Gambler's Fallacy is about the trials, and confusing the two is the mistake these two blocks separate.

Sources

  1. 4.2 Mean or Expected Value and Standard Deviation. OpenStax Introductory Statistics. Retrieved .
  2. The Gambler's Ruin Problem (lecture notes). Karl Sigman, Columbia University. Retrieved .
  3. MATH2750 Section 3: Gambler's ruin. Matthew Aldridge, University of Leeds. Retrieved .