Tutorials › Introduction to Statistics › Common Errors in Discrete Variance Calculations

Random Variables and Expected Value · Tutorial 373 of 996

Common Errors in Discrete Variance Calculations

Learn a systematic way to check discrete variance calculations and explain why each common error gives the wrong result.

Intermediate 9 min read

What You'll Learn

  • Calculate variance by weighting squared deviations from the expected value.
  • Identify why distinct outcomes are not generally equally weighted.
  • Check the computational formula by subtracting the squared mean.
  • Distinguish variance from standard deviation and their units.
  • Apply shifts and rescaling correctly to variance.
  • Use a checklist to diagnose common calculation errors.

Why Variance Calculations Go Wrong

A variance calculation can look like a sequence of routine arithmetic and still be wrong. The most common errors are small changes to the rule: giving each possible value equal weight, squaring outcomes without first centering them at the mean, reporting variance as though it were standard deviation, or scaling variance by the same factor as the outcomes. Each mistake changes what is being measured.

For a discrete random variable, variance describes the probability-weighted average of squared distances from the variable’s expected value. The probabilities matter, the center matters, and the squaring matters. Keeping those three features visible is the best way to calculate accurately and diagnose a suspicious answer.

The Definition to Keep in View

Suppose a discrete random variable \(X\) has possible values \(x_1,\ldots,x_k\), with probabilities \(p_1,\ldots,p_k\). Its probability mass function must assign nonnegative probabilities that sum to 1. The expected value is the probability-weighted mean of the outcomes, and the variance is the probability-weighted mean of their squared deviations from that expected value.

Definition: For a discrete random variable \(X\) with possible values \(x_i\) and probabilities \(p_i=P(X=x_i)\), the expected value is \(\mu_X=E(X)=\sum_i p_i x_i\). Its variance is \(\operatorname{Var}(X)=E[(X-\mu_X)^2]=\sum_i p_i(x_i-\mu_X)^2\). Its standard deviation is \(\sigma_X=\sqrt{\operatorname{Var}(X)}\).

The word weighted is essential. An outcome with probability 0.70 contributes more to the average than an outcome with probability 0.10. A table of distinct outcomes is not, by itself, a list of equally likely cases. Also, the deviations are from \(\mu_X\), not from zero. Squaring the deviations ensures that values on either side of the mean contribute positively, while keeping the result in squared units.

A useful equivalent calculation is the computational formula:

$$ \operatorname{Var}(X)=E(X^2)-[E(X)]^2 $$

Here \(E(X^2)=\sum_i p_i x_i^2\). This formula can make arithmetic faster, but it is not permission to omit the subtraction of the squared mean. It is also a useful independent check against the definition.

Worked Example: Unequal Probabilities Must Stay Unequal

Suppose a hypothetical discrete random variable \(X\) takes values 0, 1, and 4 with probabilities 0.20, 0.50, and 0.30. These probabilities are nonnegative and sum to 1, so they define a valid probability mass function. Calculate the variance and examine what happens if the three outcomes are averaged equally.

First calculate the expected value using the probabilities:

$$ \mu_X=E(X)=(0.20)(0)+(0.50)(1)+(0.30)(4)=1.70 $$

The squared deviations from 1.70 are \((0-1.70)^2=2.89\), \((1-1.70)^2=0.49\), and \((4-1.70)^2=5.29\). Weight each by its probability:

$$ \operatorname{Var}(X)=(0.20)(2.89)+(0.50)(0.49)+(0.30)(5.29) =0.578+0.245+1.587=2.410 $$

The variance is 2.410 squared units of \(X\). If we instead average the three squared deviations equally, we get \((2.89+0.49+5.29)/3=2.890\). That is not the variance for this model: it treats all three outcomes as if they had probability \(1/3\), contradicting the given probability mass function.

As a check, \(E(X^2)=(0.20)(0^2)+(0.50)(1^2)+(0.30)(4^2)=5.30\). Therefore \(E(X^2)-[E(X)]^2=5.30-(1.70)^2=5.30-2.89=2.410\), matching the first calculation.

Why the Mean Must Be Subtracted

Squaring the outcomes directly measures their size relative to zero, not their spread around the mean. In general, \(E(X^2)\) is not the variance. The missing adjustment is \([E(X)]^2\). The computational formula follows by expanding the squared deviation:

$$ \begin{aligned} \operatorname{Var}(X) &=E[(X-\mu_X)^2]\\ &=E(X^2-2\mu_X X+\mu_X^2)\\ &=E(X^2)-2\mu_X E(X)+\mu_X^2\\ &=E(X^2)-2\mu_X^2+\mu_X^2\\ &=E(X^2)-\mu_X^2 \end{aligned} $$

The fourth line uses \(E(X)=\mu_X\), and \(E(\mu_X^2)=\mu_X^2\) because the mean is a constant. This derivation shows exactly why forgetting to subtract the squared mean overstates the variance whenever the mean is nonzero. It also gives two routes to the same answer: the definition using deviations, and the computational formula using moments.

Worked Example: Squared Outcomes Are Not Squared Deviations

Let a hypothetical variable \(X\) equal 2 with probability 0.75 and 4 with probability 0.25. The probabilities sum to 1. A calculation that stops at \(E(X^2)\) may look plausible, so compare it with the correct variance.

The mean is \(\mu_X=(0.75)(2)+(0.25)(4)=2.50\). The deviations are \(2-2.50=-0.50\) and \(4-2.50=1.50\), so the variance is

$$ \operatorname{Var}(X)=(0.75)(-0.50)^2+(0.25)(1.50)^2 =(0.75)(0.25)+(0.25)(2.25)=0.750 $$

By contrast, \(E(X^2)=(0.75)(2^2)+(0.25)(4^2)=3+4=7.00\), which is not the variance. Applying the computational formula gives \(7.00-(2.50)^2=7.00-6.25=0.750\). The subtraction is indispensable.

Variance and Standard Deviation Are Different Quantities

Variance is measured in squared units, because each deviation is squared. Standard deviation is the square root of variance, so it returns to the original measurement units. They summarize spread in related but different ways; one cannot substitute for the other without changing the quantity being reported.

For example, if \(X\) measures minutes, its variance is in minutes squared and its standard deviation is in minutes. If \(X\) measures dollars, variance is in dollars squared, while standard deviation is in dollars. A number reported as “variance” with the original units is a warning sign; a number reported as standard deviation without taking a square root is another.

Worked Example: Reporting Both Measures With Their Units

For the variable in the previous example, \(\operatorname{Var}(X)=0.750\) in squared units of \(X\). Its standard deviation is

$$ \sigma_X=\sqrt{0.750}=0.8660 $$

If the values of \(X\) represent minutes, the variance is 0.750 minutes squared and the standard deviation is about 0.8660 minutes. Reporting 0.750 minutes as the standard deviation would be incorrect: 0.750 is the variance, and its square root is the standard deviation. Conversely, reporting 0.8660 minutes squared as the variance would attach the wrong value and units to that measure.

The standard deviation is on the scale of the values and is often easier to compare with the original outcomes. The variance is especially useful in mathematical work, including rules for combining random variables. They are connected, but not interchangeable.

Rescaling: Square the Factor for Variance

Changing a variable’s scale changes its deviations from the mean. If \(Y=a+bX\), where \(a\) and \(b\) are constants, then the mean of \(Y\) is \(a+b\mu_X\). Subtracting that mean from \(Y\) leaves \(b(X-\mu_X)\). Squaring that deviation produces the factor \(b^2\), while the added constant \(a\) disappears.

$$ \begin{aligned} Y-E(Y)&=a+bX-(a+b\mu_X)=b(X-\mu_X),\\ \operatorname{Var}(Y) &=E[(Y-E(Y))^2]\\ &=E[b^2(X-\mu_X)^2]\\ &=b^2\operatorname{Var}(X) \end{aligned} $$

This is the reason variance scales by the square of the multiplier, not by the multiplier itself. A shift changes every value and the mean by the same amount, so it does not change the deviations. A negative multiplier reverses the signs of deviations, but squaring still gives the positive factor \(b^2\).

Worked Example: Checking a Rescaled Variable

Let \(X\) have the two-outcome distribution from the earlier example: \(X=2\) with probability 0.75 and \(X=4\) with probability 0.25. Define \(Y=3X+2\). Since the multiplier is 3, the variance should be multiplied by \(3^2=9\); the shift by 2 should not affect it.

We already found \(\operatorname{Var}(X)=0.750\). Thus the transformation rule gives

$$ \operatorname{Var}(Y)=3^2(0.750)=9(0.750)=6.750 $$

Check directly. The possible values of \(Y\) are 8 and 14, with probabilities 0.75 and 0.25. Its mean is \((0.75)(8)+(0.25)(14)=9.50\). Therefore

$$ \operatorname{Var}(Y)=(0.75)(8-9.50)^2+(0.25)(14-9.50)^2 =(0.75)(2.25)+(0.25)(20.25)=6.750 $$

Multiplying the variance by 3 would give 2.250, which fails the direct calculation. The standard deviation, by comparison, is multiplied by \(|3|\): \(\sqrt{6.750}=3\sqrt{0.750}\approx2.598\). Do not apply the variance scaling rule to the standard deviation.

A Practical Error-Checking Routine

When a discrete variance answer seems too large, too small, or carries the wrong units, inspect the calculation in a fixed order. This separates errors in the probability model from errors in the arithmetic.

1
Check the probability mass function.
Confirm that each probability is nonnegative and that the probabilities sum to 1. Keep the given probabilities attached to their outcomes.
2
Find the mean first.
Calculate \(\mu_X=\sum_i p_i x_i\). Do not assume zero is the center unless the calculation establishes that.
3
Center, square, and weight.
For each outcome, calculate \(x_i-\mu_X\), square that deviation, and multiply by \(p_i\). Add the weighted terms.
4
Check by the computational formula.
Where practical, calculate \(E(X^2)-[E(X)]^2\) independently. The result should agree with the weighted-deviation calculation.
5
Label the result and any transformation.
State variance in squared units and standard deviation in original units. For \(a+bX\), use \(b^2\operatorname{Var}(X)\) for variance.

Common Mistakes and Their Corrections

  • Wrong reasoning: “There are three outcomes, so I average the three squared deviations by dividing by 3.” This gives each distinct value equal weight, regardless of its probability. Correction: multiply each squared deviation by its probability and sum. Equal weighting is appropriate only when the outcomes actually have equal probabilities.
  • Wrong reasoning: “The average of the squared outcomes is the variance.” That calculates \(E(X^2)\), which measures squared values relative to zero. Correction: use \(E[(X-\mu_X)^2]\), or subtract \(\mu_X^2\) from \(E(X^2)\).
  • Wrong reasoning: “The variance is 0.750, so the standard deviation is 0.750.” These are different measures. Correction: take the square root: the standard deviation is \(\sqrt{0.750}\approx0.8660\).
  • Wrong reasoning: “If every value is tripled, variance is tripled.” Deviations are tripled, then squared. Correction: multiply variance by \(3^2=9\). A constant shift does not change variance.
  • Wrong reasoning: “Because deviations can be negative, their squared contributions could cancel.” Squared deviations cannot be negative. Correction: square each deviation before weighting and adding; variance is nonnegative.
Key takeaway: A discrete variance is a probability-weighted average of squared deviations from the expected value. Preserve the probabilities, subtract the mean before squaring, distinguish variance from its square root, and square any scale factor applied to the variable.

Check Your Understanding

For each question, state the reasoning behind your answer, not just a number.

  1. A variable has outcomes 1 and 5 with probabilities 0.80 and 0.20. Why would averaging the two squared deviations equally generally give the wrong variance?
  2. For any variable with mean \(\mu_X\), explain why \(E(X^2)\) alone is not generally its variance.
  3. A variable has variance 16 square units. What is its standard deviation, and in what units should it be reported?
  4. If \(Y=7-2X\) and \(\operatorname{Var}(X)=3\), find \(\operatorname{Var}(Y)\). Explain why the added 7 does not affect the answer.
  5. A student calculates a variance by summing the probabilities times the outcomes squared, but does not subtract the squared mean. Name the omitted term and describe the resulting error.