## Task A-2.2.

Each of the numbers $x_{1}, x_{2}, \ldots, x_{2014}$ can be $-1, 0$ or 1. What is the smallest possible value of the sum of all products $x_{i} x_{j}$ for $1 \leqslant i<j \leqslant 2014$?
## First Solution.

Notice that twice the sum of all products $x_{i} x_{j}$ for $1 \leqslant i<j \leqslant 2014$ can be written as

$$
\left(x_{1}+\cdots+x_{2014}\right)^{2}-\left(x_{1}^{2}+\cdots+x_{2014}^{2}\right)
$$

Let $A=\left(x_{1}+\cdots+x_{2014}\right)^{2}$ and $B=x_{1}^{2}+\cdots+x_{2014}^{2}$.

We want to minimize $A$ and maximize $B$.

The number $A$ is the square of a real number, so $A \geqslant 0$. The minimum $A=0$ is achieved when there is an equal number of 1 and -1 among the numbers $x_{i}$, for example, when $x_{1}=x_{2}=\cdots=x_{1007}=1$, and $x_{1008}=x_{1009}=\cdots=x_{2014}=-1$. For the number $B$, we have $B=x_{1}^{2}+\cdots+x_{2014}^{2} \leqslant 1^{2}+1^{2}+\cdots+1^{2}=2014$. The maximum value $B=2014$ is achieved if no $x_{i}$ is 0, for example, when $x_{1}=x_{2}=\cdots=x_{1007}=1$, and $x_{1008}=x_{1009}=\cdots=x_{2014}=-1$.

Since the smallest value of $A$ and the largest value of $B$ can be achieved for the same values of $x_{1}, \ldots, x_{2014}$, it follows that the smallest possible value of the sum of all products $x_{i} x_{j}$ for $1 \leqslant i<j \leqslant 2014$ is $\frac{A-B}{2}=-1007$.