# What is the shape of the convex $n$ -gon which gives the maximum of a function?

Supposing that the length of every edge of the convex $n$-gon $P_1P_2$$\cdots$$P_n$ is 1, what is the shape of the $n$-gon which gives the maximum of the following function $B_n$? $$B_n=\sum_{1\le{i}\lt{j}\le{n}}|P_iP_j|^2$$

Here, $|P_iP_j|$ is the Euclidean length of the line segment from $P_i$ to $P_j$.

I've already proved that $B_5$ reaches the maximum only if the pentagon is a regular pentagon, but I don't have any good idea for $n\ge6$. I need your help.

This question (let's call this B) is related with the following question (let's call this A) which has been asked previously on mathoverflow without receiving any answers.

The question A: 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{∑_{i<j≤n} {∣P_iP_j ∣}^2 −∑_i^n∣P_iP_{i+1}∣^ 2}{∑_i^n∣P_iP_{i+1}∣^ 2}$$
Here, $∣P_iP_j∣$ 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?

I think I can prove that $A_5$ reaches the max only if the pentagon is a regular pentagon. Please judge whether my proof is correct or not. I use an transforming operation through which the value of $A_5$ doesn't change or increases. Here is the operation which consists of the following steps.

-