How to calculate the following sum? $\sum_{1 \le i < j \le s} x_i \times x_j$ $\sum_{1 \le i < j \le s} x_i \times x_j$
The elements of the $x_1, x_2, ... , x_s$ sequence are: one $-1$, two $-2$'s, three $-3$'s, ..., n $-n$'s. We also have $s = \frac{n \times (n+1)}{2}$ obviously.
Maybe we could try using $(x_1 + x_2 +.... + x_s)^2$ and $\sum_{i =1}^{s} x_i^2$ but I'm not sure how.
 A: Hint :
By the well known formula
$$(\sum_{i =1}^{s} x_i)^2 = \sum_{i =1}^{s} x_i^2 + \sum_{1 \le i < j \le s}2 x_i x_j$$
you obtain that
$$\sum_{1 \le i < j \le s} x_i x_j = \frac{(\sum_{i =1}^{s} x_i)^2 -\sum_{i =1}^{s} x_i^2}{2}$$
Also, consider that in your case
$$\sum_{i =1}^{s} x_i = -\sum_{i =1}^{n} i^2  $$
$$\sum_{i =1}^{s} x^2_i = \sum_{i =1}^{n} i^3  $$
A: You can split the interval $ \left[ {1 \leqslant i , j \leqslant s} \right] \in {\mathbb N}^2$
as
$$
\left[ {1 \leqslant i , j \leqslant s} \right]
 = \left[ {1 \leqslant i < j \leqslant s} \right] \cup \left[ {1 \leqslant i = j \leqslant s} \right]
 \cup \left[ {1 \leqslant i > j \leqslant s} \right]
$$
so that
$$
S = \sum\limits_{1 \leqslant i < j \leqslant s} {x_i x_j }
  = \sum\limits_{1 \leqslant i,j \leqslant s} {x_i x_j }  - \sum\limits_{1 \leqslant i = j \leqslant s} {x_i x_j }
  - \sum\limits_{1 \leqslant j < i \leqslant s} {x_i x_j } 
$$
or
$$
\eqalign{
  & 2S = \sum\limits_{1 \leqslant i,j \leqslant s} {x_i x_j }  - \sum\limits_{1 \leqslant i = j \leqslant s} {x_i x_j }
  = \sum\limits_{1 \leqslant i \leqslant s} {x_i \sum\limits_{1 \leqslant j \leqslant s} {x_j } }
  - \sum\limits_{1 \leqslant i \leqslant s} {x_i ^2 }  =   \cr 
  &  = \left( {\sum\limits_{1 \leqslant j \leqslant s} {x_j } } \right)^2
  - \sum\limits_{1 \leqslant i \leqslant s} {x_i ^2 }  \cr} 
$$
Can you take from here ?
