# How do I separate the summand of a double summation?

For example, if I have:

$$\sum_{i=1}^n \sum_{j=1}^n (x_i^2 - 2x_ix_j + x_j^2)$$

How would I separate these terms?

Unfortunately, we've dived into proofs using summation without much background information on how it works.

My best (but I think incorrect) guess is:

$$\sum_{i=1}^n \sum_{j=1}^n x_i^2 - \sum_{i=1}^n \sum_{j=1}^n 2x_ix_j + \sum_{i=1}^n \sum_{j=1}^n x_j^2$$

Any help is much appreciated.

You're correct, for the reason that $\sum_{i}{(a_i+b_i)}=\sum_{i}{a_i}+\sum_{i}{b_i}$ for any terms $a_i,b_i$. Repeating this twice gives you the expression $$\sum_{i=1}^n{\sum_{j=1}^n{x_i^2}}-\sum_{i=1}^n{\sum_{j=1}^n{2x_ix_j}}+\sum_{i=1}^n{\sum_{j=1}^n{x_j^2}}$$ You can take this further though, using the rule $\sum_{i}{(ca_i)}=c\sum_{i}{a_i}$ which also results in $\sum_{i}\sum_{j}{a_ia_j}=\left(\sum_{i}{a_i}\right)\left(\sum_{j}{a_j}\right)$. Using these facts leads you to $$n\sum_{i=1}^n{x_i^2}+n\sum_{j=1}^n{x_j^2}-2\left(\sum_{i=1}^n{x_i}\right)\left(\sum_{j=1}^n{x_j}\right)$$ where I also used the fact that $\sum_{i=1}^n{1}=n$.
To add further to this, it is important to note that the specific symbol used for the indices is inconsequential, and since both $i$ and $j$ range over the same set $\{1,\ldots, n\}$ and we've separated all of the sums, we can reduce them to a single index, say $i$. This gives (as Conifold pointed out) the further simplified expression $$2n\sum_{i=1}^n{x_i^2}-2\left(\sum_{i=1}^n{x_i}\right)^2$$
• And it further simplifies to $2n\sum_{i=1}^n{x_i^2}-2\left(\sum_{i=1}^n{x_i}\right)^2$ since the $j$ indices can be replaced by $i$ indices (or any other letter) in separate sums. – Conifold Sep 6 '14 at 21:17