Probability & Combinatorics
Intermediate

Variance of a Random Variable

Measures the spread of a random variable around its mean.

Formula

Var(X)=E[X2]−(E[X])2Var(X) = E[X^2] - (E[X])^2

Variables

XRandom variable
EExpectation

Example

Larger variance = more spread

How it works

Variance tells you how far the values of a random variable tend to sit from its average, but it measures that spread in a mathematically convenient way. The identity Var(X) = E[X^2] - (E[X])^2 comes from expanding E[(X - E[X])^2]: when you square the deviation from the mean, the cross-term combines neatly into the square of the mean. This form is especially useful because it lets you compute variability using just the first and second moments of the distribution.

When to use it

Use this when you know, or can find, the expected value of X and X^2 and want the spread of a distribution without listing every deviation one by one. It is common in probability, statistics, finance, physics, and any problem comparing how variable different random outcomes are.

Worked example, step by step

Let X be a random variable with values 0, 1, and 2. P(X=0)=1/4, P(X=1)=1/2, P(X=2)=1/4 Step 1: Find E[X] = 0(1/4) + 1(1/2) + 2(1/4) = 0 + 1/2 + 1/2 = 1 Step 2: Find E[X^2] = 0^2(1/4) + 1^2(1/2) + 2^2(1/4) = 0 + 1/2 + 1 = 3/2 Step 3: Use Var(X) = E[X^2] - (E[X])^2 Var(X) = 3/2 - (1)^2 = 3/2 - 1 = 1/2 Final answer: Var(X) = 0.5

Common mistakes to avoid

  • using E[X]^2 as if it meant E[X^2]
  • forgetting to square the mean when subtracting
  • confusing variance with standard deviation, which is the square root of variance

Did You Know?

Standard deviation is the square root of variance.

Share this formula

Reviewed & maintained by the FormulaWon editorial teamLast reviewed September 2026