What is the difference between square of sum and sum of square? What is difference between square of sum $(\sum_{i=1}^{n}x_i)^2$ and sum of square $\sum_{i=1}^{n}x_i^2$?
I think square of sum is bigger than sum of square but i can not find a relation between them.
I mean: 
$$\left(\sum_{i=1}^{n}x_i\right)^2=\sum_{i=1}^{n}x_i^2+?$$
 A: If $x_i\ge 0$, then $$\left(\sum_{i=1}^n x_i\right)^2=\sum_{i=1}^n \sum_{j=1}^n x_i x_j=\sum^{n}_{i=1}x_i^2+\sum^n_{i=1}\sum_{j=1,j\not=i}^n x_i x_j\ge \sum_{i=1}^n x_i^2$$
On the other hand, by the Cauchy-Schwarz inequality,
$$\left(\sum_{i=1}^n x_i\right)^2=\left(\sum_{i=1}^n 1\cdot x_i\right)^2\le n\cdot\sum_{i=1}^{n} x_i^2$$
So if $n$ is fixed, the sum of squares and the square of the sum are equivalent quantities, i.e. can be estimated against eachother loosing only a multiplicative constant.
A: Quite literally the difference is captured by a special case of Cauchy's formula,
$$
n \sum_{i = 1}^{n} x_i^2  - \bigg ( \sum_{i = 1}^{n} x_i \bigg)^2 = \tfrac 12 \sum_{i = 1}^{n} \sum_{j = 1}^{n} (x_i - x_j)^2
$$
Note that Cauchy-Schwarz is a consequence. The general case is available here:
https://en.wikipedia.org/wiki/Cauchy%E2%80%93Schwarz_inequality#Rn_(n-dimensional_Euclidean_space)
A: In general, you have
$$\bigg(\sum_i x_i\bigg)^2 = \sum_i \sum_j x_i x_j = \sum_i x_i^2 + \sum_i \sum_{j \neq i} x_i x_j$$
However, this does not allow to tell which one of the two is greater.
A: Additionally, while the derivation is lengthy to show, the difference when summing over the naturals can be explicitly expressed as a polynomial, quite surprisingly
$(\sum_{i=1}^{n}i)^2-\sum_{i=1}^{n}(i^2)=\frac{n}{12}(n^2-1)(3n+2), n\in\mathbb{N}$
