How to use it
- Type each outcome and its probability as x: p.
- Choose weights if you have counts instead of probabilities.
- Read E[X], the variance and the standard deviation.
How it works
E[X] = Σ x · p. The variance is computed as Σ p · (x − E[X])², which avoids the rounding loss of E[X²] − E[X]² when the mean is large. In weights mode each weight is divided by the sum of all weights.
Worked example
For 0: 0.1, 1: 0.3, 2: 0.4, 3: 0.2:
- E[X] = 0.3 + 0.8 + 0.6 = 1.7
- E[X²] = 0.3 + 1.6 + 1.8 = 3.7
- Variance = 3.7 − 1.7² = 0.81, so the standard deviation is 0.9
A fair die (1 to 6, each 1/6) gives E[X] = 3.5 and variance 35/12 ≈ 2.9167.
Tips
- Expected value is an average over many repetitions, not a prediction for one trial.
- Outcomes with the same x value are fine; they are simply added together in effect.