An equality with summations

I don't understand how the following is equivalent.

$\displaystyle n\Sigma(X_{i}-\overline{X})^2 = n\Sigma X_{i}^2 - (\Sigma X_{i})^2$

$\displaystyle \overline{X}$ is the average of all $\displaystyle X_{i}$ So, $\displaystyle \overline{X} = \Sigma X_{i}/n$

Could someone walk me through this. I've been staring at it for a long while now. I'll try to show my confusion below:

So, expanding the left side I get

$\displaystyle n\Sigma(X_{i}^2 - 2X_{i}\overline{X} + \overline{X}^2)$

Then substituting for $\displaystyle \overline{X}$, I get

$\displaystyle n\Sigma(X_{i}^2 - 2X_{i}\Sigma X_{i}/n + (\Sigma X_{i}/n)^2$

Then multiplying it out, I get

$\displaystyle n\Sigma X_{i}^2 -\Sigma(2X_{i}\Sigma X_{i}) + \Sigma((\Sigma X_{i})^2/n)$

And I'll stop there, because I really don't know what taking the summation of a summation means???

But, I do think I'm not too far off track because I now see the first term from the right hand side of the initial equality.

Re: An equality with summations

Hi, datanewb.

You're definitely on the right track, nice work!

There is some confusion, because you've used the same index to represent both the original summation and the summation needed for $\displaystyle \overline{X}.$ Since the i index is used in the orginal summation, we would want to use a new dummy index, e.g. write

$\displaystyle \overline{X}=\frac{1}{n}\sum_{j}X_{j}$.

Then the double summation is a summation over the indices i and j.

Does this help? I can write up more details if it's still confusing.

Good luck!

Re: An equality with summations

Thank you, GJA, that definitely does help.

Rewriting the last line

$\displaystyle n \sum_{i}X_{i}^2 - \sum_{j}^n(2X_{j}\sum_{i}X_{i}) + \sum_{j}^n((\sum_{i}X_{i})^2/n^2)$

is equivalent to

$\displaystyle n \sum_{i}X_{i}^2 - \sum_{j}^n(2X_{j}\sum_{i}X_{i}) + ((\sum_{i}X_{i})^2/n)$

I think... okay, I need to think about this a little bit more. Hopefully I will solve it later tonight!

Re: An equality with summations

Glad it helped! I think expanding $\displaystyle \overline{X}$ a line or two later might simplify things. Good luck and nice job sticking with a tricky little problem like this.

Re: An equality with summations

Okay, I finally solved it! Thank you for the advice and for giving me the space and time to figure it out!

I was simply too unfamiliar with algebraic manipulations of sigma notation to figure this out.

I had to realize the following:

$\displaystyle \sum_{i}^{n-1}(X_{i} + C) = \sum_{i}^{n-1}X_{i} + (n-i)C$

Secondly,

$\displaystyle \sum_{i}\frac{1}{n}X_{i} = \frac{1}{n}\sum_{i}X_{i}$

Finally, I had to realize that

$\displaystyle \sum_{i}(X_{i}\sum_{i}X_{i}) = \sum_{i}X_{i}\sum_{i}X_{i} = (\sum_{i}X_{i})^2 $

Please, if any of this is wrong, correct me.

Using the above logic, I was able to see that

$\displaystyle n\sum_{i}X_{i}^2 - n\sum_{i}(2X_{i}\overline{X}) + n^2\overline{X}^2 =$

and substituting $\displaystyle \overline{X}$ with $\displaystyle \sum_{j}\frac{1}{n}X_{j}$

$\displaystyle n\sum_{i}X_{i}^2 - n\sum_{i}(2X_{i}\sum_{j}\frac{1}{n}X_{j}) + n^2(\sum_{j}\frac{1}{n}X_{j})^2 = $

$\displaystyle n\sum_{i}X_{i}^2 - 2\sum_{i}(X_{i}\sum_{j}X_{j}) + (\sum_{j}X_{j})^2 = $

and since $\displaystyle i\equiv{j}$

$\displaystyle n\sum_{i}X_{i} - (\sum_{i}X_{i})^2$

Which is exactly the right hand side of the equality I was trying to understand initially! Woohoo!