[Math] Proof of the distribution of sample variance

probability theorystatistics

I'm reading Probability and Statistics by DeGroot and Schervish, and I got stuck on one particular line of the proof of the distribution of the sample variance $\hat{\sigma}$ of a random sample of $n$ many i.i.d. standard normal random variables $X_{i}$. The sample has sample mean $\bar{X}_n$.

The equality that I can't follow is $(\sum_{i=1}^n X_i^2) – n\bar{X}_n^2 = \sum_{i=1}^n (X_i – \bar{X}_n)^2$

I understand that you can rewrite $n\bar{X}_n^2 = \sum_{i=1}^n \bar{X}_n^2$, which then turns the left term of the first equality to $(\sum_{i=1}^n X_i^2) – (\sum_{i=1}^n \bar{X}_n^2) = \sum_{i=1}^n (X_i^2 – \bar{X}_n^2)$. But for the life of me, I can't figure out how you get from that result to the right term of the first equality. What am I missing here?

Thanks in advance!

Best Answer

It is easier to go from right to left.

Note that $(X_i-\bar{X})^2=X_i^2-2X_i\bar X+\bar{X}^2$.

Summing, we get $$\sum_1^n(X_1-\bar{X})^2=\sum_1^n X_i^2-2\bar{X}\sum_1^n X_i +\sum_1^n \bar{X}^2.$$ The middle term is $-2n \bar{X}^2$ because $\sum_1^n X_i=n\bar{X}$. The last term is $n\bar{X}^2$.

Remark: I find it easier to see things by calling $\bar{X}$ by the name $\mu$.