Example 4.2.3. Let $x_{1}, x_{2}, \ldots, x_{2005}$ be real numbers belonging to $[-1,1]$. Find the minimum value for the following expression
$$P=x_{1} x_{2}+x_{2} x_{3}+\ldots+x_{2004} x_{2005}+x_{2005} x_{1}$$
Solution. Because this inequality is cyclic, not symmetric, we cannot order variables as. If we rely on the relation $\left(x_{i}-1\right)\left(x_{i}+1\right) \leq 0$, we won't succeed either.

By intuition, we feel that the expression will attain its maximum if in the sequence $\left(x_{1}, x_{2}, \ldots, x_{2005}\right), 1$ and -1 alternate. In this case
$$P=1 \cdot(-1)+(-1) \cdot 1+\ldots+(-1) \cdot 1+1 \cdot 1=-2003$$

An accurate proof of this conjecture is not so obvious. Although the following solution is simple, it's really hard if you don't have some knowledge of convex functions is never generated in your mind.

First, we notice that if $x \in[p, q]$ then each linear function $f(x)=a x+b$ or quadratic function $f(x)=x^{2}+a x+b$ has the following important property
$$\max _{x \in[p, q]} f(x)=\max \{f(p), f(q)\}$$

A linear function satisfies another condition
$$\min _{x \in[p, q]} f(x)=\min \{f(p), f(q)\}$$

Notice that $P=P\left(x_{1}\right)$ is a linear function of $x_{1}$, therefore, according to properties of linear functions, $P$ can attain the minimum if only if $x_{1} \in\{-1,1\}$. Similarly, for the other variables, we deduce that $P$ attains the minimum if and only if $x_{k} \in\{-1,1\}$ for each $k=1,2, \ldots, 2005$. In this case, we will prove that $P \geq-2003$. Indeed, there must be at least one index $k(k \in \mathbb{N}, 1 \leq k \leq 2005)$ for which $x_{k} x_{k+1} \geq 0$. That implies $x_{k} x_{k+1}=1$ and therefore $\sum_{k=1}^{n} x_{i} x_{i+1} \geq-2003$