# How can this adjustment of sum be correct?

In our Probability and statistics materials, I run into this equation:

$$X_i$$ is one result (I hope)

$$n$$ is a count of the results

$$\overline{X_n}$$ is sample mean of the results

It is connected with point estimations, we are trying to estimate variance, and this adjustment should help. But I don't understand how we can do it.

I expect it has something to do with this adjustment:

$$(a-b)^2=a^2-2ab+b^2$$

But I just don't see how (especially the minus sign confuses me). I understand that the $$(\overline{X_n})^2$$ was removed from the sum. But where is the $$2ab$$ part?

So, How can the adjustment be accurate?

• If you expand the sum you will see how. – John Douma Jan 12 at 20:36

It's actually pretty simple but the brackets in your picture might be a bit confusing. For simplicity reasons I'll only look at the sum.

We know that $$\sum^{n}_{i=1}(X_i - \bar{X_{n}})^2=(\sum^{n}_{i=1}X_i^2)-2\bar{X_n}\sum^{n}_{i=1}X_i+\sum^{n}_{i=1}\bar{X_n}^2$$

Which in turn reduces to $$(\sum^{n}_{i=1}X_i^2)-2\bar{X_n}\sum^{n}_{i=1}X_i+\sum^{n}_{i=1}\bar{X_n}^2=(\sum^{n}_{i=1}X_i^2)-2\bar{X_n}n\bar{X_{n}}+n\bar{X_n}^2$$

Because ofcourse we know that $$\frac{1}{n}\sum^{n}_{i=1}X_i=\bar{X_n}$$ so $$\sum^{n}_{i=1}X_i=n\bar{X_n}$$. Here is now the thing we want because $$(\sum^{n}_{i=1}X_i^2)-2\bar{X_n}n\bar{X_{n}}+n\bar{X_n}^2=(\sum^{n}_{i=1}X_i^2)-n\bar{X_n}^2$$

Put the constant of $$\frac{1}{1-n}$$ that we left out for simplicity, back in front, and you're done!

• How can you put $2\bar{Xn}$ outside the sum in the first part? – TGar Jan 12 at 20:42
• Because there is no subscript $i$ anymore, so you are not summing over anything. Instead, try looking at the $\bar{X_n}$ as just a constant $c$ (ofcourse it isn't actually constant, but for simplicity). Do you agree that you could then take this constant $c$ out of the sum? – Charlie Shuffler Jan 12 at 20:43
• Sure, of course, you're right! I understand. Thanks! – TGar Jan 12 at 20:45