What is the shape of the $n$-gon $P\_1P\_2\cdots P\_n$ which gives the maximum of $A\_n$? The quantity $A\_n$ is defined by
$$ A\_n = \frac{{\sum\_{i\lt{j}\le{n}}{\lvert P\_i P\_j\rvert}^2}-{\sum\_{i=1}^{n}{\lvert P\_i P\_{i+1}\rvert}^2}}{{\sum\_{i=1}^{n}{\lvert P\_i P\_{i+1}\rvert}^2}} $$
Here, $\lvert P\_i P\_j \rvert$ is the Euclidean length of the line segment from $P\_i$ to $P\_j$. Note that $P\_{n+1}=P\_1$ and that the $n$-gon can be either convex or concave.


I'm interested in $A\_n$ because I knew the fact that the maximum of $A\_4$ is $1$ only if $P\_1P\_2P\_3P\_4$ is a parallelogram. I've already proved the case $n=4$, but I don't have any good idea for $n\ge5$.


Could you tell me how to solve this problem?



What is the shape of the $n$-gon which gives the maximum of a function?
The optimal shape is the regular $n$-gon and all its affine images.


I am going to optimize the ratio
$$
 \frac{\sum\_{i<j} |P\_iP\_j|^2}{\sum\_i|P\_iP\_{i+1}|^2}
$$
which differs from $A\_n$ by 1. For the regular $n$-gon this ratio equals
$$
 \frac{n}{2(1-\cos\frac{2\pi}n)} .
$$
Let us prove that this is the maximum.


The maximum ratio equals the maximum $\lambda\in\mathbb R$ such that the quadratic form
$$
 P\mapsto Q\_\lambda(P) := \sum |P\_iP\_j|^2-\lambda\sum|P\_iP\_{i+1}|^2
$$
is nonnegative definite. Here $P$ denotes a polygon $P\_1\dots P\_n$ regarded as a point in $\mathbb R^{2n}$, so $Q\_\lambda$ is a quadratic form in $\mathbb R^{2n}$. If $\lambda$ is the maximum and $P$ is an optimal polygon, then $Q\_\lambda(P)=0$.


By the Pythagorean theorem, the coordinate expression for $Q\_\lambda(P)$ splits into 2 independent summands: one for $x$-coordinates of the vertices and a similar one for $y$-coordinates. Since the form is nonnegative on all configurations of points, it is also nonnegative on the projections to $x$- and $y$-lines, and both summands must be zero separately.


Thus we have reduced the problem to the 1-dimensional case. It remains to solve the similar problem for the from $Q\_\lambda$ in $\mathbb R^n$:
$$
 Q\_\lambda(x) = \sum (x\_i-x\_j)^2-\lambda\sum(x\_i-x\_{i+1})^2
$$
where $x=(x\_1,\dots,x\_n)\in\mathbb R^n$. By the way, this reduction also shows that, whatever the optimal shape is, it comes with all its affine images.


Now assume that $\lambda$ is the maximum ratio and $x=(x\_i)$ is an optimal configuration on the line. Differentiating $Q\_\lambda(x)$ with respect to $x\_i$ yields
$$
 2n(x\_i-a) -2\lambda(2x\_i-x\_{i-1}-x\_{i+1})
$$
where $a$ is the arithmetic mean of $x\_1,\dots,x\_n$. The derivative must be zero, and by translation we may assume that $a=0$. This gives us a linear recurrence equation
$$
 x\_{i+1}=-x\_{i-1}+(\tfrac{n}{\lambda}-2)x\_i .
$$
The solution must be $n$-periodic, so it is a linear combination of two geometric progressions whose ratios are two conjugate $n$th roots of unity. In other words, we have
$$
 x\_k = A \cos k\varphi + B\sin k\varphi
$$
for some real constants $A$ and $B$, where $\varphi$ is a multiple of $\frac{2\pi}n$. (Notation $i$ is changed to $k$ to prevent confusion with complex numbers.) Then
$$
 \lambda = \frac{n}{2(1-\cos\varphi)} .
$$
Checking the condition $Q\_\lambda(x)=0$ leaves the only possibility $\varphi=\frac{2\pi}n$ (for larger multiples, the quantity is strictly positive).


Thus the maximum ratio equals $\frac{n}{2(1-\cos\frac{2\pi}n)}$ and the optimal polygons are those whose $x$- and $y$-coordinates are sequences of the above form. These are precisely affine images of a regular $n$-gon. The solution is the same in all dimensions, not only in the plane.


