# how is this series expansion $(\sum\limits_{i=1}^n{x_{i}})^2=(\sum\limits_{i=1}^n{x_{i}^2}+\sum\limits_{i<j}{2x_{i}x_{j}})$ derived?

I'm reading my vector calculus text when I encountered below formula.
$(\sum\limits_{i=1}^n{x_{i}})^2=(\sum\limits_{i=1}^n{x_{i}^2}+\sum\limits_{i<j}{2x_{i}x_{j}})$
Is this a definition or there's a proof for above?

-
Think of $(x_1+x_2)^2=x_1^2+x_2^2+2x_1 x_2$ – enzotib Jul 29 '12 at 13:38
i did try that but the missing $x_{2}^2$ baffled me – kypronite Jul 29 '12 at 13:51
The previous identity could be written $$(\sum_{i=1}^2 x_i)^2=\sum_{i=1}^2 x_i^2 + \sum_{i<j} 2x_i x_j,$$ and for $n=3$ you have $$(x_1+x_2+x_3)^2=x_1^2+x_2^2+x_3^2+2x_1 x_2 + 2x_1 x_3+2x_2 x_3,$$ that can be written as $$(\sum_{i=1}^3 x_i)^2=\sum_{i=1}^3 x_i^2 + \sum_{i<j} 2x_i x_j$$ – enzotib Jul 29 '12 at 13:54
ah yes, of course...earlier i took it literally as squaring the series itself to get the answer.Unfortunately I cannot choose your comment as answer to close this question since yours is the closest. – kypronite Jul 29 '12 at 14:14

Consider the array

$$\left[ \begin{array}{cccc} \color{red}{x_1^2} & \color{green}{x_1x_2} & \color{blue}{x_1x_3} & x_1x_4&&& \ldots &x_1x_n \\ \color{green}{x_1 x_2} & \color{red}{x_2^2} & x_2x_3 & x_2x_4 &&&\ldots & x_2x_n \\ \color{blue}{x_1x_3} & x_2x_3 & \color{red}{x_3^2} & x_3x_4 &&&\ldots & x_3x_n \\ x_1x_4 & x_2x_4 & x_3x_4 & \color{red}{x_4^2} & x_4x_5 &&\ldots & x_4x_n \\ &&&\vdots & \color{red}{\ddots} \\ &&&\vdots \\ &&&\vdots \\ x_1x_n & x_2x_n & \ldots &&&&\ldots & \color{red}{x_n^2}\end{array}\right].$$

This is the array consisting of all terms in the expansion of $(x_1+\ldots + x_n)^2$. Notice that the array is symmetric about the diagonal. So therefore we just need to notice that

$$\begin{eqnarray*} \left(\sum_{i=1}^n x_i\right)^2 = (x_1 + \ldots+ x_n)^2 &=& \text{(sum of all terms along the diagonal)} \\ && \hspace{16mm}+ \text{(\color{red}{twice} the sum of all terms above the diagonal)}\\ &=& \sum_{i=1}^n x_i^2 + 2\sum_{i < j} x_ix_j.\end{eqnarray*}$$

$\hspace{6in} \square$

-
That's what I meant by seeing why it's true, but I was too lazy to typeset it :) – Jbeuh Jul 29 '12 at 14:07
@Jbeuh C'était pas trop dificile.... – user38268 Jul 29 '12 at 14:09

It's easily proved by induction using $(x_1+x_2)^2=x_1^2+2x_1x_2+x_2^2$ as the base case but it's actually more useful to "see" why it's true (replace the $\Sigma$'s with dots if it helps).

-
how about the missing $x_{2}^2$ ?I'm not sure what to made of it – kypronite Jul 29 '12 at 13:46
I'm not sure what you mean. $$\left(\sum_{i=1}^{n+1} x_i\right)^2 = \left(\left(\sum_{i=1}^n x_i \right)+x_{n+1}\right)^2 = \left(\sum_{i=1}^n x_i \right)^2 + 2x_{n+1}\sum_{i=1}^n x_i + x_{n+1}^2 = \sum_{i=1}^n x_i^2 + 2\sum_{1\leq i<j \leq n} x_ix_j + 2\sum_{i=1}^n x_i x_{n+1} +x_{n+1}^2 = \sum_{i=1}^{n+1} x_i^2 + 2 \sum_{1 \leq i<j \leq n+1} x_i x_j$$ – Jbeuh Jul 29 '12 at 13:50
It's even easier to use $n=1$ as the base case (in this case $\{i<j\}$ is empty). – wildildildlife Jul 29 '12 at 14:22
@Jbeuh turns out I took squaring of equation too literally and apply it to series. – kypronite Jul 29 '12 at 14:22
@wildildildlife It's easier, but in my experience base cases which are vacuously true tend to confuse (first year) students. – Jbeuh Jul 29 '12 at 14:33

You can use multinomial theorem.

-