Maximizing the pairwise point distance in $[-1,1]$

averagecombinatoricseuclidean-geometrygeometryoptimization

How can we prove that, given $n$ points in $[-1,1]$, the sum of all their pairwise Euclidean distances (or, equivalently, their average Euclidean distance) is maximized if $\lfloor n/2 \rfloor$ points are placed at $-1$ and the remaining points are placed at $1$?

Best Answer

WLOG assume $-1 \leqslant x_1 \leqslant x_2 \leqslant \cdots \leqslant x_n \leqslant 1$.

Total distance is $$ \sum_{i<j} (x_j-x_i) = [0-(n-1)]x_1+[1-(n-2)]x_2-\cdots + [(n-1)-0]x_n\\ =-(n-1)x_1-(n-3)x_2 - \cdots +(n-1)x_n\\ \leqslant -(n-1)(-1)-(n-3)(-1) - \cdots + (n-1)\cdot 1. $$

$"=" \iff x_1=x_2=\cdots =x_{\lceil\frac{n-1}{2}\rceil}=-1, x_{\lfloor\frac{n+3}{2}\rfloor}=\cdots=x_n=1.$

If $n$ is odd then $x_{\frac{n+1}{2}}$ can be anywhere between -1 and 1.