求证无偏样本方差两种计算表达式的等价性
Got it, let's walk through this equivalence proof step by step—this is a classic algebraic manipulation that's easier than it looks at first glance. First, a quick note: there's a tiny typo in the second formula you shared, the term $\frac{(\sum_{i=1}^n x_i)^2}{(n-1)}$ should actually have a denominator of $n$ instead of $n-1$. Let's confirm the correct equivalence we're proving:
We need to show that the original unbiased sample variance:
$$s^2 = \frac{\sum_{i=1}^n (x_i - \overline{x})^2}{n-1}$$
(where $\overline{x} = \frac{\sum_{i=1}^n x_i}{n}$) is equivalent to:
$$s^2 = \frac{1}{n-1}\left( \sum_{i=1}^n x_i^2 - \frac{(\sum_{i=1}^n x_i)^2}{n} \right)$$
Step 1: Expand the squared term in the original variance formula
Start with the numerator of the unbiased sample variance:
$$\sum_{i=1}^n (x_i - \overline{x})^2$$
Use the algebraic identity $(a - b)^2 = a^2 - 2ab + b^2$ to expand the square:
$$\sum_{i=1}^n \left(x_i^2 - 2x_i\overline{x} + \overline{x}^2\right)$$
Step 2: Split the summation into separate terms
We can distribute the summation across each term in the parentheses:
$$\sum_{i=1}^n x_i^2 - 2\overline{x}\sum_{i=1}^n x_i + \sum_{i=1}^n \overline{x}^2$$
Step 3: Substitute the definition of the sample mean
Recall that $\overline{x} = \frac{\sum_{i=1}^n x_i}{n}$, which rearranges to $\sum_{i=1}^n x_i = n\overline{x}$. Substitute this into the second term:
$$-2\overline{x} \cdot n\overline{x} = -2n\overline{x}^2$$
For the third term, $\overline{x}$ is a constant (it's the fixed mean of the dataset), so summing it $n$ times gives:
$$\sum_{i=1}^n \overline{x}^2 = n\overline{x}^2$$
Step 4: Combine like terms
Substitute these simplified terms back into our expression:
$$\sum_{i=1}^n x_i^2 - 2n\overline{x}^2 + n\overline{x}^2 = \sum_{i=1}^n x_i^2 - n\overline{x}^2$$
Step 5: Replace $\overline{x}$ with its original formula
Substitute $\overline{x} = \frac{\sum_{i=1}^n x_i}{n}$ into the $n\overline{x}^2$ term:
$$n\overline{x}^2 = n \cdot \left(\frac{\sum_{i=1}^n x_i}{n}\right)^2 = n \cdot \frac{(\sum_{i=1}^n x_i)2}{n2} = \frac{(\sum_{i=1}^n x_i)^2}{n}$$
Step 6: Final substitution to get the second form
Plug this back into the numerator we derived:
$$\sum_{i=1}^n (x_i - \overline{x})^2 = \sum_{i=1}^n x_i^2 - \frac{(\sum_{i=1}^n x_i)^2}{n}$$
Finally, divide both sides by $n-1$ (the denominator of the unbiased sample variance):
$$s^2 = \frac{1}{n-1}\left( \sum_{i=1}^n x_i^2 - \frac{(\sum_{i=1}^n x_i)^2}{n} \right)$$
That's it—we've confirmed the two forms are equivalent! The key here is just expanding the square and using the definition of the sample mean to simplify the terms.
内容的提问来源于stack exchange,提问作者BMBM

