Why the Denominator Is \(n-1\)
A sample variance is intended to estimate the variance of the population that produced the observations. But the sample mean is itself calculated from those observations. Measuring deviations from that fitted mean makes the total squared deviations smaller, on average, than if deviations were measured from the known population mean. The \(n-1\) denominator compensates for this effect.
The result depends on a specific sampling model: the observations must be independent, identically distributed, and have a finite variance. Under those conditions, the sample variance with denominator \(n-1\) is unbiased: its expected value equals the population variance. This is a statement about an average over repeated samples, not a promise that any particular sample variance equals the population variance.
The numerator \(\sum_{i=1}^n(X_i-\bar X)^2\) is called the sum of squared deviations from the sample mean. The denominator \(n-1\) is part of the definition of \(S^2\); it is not an adjustment to the observations themselves. For \(n=1\), this definition does not give a sample variance, since there are no degrees of freedom left after calculating the sample mean.
The Derivation
The key is to relate deviations from the sample mean to deviations from the fixed population mean. The fixed mean \(\mu\) is generally unknown in an application, but it is useful in the mathematical derivation. First write each observation's deviation from \(\mu\) as \(X_i-\mu=(X_i-\bar X)+(\bar X-\mu)\). When these squared deviations are summed, the cross term vanishes because the deviations from the sample mean sum to zero.
To verify the identity, expand each square on the right before collecting terms. The cross term contains \(\sum_{i=1}^n(X_i-\bar X)\), which equals zero because \(n\bar X=\sum_{i=1}^nX_i\). Rearranging gives
Now take expectations. Each squared deviation from \(\mu\) has expectation \(\sigma^2\), so the first term on the right has expectation \(n\sigma^2\). Independence gives \(\operatorname{Var}(\bar X)=\sigma^2/n\); because \(E[\bar X]=\mu\), this is also \(E[(\bar X-\mu)^2]\). Therefore:
Dividing by \(n-1\) proves the result:
The proof also explains the \(n-1\): fitting \(\bar X\) uses the observations to choose a center, leaving the centered deviations constrained to sum to zero. The expected sum of their squares is consequently \((n-1)\sigma^2\), rather than \(n\sigma^2\). The proof does not require a normal distribution. It requires independence, a common distribution with finite variance, and the stated definitions.
Worked Examples
Worked Example: Expected Squared Deviations in a Small Sample
A hypothetical laboratory records a measurement from each of five independently selected specimens. Assume the measurements are identically distributed with population mean \(12\) units and population variance \(9\) square units. Find the expected sum of squared deviations from the sample mean, the expected value of \(S^2\), and the expected value of the variance calculated using divisor \(n\).
Method and assumptions. The measurements form an iid sample with finite variance, so the derived result applies. Here \(n=5\) and \(\sigma^2=9\).
Expected centered sum of squares. Substitute into the theorem: $$ E\left[\sum_{i=1}^{5}(X_i-\bar X)^2\right] =(5-1)(9)=4(9)=36 $$ square units.
Expected \(n-1\) sample variance. By definition, \(S^2\) is the centered sum divided by \(5-1=4\), so $$ E[S^2]=\frac{36}{4}=9 $$ square units. This equals the population variance, as required for unbiasedness.
Expected variance using divisor \(n\). If the same centered sum is divided by \(5\), its expectation is $$ \frac{36}{5}=7.2 $$ square units. Thus this alternative estimator has expectation \(7.2\), not \(9\). The calculations check: the centered sum has expectation \(36\), and dividing by \(4\) or \(5\) gives \(9\) or \(7.2\), respectively.
Common mistake avoided: Do not say the centered sum itself has expectation \(\sigma^2\). Its expectation is \((n-1)\sigma^2=36\); the division by \(n-1\) makes the sample variance unbiased.
Worked Example: Verifying Unbiasedness for Bernoulli Observations
A hypothetical quality check records whether each inspected component passes, coded as \(1\) for a pass and \(0\) for a failure. Assume four independent, identically distributed inspections, each with pass probability \(p=0.3\). Find the expected centered sum of squares and verify that \(S^2\) estimates the Bernoulli population variance without bias.
Method and assumptions. Let \(X_i\sim\operatorname{Bernoulli}(0.3)\), independently for \(i=1,\ldots,4\). The population mean is \(p=0.3\), and the variance is $$ \sigma^2=p(1-p)=(0.3)(0.7)=0.21. $$ We can check the expected centered sum directly by conditioning on the number of passes \(K=\sum_{i=1}^4X_i\).
If there are \(K\) passes, then \(\bar X=K/4\). The \(K\) pass observations each contribute \((1-K/4)^2\), and the \(4-K\) failures each contribute \((K/4)^2\). Hence $$ \begin{aligned} \sum_{i=1}^4(X_i-\bar X)^2 &=K\left(1-\frac K4\right)^2+(4-K)\left(\frac K4\right)^2\\ &=K-\frac{K^2}{4}. \end{aligned} $$
Since \(K\) is binomial with parameters \(4\) and \(0.3\), $$ E[K]=4(0.3)=1.2 $$ and $$ E[K^2]=\operatorname{Var}(K)+(E[K])^2 =4(0.3)(0.7)+(1.2)^2 =0.84+1.44=2.28. $$ Therefore, $$ E\left[\sum_{i=1}^4(X_i-\bar X)^2\right] =1.2-\frac{2.28}{4} =1.2-0.57 =0.63. $$
The sample variance divides this sum by \(4-1=3\), giving $$ E[S^2]=\frac{0.63}{3}=0.21. $$ This equals the population variance \(p(1-p)=0.21\), verifying unbiasedness directly. The expected centered sum also agrees with the general result: \((4-1)(0.21)=0.63\).
Common mistake avoided: The sample mean \(K/4\) is random, so it is not valid to replace it with the population pass probability \(0.3\) inside the observed sum of squared deviations. The calculation above accounts for the possible values of \(K\).
Worked Example: When the Common-Distribution Assumption Fails
Suppose two independent instruments produce readings \(X_1\) and \(X_2\). The first has mean \(10\) and variance \(4\); the second has mean \(12\) and variance \(9\). If an analyst calculates the two-observation sample variance $$ S^2=\frac{(X_1-\bar X)^2+(X_2-\bar X)^2}{2-1}, $$ find its expectation. Does it estimate the average of the two variances without bias?
Method and assumptions. The observations are independent but not identically distributed: they have different means and variances. For two observations, \(\bar X=(X_1+X_2)/2\), and direct simplification gives $$ S^2=\frac{(X_1-X_2)^2}{2}. $$ To take its expectation, use $$ E[(X_1-X_2)^2]=\operatorname{Var}(X_1-X_2)+\{E[X_1-X_2]\}^2. $$ Independence makes \(\operatorname{Var}(X_1-X_2)=4+9=13\), while \(E[X_1-X_2]=10-12=-2\). Thus $$ E[S^2]=\frac{13+(-2)^2}{2}=\frac{17}{2}=8.5. $$
The average of the two population variances is \((4+9)/2=6.5\), not \(8.5\). The extra \(2\) comes from the difference in the instruments' means. Therefore the iid theorem does not apply, and this sample variance does not estimate the average variance without bias in this setting.
Common mistake avoided: Independence alone is not enough for the theorem. Identical distributions ensure a common mean and variance; without that condition, differences in means can contribute to the expected squared deviations.
Bias, Interpretation, and Exam Traps
An estimator is unbiased when its expectation under repeated sampling equals the quantity it targets. Individual values of \(S^2\) vary from sample to sample and may be above or below \(\sigma^2\). Unbiasedness describes the long-run average of the estimator; it does not establish that the estimator has small variability or that it is the best estimator for every purpose.
A frequent trap is confusing the centered sum of squares with a variance estimate. The sum has units squared and expectation \((n-1)\sigma^2\). The variance estimate is that sum divided by a specified denominator. In particular, the estimator with divisor \(n\) has expectation $$ E\left[\frac{1}{n}\sum_{i=1}^n(X_i-\bar X)^2\right] =\frac{n-1}{n}\sigma^2, $$ so its bias for \(\sigma^2\) is \(-\sigma^2/n\). This is why it is not the unbiased sample variance under the iid model.
The derivation's assumptions also matter. If observations are dependent, the variance of \(\bar X\) need not be \(\sigma^2/n\). If observations do not share a common distribution, the expected centered sum need not be \((n-1)\) times a single common variance. Before applying the result, identify the sampling model and confirm that it supports the independence and identical-distribution assumptions.
Check Your Understanding
For each problem, apply the stated sampling assumptions and distinguish the expected centered sum of squares from the expected sample variance.
- An iid sample has size \(6\) and population variance \(25\). Find the expected centered sum of squares and the expected value of \(S^2\). (Answer: \(125\) and \(25\), respectively.)
- A hypothetical pass/fail process has independent Bernoulli observations with pass probability \(0.2\). For a sample of size \(10\), find the population variance and the expected centered sum of squares. (Answer: population variance \(0.16\); expected centered sum of squares \(1.44\).)
- An iid sample has size \(4\), population mean \(-3\), and population variance \(7\). What is the expected value of the centered sum divided by \(n\), rather than by \(n-1\)? (Answer: \(5.25\).)
- Two independent measurements have means \(5\) and \(8\), and variances \(1\) and \(4\), respectively. Using the usual sample-variance formula with divisor \(n-1\), find its expectation. (Answer: \(7\).)
- Can the \(n-1\) sample variance be defined by the stated formula for a sample of size \(1\)? Explain briefly. (Answer: No; \(n-1=0\), and a single observation has no deviations from a sample mean that provide a sample variance.)