P(reach target)
0.5
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.
Shown without JavaScript: an example computed when this page was built, using the values the fields above suggest. This page calculates in your browser, so entering your own outcomes and computing from them needs JavaScript enabled.
Expected value E[X]
-0.05263
An American roulette single-number bet: it pays 35 at probability 1/38 and loses 1 at probability 37/38.
Probability mass by Outcome; 2 centered outcomes; Expected value -0.05263; one standard deviation from -5.815 to 5.71
| x | p | x·p | (x - μ)²·p |
|---|---|---|---|
| 35 | 0.02632 | 0.9211 | 32.33 |
| -1 | 0.9737 | -0.9737 | 0.8739 |
| Total | -0.05263 | 33.21 |
A fair game at p = 0.5, starting from a bankroll of 5, with a target of 10.
P(reach target)
0.5
P(ruin)
0.5
Add outcomes and their probabilities to see the expected value.
Expected value E[X]
Add outcomes
Population mean of the entered distribution.
Probability mass by Outcome; 3 centered outcomes; Expected value 1; one standard deviation from 0.2929 to 1.707
| x | p | x·p | (x - μ)²·p |
|---|
P(reach target)
Enter values
P(ruin)
Enter values
E[X] = μ = Σ xᵢ·pᵢ; σ² = Σ (xᵢ - μ)²·pᵢ; σ = √σ²
How?
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. The binomial and Poisson pages print those moments in closed form beside the exact probability of a count.
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 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.