Sub topic 5
Variance and Standard Deviation as Spread
This chapter assumes you can compute a mean, median, and range, work with fractions and percents, and read the expected value of a discrete random variable as a probability-weighted average. Expected value tells you where a distribution is centered. It says nothing about how far values stray from that center. Variance and standard deviation measure that spread.
Why the mean is not enough
Two random variables can share a mean and behave very differently.
- X takes the values 49 and 51, each with probability 1/2.
- Y takes the values 0 and 100, each with probability 1/2.
Both have a mean of 50. X always lands within 1 of its mean. Y always lands 50 away from it. A measure of spread has to separate these two cases.
Building the measure from deviations
A deviation is the distance of a value from the mean, written as x − μ. Here μ (the Greek letter mu) is the mean.
The first idea is to average the deviations. That fails, because positive and negative deviations cancel. For any distribution, the probability-weighted average of x − μ is exactly 0.
There are two ways to stop the cancellation. You can take absolute values, or you can square each deviation. Squaring is the standard choice. Squared deviations are always nonnegative, and they give extra weight to values far from the mean.
The variance of a random variable is the probability-weighted average of the squared deviations from the mean:
Var(X) = Σ (x − μ)² · P(x)
The standard deviation is the square root of the variance. It is written σ (sigma). Variance is measured in squared units. If X is in dollars, Var(X) is in dollars squared. Taking the square root returns the spread to the original units, so standard deviation is the number you can compare directly with the data.
A worked example
Let X take the values 1, 2, 3, 4 with probabilities 0.1, 0.2, 0.3, 0.4.
- Mean: 1(0.1) + 2(0.2) + 3(0.3) + 4(0.4) = 0.1 + 0.4 + 0.9 + 1.6 = 3.
- Deviations from 3: −2, −1, 0, 1.
- Squared deviations: 4, 1, 0, 1.
- Weighted by probability: 4(0.1) + 1(0.2) + 0(0.3) + 1(0.4) = 0.4 + 0.2 + 0 + 0.4 = 1.
- Variance is 1, so the standard deviation is 1.
The code below does the same computation with exact fractions.
from fractions import Fraction
values = [1, 2, 3, 4]
probs = [Fraction(1, 10), Fraction(2, 10), Fraction(3, 10), Fraction(4, 10)]
mean = sum(v * p for v, p in zip(values, probs))
variance = sum((v - mean) ** 2 * p for v, p in zip(values, probs))
print(mean, variance) # 3 1The standard deviation here is √1 = 1. The value 4 is the only one more than 1 above the mean. The value 1 is 2 below it, which is the largest deviation.
The same idea for a data set
When all values are equally likely, as in a list of numbers, each probability is 1/n. The variance becomes the plain average of the squared deviations.
For the list 2, 4, 4, 4, 5, 5, 7, 9:
- The mean is 40 / 8 = 5.
- The deviations are −3, −1, −1, −1, 0, 0, 2, 4.
- The squared deviations are 9, 1, 1, 1, 0, 0, 4, 16, which sum to 32.
- The variance is 32 / 8 = 4, so the standard deviation is 2.
data = [2, 4, 4, 4, 5, 5, 7, 9]
mean = sum(data) / len(data)
variance = sum((x - mean) ** 2 for x in data) / len(data)
print(mean, variance, variance ** 0.5) # 5.0 4.0 2.0Statistics courses often divide by n − 1 for a sample. GRE problems that ask you to compare or reason about standard deviation rarely require the exact calculation. If one is needed, the problem will tell you how to treat the data, so use the divisor the problem implies.
Comparing the two opening examples
Use the definition on X (49 or 51) and Y (0 or 100), both with mean 50.
| Variable | Deviations | Squared deviations | Variance | Standard deviation |
|---|---|---|---|---|
| X | −1, +1 | 1, 1 | 1 | 1 |
| Y | −50, +50 | 2500, 2500 | 2500 | 50 |
The table confirms what the values suggested. Y is 50 times as spread out as X in standard deviation, and 2500 times as large in variance.
How standard deviation behaves
Several properties come up repeatedly on the GRE. You can often answer a question with them and no arithmetic.
- Standard deviation is never negative. It is 0 only when every value equals the mean, so there is no spread at all.
- A larger standard deviation means values tend to sit farther from the mean. It does not mean larger values.
- Values far from the mean affect it more than values near the mean, because deviations are squared. Replacing one value with an extreme one raises the standard deviation sharply.
- Standard deviation depends on how far values are from the mean, not on how many values there are. Adding copies of the mean to a list lowers the standard deviation, because it adds zero deviations while increasing the count in the average.
- It carries the same units as the data. Variance carries squared units.
Estimating spread without calculating
The GRE often asks which of two sets has the greater standard deviation. Compare how the values are arranged around each mean. Do not compute.
Consider these two lists:
- A: 10, 20, 30, 40, 50
- B: 28, 29, 30, 31, 32
Both have a mean of 30. List A runs from 10 to 50. List B stays within 2 of 30. A has the greater standard deviation, and you can see this from the ranges alone.
A trickier pair has the same range:
- C: 0, 10, 10, 10, 20
- D: 0, 0, 10, 20, 20
Both have a range of 20 and a mean of 10. In C, three values sit exactly on the mean. In D, only one does, and four values are 10 or more away. D has the greater standard deviation. Range uses only the two extreme values, while standard deviation uses every value. So two sets can have equal ranges and different standard deviations.
Common errors
- Forgetting to square the deviations, which makes the result 0 for every distribution.
- Reporting variance when the question asks for standard deviation, or the reverse. The variance in the first example and the standard deviation happen to match at 1. That is a coincidence of the numbers, not a rule.
- Taking the square root of each squared deviation separately before averaging. That produces the average absolute deviation, which is a different quantity. Average first, then take one square root.
- Treating a large standard deviation as a large mean. The two are independent.
- Assuming that equal ranges imply equal standard deviations.
- Subtracting something other than the mean. The mean is the center that makes the average squared deviation smallest. Deviations from any other number give a larger result.
Why this matters for the normal distribution
The next chapters describe a normal distribution by two numbers only, its mean μ and its standard deviation σ. The mean fixes where the bell sits. The standard deviation fixes how wide it is. Every later rule, including the 68-95-99.7 rule and z-scores, measures distances in units of σ. You need to be comfortable reading σ as a yardstick for how far a value is from the center.
Exercise
A random variable X takes the values 0, 2, and 10 with probabilities 0.5, 0.3, and 0.2. Find its mean, its variance, and its standard deviation. Round the standard deviation to two decimal places.
Show answer
The mean is 0(0.5) + 2(0.3) + 10(0.2) = 0 + 0.6 + 2 = 2.6. The deviations are −2.6, −0.6, and 7.4. The squared deviations are 6.76, 0.36, and 54.76. The variance is 6.76(0.5) + 0.36(0.3) + 54.76(0.2) = 3.38 + 0.108 + 10.952 = 14.44. The standard deviation is √14.44 = 3.8.
Exercise
Set P is 3, 5, 7, 9, 11. Set Q is 3, 5, 7, 9, 11, 7. Both sets have a mean of 7. Without calculating, which set has the greater standard deviation, and why? Then check by computing both variances as the average of squared deviations.
Show answer
Set P has the greater standard deviation. Set Q adds a value equal to the mean, which contributes a deviation of 0 and raises the count, so the average squared deviation falls. For P, the squared deviations are 16, 4, 0, 4, 16, which sum to 40, so the variance is 40 / 5 = 8. For Q, the sum is still 40, and the variance is 40 / 6, which is about 6.67. So P has the greater variance and standard deviation.
Exercise
Two sets each contain 5 numbers. Set M is 0, 5, 10, 15, 20. Set N is 0, 0, 10, 20, 20. Both have a mean of 10. Which has the greater standard deviation, and what does that show about using range to compare spread?
Show answer
Set N has the greater standard deviation. M has squared deviations 100, 25, 0, 25, 100, which sum to 250, so its variance is 50. N has squared deviations 100, 100, 0, 100, 100, which sum to 400, so its variance is 80. The two sets have the same range of 20, so range alone cannot rank their spread. Standard deviation uses every value, and N has more values far from the mean.