# Show that $\sum^{n}_{i=1}(\bar{X_n}-X_i)^2=\sum^{n}_{i=1}[(X_i-\mu)^2-(\bar{X_n}-\mu)^2]$

Suppose $X_1,\dots,X_n$ are i.i.d and $E(X_1)=\mu$ and $\text{Var}(X_1)=\sigma^2$. I have to show that $$\sum^{n}_{i=1}(\bar{X_n}-X_i)^2=\sum^{n}_{i=1}[(X_i-\mu)^2-(\bar{X_n}-\mu)^2]$$ What I did was simply working out the squares and see if eventually the expressions become easier: $$\sum^{n}_{i=1}(\bar{X_n}-X_i)^2=\sum^{n}_{i=1}\bar{X_n}^2-2X_i\bar{X_n}+X_i^2$$ and \begin{align} \sum^{n}_{i=1}[(X_i-\mu)^2-(\bar{X_n}-\mu)^2]&=\sum^{n}_{i=1}[X_i^2-2X_i\mu+\mu^2-\bar{X_n}^2+2\mu\bar{X_n}-\mu^2] \\&=\sum^{n}_{i=1}[X_i^2-2X_i\mu-\bar{X_n}^2+2\mu\bar{X_n}] \end{align}

Now the question simplifies to whether $$\sum^{n}_{i=1}[\bar{X_n}^2-2X_i\bar{X_n}]=\sum^{n}_{i=1}[-2X_i\mu-\bar{X_n}^2+2\mu\bar{X_n}]$$ This is the same as asking whether $$\sum^{n}_{i=1}[\bar{X_n}^2-X_i\bar{X_n}]=\sum^{n}_{i=1}[-X_i\mu+\mu\bar{X_n}]$$ I don't know if this is correct and I don't know how to go further. I really need help. Thanks.

• This is correct. Now compute the LHS of the last identity in your post (you should find 0) and the RHS (you should also find 0), using simply the (algebraic) definition of bar-X_n, and you are done. (Note that the whole question is pure algebra, of polynoms if you want and is valid for every value of mu.) – Did Jan 5 '14 at 14:15

This can be shown much quicker by noticing that (add $-\mu + \mu$ in the expression) $$(\overline{X_n}-X_i)^2 = (\overline{X_n}-\mu)^2+(X_i-\mu)^2-2(\overline{X_n}-\mu)(X_i-\mu).$$ Now, using $$\sum_{i=1}^n(\overline{X_n}-\mu)(X_i-\mu) = (\overline{X_n}-\mu)\left(\sum_{i=1}^n X_i-n\mu\right) = n(\overline{X_n}-\mu)^2 = \sum_{i=1}^n (\overline{X_n}-\mu)^2,$$ we obtain $$\sum_{i=1}^n (\overline{X_n}-X_i)^2 = \sum_{i=1}^n(\overline{X_n}-\mu)^2+\sum_{i=1}^n(X_i-\mu)^2-2\sum_{i=1}^n(\overline{X_n}-\mu)^2.$$
To show the last equation in your argument, use the definition of $\bar{X_n}:=\frac{1}{n}\sum_{i=1}^{n} X_i$.