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+?$$
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.
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)