Tutorials › Introduction to Statistics › Variance as Expected Squared Deviation

Random Variables and Expected Value · Tutorial 359 of 996

Variance as Expected Squared Deviation

Define variance from a random variable’s mean, and calculate it directly from the possible outcomes and their probabilities.

Intermediate 8 min read

What You'll Learn

  • Define variance as the expected squared deviation from the expected value.
  • Calculate variance from a discrete probability mass function using the definition.
  • Explain why signed deviations cannot measure spread and why squaring avoids cancellation.
  • Interpret variance as a probability-weighted measure of spread around the mean.
  • Compare distributions with the same mean but different variances.
  • Recognize what variance does not reveal about a distribution.

Why Measure Spread Around the Mean?

An expected value summarizes the center of a random variable’s probability distribution. But two variables can have the same expected value while their outcomes differ greatly in how tightly they cluster around it. A separate measure is needed to describe that spread. Variance provides one such measure by taking the expected value of the squared distance from the mean.

The idea is to compare every possible outcome with the expected value, square that difference, and average the resulting squared distances using their probabilities as weights. Outcomes that are more probable contribute more to the average; outcomes farther from the mean contribute larger squared distances. This definition applies to discrete random variables with a finite expected squared deviation.

Definition: Let \(X\) be a discrete random variable with finite expected squared deviation, and let its expected value be \(E[X]\). The variance of \(X\), written \(\operatorname{Var}(X)\), is $$ \operatorname{Var}(X)=E\left[(X-E[X])^2\right]. $$ If \(X\) takes possible values \(x_1,x_2,\ldots\) with probabilities \(p_1,p_2,\ldots\), then $$ \operatorname{Var}(X)=\sum_i (x_i-E[X])^2p_i. $$

The second expression spells out the expectation in the first: for each possible value, calculate its squared deviation from the mean and multiply by the probability of that value. Add those weighted squared deviations. The probabilities must describe the distribution of \(X\): they are nonnegative and sum to 1.

Why Square the Deviations?

A deviation is the outcome minus the mean. Deviations above the mean are positive, while deviations below it are negative. If we averaged the signed deviations, the positive and negative values would cancel rather than describe the amount of spread. In fact, their probability-weighted average is always zero:

$$ E[X-E[X]]=E[X]-E[X]=0. $$

This equality uses the linearity of expectation. It shows why the signed deviation itself cannot serve as a measure of spread around the expected value: its expected value is zero, whether or not outcomes vary.

Squaring makes every deviation nonnegative, so deviations on either side of the mean contribute to spread instead of cancelling each other. Squaring also makes larger deviations count more heavily: a deviation of 4 contributes 16 before weighting, while a deviation of 2 contributes 4. Thus, a rare outcome far from the mean can affect variance noticeably, depending on its probability.

Squaring is a useful choice, but it is not the only imaginable way to avoid cancellation. For example, one could consider absolute deviations. Variance is specifically the expected squared deviation; its definition and useful mathematical properties depend on that choice. It is not the ordinary average distance from the mean.

Calculating Variance Directly

For a discrete random variable, the definition gives a direct procedure. First find the expected value, then find each outcome’s deviation from it, square each deviation, weight by its probability, and add. The mean must be known before the deviations can be calculated.

Worked Example: A Three-Outcome Random Variable

Suppose a hypothetical game’s net score \(X\), in points, has this probability distribution: \(X=-2\) with probability \(0.25\), \(X=0\) with probability \(0.50\), and \(X=4\) with probability \(0.25\). The probabilities are nonnegative and sum to \(0.25+0.50+0.25=1\), so they specify a probability distribution.

First calculate the expected value by weighting each outcome by its probability:

$$ E[X]=(-2)(0.25)+(0)(0.50)+(4)(0.25)=-0.50+0+1.00=0.50\text{ points}. $$

The deviations from the mean are \(-2-0.50=-2.50\), \(0-0.50=-0.50\), and \(4-0.50=3.50\) points. Square each deviation, multiply by its outcome’s probability, and add:

$$ \begin{aligned} \operatorname{Var}(X) &=(-2.50)^2(0.25)+(-0.50)^2(0.50)+(3.50)^2(0.25)\\ &=6.25(0.25)+0.25(0.50)+12.25(0.25)\\ &=1.5625+0.125+3.0625\\ &=4.75\text{ points}^2. \end{aligned} $$

The outcome of 4 points is the farthest from the mean, so its squared deviation is the largest. Its probability of \(0.25\) determines how much that large squared deviation contributes to the variance.

A useful check is that the weighted signed deviations in this example sum to zero:

$$ (-2.50)(0.25)+(-0.50)(0.50)+(3.50)(0.25)=-0.625-0.25+0.875=0. $$

That check illustrates why squaring matters: without it, the deviations would cancel. With squaring, all contributions are nonnegative, and their sum measures dispersion around the mean.

More Worked Calculations

Worked Example: Variance for a Fair Six-Sided Die

Let \(X\) be the number of points shown when a fair six-sided die is rolled. Its possible values are \(1,2,3,4,5,6\), each with probability \(1/6\). These probabilities are nonnegative and sum to \(6(1/6)=1\).

The expected value is

$$ E[X]=\sum_{i=1}^{6}x_iP(X=x_i) =\frac{1+2+3+4+5+6}{6} =\frac{21}{6}=3.5\text{ points}. $$

Now square each deviation from 3.5 and weight it by \(1/6\):

$$ \begin{aligned} \operatorname{Var}(X) &=\frac{(1-3.5)^2+(2-3.5)^2+(3-3.5)^2+(4-3.5)^2+(5-3.5)^2+(6-3.5)^2}{6}\\ &=\frac{6.25+2.25+0.25+0.25+2.25+6.25}{6}\\ &=\frac{17.5}{6} =\frac{35}{12} \approx 2.917\text{ points}^2. \end{aligned} $$

The outcomes are equally likely, so each squared deviation receives the same weight. The two most distant outcomes, 1 and 6, contribute equally because each is 2.5 points from the mean.

Worked Example: Same Mean, Different Variance

Consider two hypothetical reward plans, with outcomes measured in points. Under Plan A, the reward \(X_A\) is 0 or 10, each with probability \(0.50\). Under Plan B, the reward \(X_B\) is 4 with probability \(0.25\), 5 with probability \(0.50\), or 6 with probability \(0.25\). The probabilities in each plan are nonnegative and sum to 1.

For Plan A, the expected reward is

$$ E[X_A]=(0)(0.50)+(10)(0.50)=5\text{ points}. $$

Both outcomes are 5 points from the mean, so

$$ \operatorname{Var}(X_A)=(0-5)^2(0.50)+(10-5)^2(0.50) =25(0.50)+25(0.50)=25\text{ points}^2. $$

For Plan B, the expected reward is

$$ E[X_B]=(4)(0.25)+(5)(0.50)+(6)(0.25)=1+2.5+1.5=5\text{ points}. $$

Its variance is

$$ \operatorname{Var}(X_B)=(4-5)^2(0.25)+(5-5)^2(0.50)+(6-5)^2(0.25) =1(0.25)+0+1(0.25)=0.50\text{ points}^2. $$

Both plans have the same expected reward, 5 points, but Plan A has greater variance. Its outcomes are farther from the mean. Variance therefore adds information about spread that the expected value alone does not provide.

What Variance Tells Us—and What It Does Not

Variance is an average of squared distances from the mean, weighted by probabilities. It is always nonnegative, because every squared deviation and every probability is nonnegative. It is zero exactly when every outcome with positive probability equals the expected value: if any positive-probability outcome differs from the mean, its squared deviation makes a positive contribution.

The units are squared. If \(X\) is measured in points, each squared deviation is measured in points squared, and so is the variance. This is a direct consequence of squaring the differences. Variance is useful for comparing spread when variables use the same measurement scale, but its squared units can make the numerical value less intuitive than the original measurements.

Variance does not give a complete description of a probability distribution. The two reward plans above have different variances, but knowing a variance alone does not tell us every possible outcome or its probability. Nor should variance be interpreted as the probability of an outcome, or as the distance that every outcome lies from the mean. It summarizes weighted squared deviations across the distribution.

Key takeaway: To calculate variance from a discrete distribution, find the expected value, square each possible outcome’s deviation from that value, multiply by the outcome’s probability, and add. This produces the expected squared deviation, not the expected signed deviation or the average unsquared distance.

Common Mistakes

  • Adding signed deviations. This produces zero because deviations above and below the mean cancel. Square the deviations before weighting them.
  • Forgetting the probabilities. The squared deviations are not simply added unless all outcomes are equally likely and the equal weights are accounted for. Multiply each squared deviation by its probability.
  • Using the wrong center. Variance is defined using deviations from \(E[X]\), not from an arbitrary value or the most likely outcome. Calculate the expected value first.
  • Calling variance an ordinary distance. Variance uses squared deviations, so its units are squared. It is not the expected absolute distance from the mean.
  • Assuming equal means imply equal spread. The two reward plans have the same expected value but different variances. The mean alone does not determine variability.

Check Your Understanding

Use the definition of variance to answer these questions. Show the weighted squared deviations where a calculation is requested.

  1. A random variable takes values 1 and 3 with probabilities 0.50 and 0.50. Find its expected value and variance.
  2. Why does the probability-weighted average of signed deviations from \(E[X]\) equal zero?
  3. A random variable takes values 0 and 2 with probabilities 0.75 and 0.25. Calculate its variance from the definition.
  4. Two reward plans have the same expected value, but Plan A has a larger variance than Plan B. What does this tell you about their spread, and what does it not tell you?
  5. If \(X\) is measured in minutes, what are the units of \(\operatorname{Var}(X)\), and why?