Variance

Average squared distance from the mean.

Same mean, different spread

A random variable X takes the values 4, 5 and 6 with probabilities 1/5, 3/5 and 1/5. Its mean is E(X) = 4 × 1/5 + 5 × 3/5 + 6 × 1/5 = (4 + 15 + 6)/5 = 25/5 = 5.

A second variable Y takes the values 1, 5 and 9 with probabilities 2/5, 1/5 and 2/5. Its mean is E(Y) = 1 × 2/5 + 5 × 1/5 + 9 × 2/5 = (2 + 5 + 18)/5 = 25/5 = 5 as well.

The two means are the same, but the variables are not alike. X always lands within 1 of its mean. Y lands 4 away from its mean four times out of five. A second number is needed to describe how far the values spread out from the mean.

456mean 5

X as five equally likely tickets: one 4, three 5s and one 6, on a scale from 0 to 10. They balance at 5, and none is more than 1 away.

159mean 5

Y on the same scale: two 1s, one 5 and two 9s. They also balance at 5, but four of the five tickets are 4 away from it.

Why the distances are squared

The obvious measure is the average distance from the mean. For Y, the distances are 1 − 5 = −4, 5 − 5 = 0 and 9 − 5 = 4. Weighted by their probabilities they give −4 × 2/5 + 0 × 1/5 + 4 × 2/5 = −8/5 + 0 + 8/5 = 0.

That is no accident. The mean is the balance point, so the distances below it always cancel the distances above it, for every distribution. The average distance is always 0 and says nothing about spread.

Squaring stops the canceling, because a square is never negative. The squared distances for Y are 16, 0 and 16. Their average, weighted by the probabilities, is 16 × 2/5 + 0 × 1/5 + 16 × 2/5 = 32/5 + 32/5 = 64/5 = 12.8.

This is the variance of Y: Var(Y) = 12.8. In general, Var(X) is the expected squared distance from the mean, E((X − μ)²), where μ = E(X).

The narrow one

For X the distances from 5 are −1, 0 and 1, and their squares are 1, 0 and 1. So Var(X) = 1 × 1/5 + 0 × 3/5 + 1 × 1/5 = 2/5 = 0.4.

The two variances, 0.4 and 12.8, say in numbers what the beams show: Y is far more spread out than X.

A variance is in squared units. If X is a number of minutes, Var(X) is in minutes squared. Its square root, the standard deviation σ, is back in the units of X: σ for X is √0.4 ≈ 0.63, and σ for Y is √12.8 ≈ 3.58.

Two values, equally likely

Let X be 4 or 6, each with probability 1/2. The mean is 5. Both values are 1 away from it, so the distances are −1 and +1 and both squares are 1. Var(X) = 1/2 × 1 + 1/2 × 1 = 1.

Move the values further apart: X is 2 or 8, each with probability 1/2. The mean is still 5, but both values are now 3 away from it, so each squared distance is 9 and Var(X) = 1/2 × 9 + 1/2 × 9 = 9.

For any two equally likely values, h on either side of the mean, the variance is h². The gap between the values is 2h, but the distance that is squared is h, measured from the mean.

28mean 5

X is 2 or 8 with probability 1/2 each. Each value is 3 from the balance point at 5, so each squared distance is 9, and Var(X) = 9.

A shortcut: the mean of the squares minus the square of the mean

Var(X) can also be found as Var(X) = E(X²) − [E(X)]². Here E(X²) is worked out like E(X), but with each value squared and each probability left as it is.

For Y: E(Y²) = 1² × 2/5 + 5² × 1/5 + 9² × 2/5 = 2/5 + 25/5 + 162/5 = 189/5 = 37.8. Then Var(Y) = 37.8 − 5² = 37.8 − 25 = 12.8, the same as before.

The shortcut avoids working out every distance, which helps when the mean is not a whole number, as in the application below.

The usual mistakes

Leaving the distance unsquared. For X equal to 2 or 8, the distance 3 is not the variance; 3² = 9 is.

Using the gap between the two values. The gap from 2 to 8 is 6, but each distance is measured from the mean 5, so it is 3.

Subtracting the mean instead of its square. E(X²) − E(X) is not the variance: the mean must be squared first.

Squaring the probabilities. In E(X²) the values are squared; each square is still weighted by its own probability.

Worked example: Deliveries to a Bakery Each Morning, Where One Probability Is Missing and the Spread Is Asked For

Question The number of deliveries X that a bakery receives in one morning has P(X = 0) = 0.1, P(X = 1) = 0.3, P(X = 2) = p and P(X = 3) = 0.2, and no other values are possible. (a) Find p and E(X). (b) Find Var(X) and the standard deviation of the number of deliveries.

  1. 1.The probabilities add up to 1: 0.1 + 0.3 + p + 0.2 = 1, so p = 1 − 0.6 = 0.4.

    0.100.31p20.230.1 + 0.3 + p + 0.2 = 1p = 1 − 0.6 = 0.4
    0.100.31p20.230.1 + 0.3 + p + 0.2 = 1p = 1 − 0.6 = 0.4
    The four probabilities add up to 1, so the missing bar is p = 0.4.
  2. 2.(a) p = 0.4, and E(X) = 0 × 0.1 + 1 × 0.3 + 2 × 0.4 + 3 × 0.2 = 0 + 0.3 + 0.8 + 0.6 = 1.7 deliveries.

    0.100.310.420.23E(X) = 0.3 + 0.8 + 0.6 = 1.7
    0.100.310.420.23E(X) = 0.3 + 0.8 + 0.6 = 1.7
    (a) E(X) = 1 × 0.3 + 2 × 0.4 + 3 × 0.2 = 1.7 deliveries.
  3. 3.Find the mean of the squares, each square weighted by its own probability: E(X2) = 02 × 0.1 + 12 × 0.3 + 22 × 0.4 + 32 × 0.2 = 0 + 0.3 + 1.6 + 1.8 = 3.7.

    0.100.310.420.23E(X × X) = 0 + 0.3 + 1.6 + 1.8 = 3.7each value squared: 0, 1, 4, 9
    0.100.310.420.23E(X × X) = 0 + 0.3 + 1.6 + 1.8 = 3.7each value squared: 0, 1, 4, 9
    The mean of the squares weights 0, 1, 4 and 9 by the same probabilities: E(X2) = 3.7.
  4. 4.Subtract the square of the mean: Var(X) = 3.7 − 1.72 = 3.7 − 2.89 = 0.81.

    0.100.310.420.23Var(X) = 3.7 − 1.7 × 1.7= 3.7 − 2.89 = 0.81
    0.100.310.420.23Var(X) = 3.7 − 1.7 × 1.7= 3.7 − 2.89 = 0.81
    Var(X) = E(X2) − [E(X)]2 = 3.7 − 2.89 = 0.81.
  5. 5.(b) Var(X) = 0.81, and the standard deviation is √0.81 = 0.9 deliveries. Check from the distances to the mean: 2.89 × 0.1 + 0.49 × 0.3 + 0.09 × 0.4 + 1.69 × 0.2 = 0.289 + 0.147 + 0.036 + 0.338 = 0.81.

    0.100.310.420.23Var(X) = 0.81sd = 0.9 deliveries
    0.100.310.420.23Var(X) = 0.81sd = 0.9 deliveries
    (b) The variance is 0.81 and the standard deviation is √0.81 = 0.9 deliveries.

Answer: (a) p = 0.4 and E(X) = 1.7; (b) Var(X) = 0.81, standard deviation 0.9 deliveries

Common mistakes

  • Writing Var(X) = E(X2) − E(X) = 3.7 − 1.7 = 2. The mean must be squared before it is subtracted: 1.72 = 2.89.
  • Squaring the probabilities instead of the values in E(X2). The value 2 becomes 4, and it is still weighted by its own probability, 0.4 and not 0.16.

More probability distributions problems, worked step by step →

Practice Variance in the app