# Simplifying the sum $\sum\limits_{i=1}^n\sum\limits_{j=1}^n x_i\cdot x_j$

How can I simplify the expression $\sum\limits_{i=1}^n\sum\limits_{j=1}^n x_i\cdot x_j$?

$x$ is a vector of numbers of length $n$, and I am trying to prove that the result of the expression above is positive for any $x$ vector. Is it equal to $\sum\limits_{i=1}^n x_i\cdot \sum\limits_{j=1}^n x_j$? If it is then my problem is solved, because $\left(\sum\limits_{i=1}^n x_i\right)^2$ is non-negative (positive or zero).

• Can you simplify just $\sum_{j=1}^n x_i\cdot x_j$, where $i$ is fixed? Dec 7, 2014 at 20:57
• I am trying to prove that the result of the expression abouve is positive for any x vector. Dec 7, 2014 at 21:01
• Does it equal to $\sum _{i=1}^n x_{i} \cdot \sum _{j=1}^n x_{j}$ ? If it IS then my problem is solved :) Because $(\sum _{i=1}^n x_{i} )^2$ is always positive Dec 7, 2014 at 21:08
• @Сергій: Yes. Let $a=\sum_{i=1}^nx_i$. Then $$\sum_{i=1}^n\sum_{j=1}^n(x_ix_j)= \sum_{i=1}^n\left(x_i\sum_{j=1}^nx_j\right)=\sum_{i=1}^nax_i=a^2\;.$$ Dec 7, 2014 at 21:30
• @Сергій We know that $\left(\sum\limits_{i=1}^n x_i\right)^2\ge0$ but not necessarily $\left(\sum\limits_{i=1}^n x_i\right)^2>0$. (I would be careful about distinction between the words positive and non-negative.) Dec 8, 2014 at 6:11

$$\sum_{i=1}^n\sum_{j=1}^nx_i x_j=\left(\sum_{i=1}^ nx_i\right)^2\;.$$
To see this, let $a=\sum_{i=1}^ nx_i$; then
$$\sum_{i=1}^n\sum_{j=1}^nx_i x_j=\sum_{i=1}^n\left(x_i\sum_{j=1}^nx_j\right)=\sum_{i=1}^na x_i=a^2\;.$$