7. Find the maximum value of the expression

$$
\left(x_{1}-x_{2}\right)^{2}+\left(x_{2}-x_{3}\right)^{2}+\ldots+\left(x_{2010}-x_{2011}\right)^{2}+\left(x_{2011}-x_{1}\right)^{2}
$$

for $x_{1}, \ldots, x_{2011} \in[0 ; 1]$.

#
# Answer: 2010.

Let's prove this using mathematical induction for $2n+1$ numbers $x_{1}, \ldots, x_{2n+1} \in [0; 1]$. Specifically, we will show that the maximum value of the expression

$$
\left(x_{1}-x_{2}\right)^{2}+\left(x_{2}-x_{3}\right)^{2}+\ldots+\left(x_{2n}-x_{2n+1}\right)^{2}+\left(x_{2n+1}-x_{1}\right)^{2}
$$

for $x_{1}, \ldots, x_{2n+1} \in [0; 1]$ is $2n$.

First, note that for $x_{1}, \ldots, x_{2n+1} \in [0; 1]$, the following inequality always holds:

$$
\begin{aligned}
\left(x_{1}-x_{2}\right)^{2}+\left(x_{2}-x_{3}\right)^{2}+\ldots+\left(x_{2n}-x_{2n+1}\right)^{2}+\left(x_{2n+1}-x_{1}\right)^{2} \\
& \leqslant \left|x_{1}-x_{2}\right|+\left|x_{2}-x_{3}\right|+\ldots+\left|x_{2n}-x_{2n+1}\right|+\left|x_{2n+1}-x_{1}\right|
\end{aligned}
$$

1) Let's check that for any numbers $x, y, z$ such that $x, y, z \in [0; 1]$, the inequality

$$
|x-y|+|y-z|+|z-x| \leqslant 2
$$

holds, and there exist numbers $x, y, z \in [0; 1]$ such that $|x-y|+|y-z|+|z-x|=2$. Indeed, without loss of generality, assume that $0 \leqslant x \leqslant y \leqslant z$. Then

$$
|x-y|+|y-z|+|z-x|=y-x+z-y+z-x=2(z-x) \leqslant 2
$$

Equality is achieved, for example, if $x=y=0, z=1$.

2) Assume that for $2n-1$ numbers, the maximum value of the expression

$$
\left|x_{1}-x_{2}\right|+\left|x_{2}-x_{3}\right|+\ldots+\left|x_{2n-2}-x_{2n-1}\right|+\left|x_{2n-1}-x_{1}\right|
$$

is $2n-2$ for $x_{1}, \ldots, x_{2n-1} \in [0; 1]$.

3) Consider the expression for $2n+1$ numbers:

$$
\begin{gathered}
\left|x_{1}-x_{2}\right|+\left|x_{2}-x_{3}\right|+\ldots+\left|x_{2n-2}-x_{2n-1}\right|+\left|x_{2n-1}-x_{2n}\right|+\left|x_{2n}-x_{2n+1}\right|+\left|x_{2n+1}-x_{1}\right|= \\
=\underbrace{\left|x_{1}-x_{2}\right|+\left|x_{2}-x_{3}\right|+\ldots+\left|x_{2n-2}-x_{2n-1}\right|+\left|x_{2n-1}-x_{1}\right|}_{\leqslant 2n-2}-\left|x_{2n-1}-x_{1}\right|+\left|x_{2n-1}-x_{2n}\right|+ \\
+\left|x_{2n}-x_{2n+1}\right|+\left|x_{2n+1}-x_{1}\right| \leqslant 2n-2-\left|x_{2n-1}-x_{1}\right|+\underbrace{\left|x_{2n-1}-x_{2n}\right|+\left|x_{2n}-x_{2n+1}\right|+\left|x_{2n+1}-x_{2n-1}\right|}_{\leqslant 2}- \\
\quad-\left|x_{2n+1}-x_{2n-1}\right|+\left|x_{2n+1}-x_{1}\right|=2n+\left|x_{2n+1}-x_{1}\right|-\left|x_{2n-1}-x_{1}\right|-\left|x_{2n+1}-x_{2n-1}\right| \leqslant 2n
\end{gathered}
$$

since $\left|x_{2n+1}-x_{1}\right| \leqslant \left|x_{2n-1}-x_{1}\right|+\left|x_{2n+1}-x_{2n-1}\right|$.

The value $2n$ of the expression

$$
\left|x_{1}-x_{2}\right|+\left|x_{2}-x_{3}\right|+\ldots+\left|x_{2n-2}-x_{2n-1}\right|+\left|x_{2n-1}-x_{2n}\right|+\left|x_{2n}-x_{2n+1}\right|+\left|x_{2n+1}-x_{1}\right|
$$

is achieved, for example, when $x_{1}=x_{3}=\ldots=x_{2n-1}=x_{2n+1}=1, x_{2}=x_{4}=\ldots=x_{2n}=0$.

In particular,

$$
\left(x_{1}-x_{2}\right)^{2}+\left(x_{2}-x_{3}\right)^{2}+\ldots+\left(x_{2n}-x_{2n+1}\right)^{2}+\left(x_{2n+1}-x_{1}\right)^{2}=2010
$$

when $x_{1}=x_{3}=\ldots=x_{2011}=x_{2n+1}=1, x_{2}=x_{4}=\ldots=x_{2010}=0$.