TITLE: prove this nice inequality $\left|\prod_{i=1}^{n}(a_{i}-a_{i+1})\right|\le \frac{3\sqrt{3}}{16}$
QUESTION [9 upvotes]: Let $n$ be odd number, and $a_{i}\ge 0$, such that
$$2(a_{1}+a_{2}+\cdots+a_{n})=n$$
Show that
$$\left|\prod_{i=1}^{n}(a_{i}-a_{i+1})\right|\le \frac{3\sqrt{3}}{16}$$
where $a_{n+1}=a_{1}$
Seeing this inequality reminds me to use this conclusion to deal with it.
$$S_{AOB}=\frac{1}{2}|a_{1}b_{2}-a_{2}b_{1}|$$
where $A(a_{1},b_{1}),B(a_{2},b_{2}),O(0,0)$
It seems that this problem will involve a problem of maximum geometric area, perhaps it can be handled this way

REPLY [5 votes]: The general strategy is to show that, without loss of generality, the $a_i$'s must be of a specified form.  If not, we could replace the $a_i$ by another sequence with the same sum but equal or larger cyclic product of absolute differences.  All of our replacements below are of this type.  [We include a running example in brackets.]
Then it will be enough to maximize that product over all sequences of the specified form.
[Ex: .85, .98, .18, .34, .21, .74, .92, .20, .08]
Wlog, the smallest $a_i$ is zero.  If not, let $b=\min(a_i)$.  We can replace one minimal $a_i$ with $0$, and replace each of the other $a_i$ by $a_i+\frac{b}{n-1}$.
[Ex: .86, .99, .19, .35, .22, .75, .93, .21, .00]
Wlog, any three consecutive $a_i$ include at least one zero.  If not, suppose that the $a_i$ contain the subsequence $0,b,c,d,e$ with $b,c,d$ positive.  Let $m$ be the average of $b,c,d$.

If $d>e$ and $d \ge m$, then we can replace $0,b,c,d$ by $0,b+c,0,d$.
If $d>e$ and $d \le m$, then we can replace $0,b,c,d$ by $0,2m,0,m$.
If $d<e$ and $d \ge c$, then we can replace $0,b,c,d$ by $0,b+c,0,d$.
If $d<e$ and $d \le c$, then we can replace $0,b,c,d$ by
$0,b+\frac{d}{2},c+\frac{d}{2},0$.

[Ex: .955, 1.085, .00, .35, .22, .75, .93, .21, .00]
[Ex: .955, 1.085, .00, .57, .00, .75, .21, .93, .00]
[Ex: .955, 1.085, .00, .57, .00, .96, .00, .93, .00]
Mathematica can verify quickly that these replacements increase the product:
f[x_, y_, z_] := Abs[x (y - x) (z - y)]
positive[s_] := {0 < b, 0 < c, 0 < d, m == (b + c + d)/3, s}
Simplify[f[b, c, d] <= f[b + c, 0, d], Assumptions -> positive[d > m]]
Simplify[f[b, c, d] <= f[2 m, 0, m], Assumptions -> positive[d < m]]
Simplify[f[b, c, d] <= f[b + c, 0, d], Assumptions -> positive[d > c]]
Simplify[f[b, c, d] <= f[b + d/2, c + d/2, 0], Assumptions -> positive[d < c]]

(WolframAlpha provides the same verifications here, here, here and here, by saying "no solutions exist" to a search for counterexamples; this uses a modern variant of Tarski's algorithm for determining when polynomials have solutions in the reals.) 
Wlog, any three consecutive $a_i$ include at least one zero; also there is at most one triplet in $a_i$ with signs $0,+,+$.  If not, and the triplets are not next to each other, we can replace the subsequence $0,a,b,\ldots,0,c,d,\ldots$ with its rearrangement $0,a,b,0,c,d,\ldots,\ldots$.  Then if we have the subsequence $0,b,c,0,d,e,0$, we can assume wlog that $b>c$ and $d>e$, and can replace the subsequence with $0,b,0,d,0,c+e,0$.   
[Ex: .955, 1.085, .00, .57, .00, .96, .00, .93, .00]
Wlog, any three consecutive $a_i$ include at least one zero; also, whenever zero is followed by a single positive number, it is always the same positive number.  If not, we can replace $0,b,0,c,0$ by $0,(b+c)/2,0,(b+c)/2,0$, and similarly with means of longer sequences.
[Ex: .955, 1.085, .00, .82, .00, .82, .00, .82, .00]
So wlog, the sequence is of the form $0,b,c,0,d,0,d,\ldots,0,d$ with $b>c$.
[Ex: .00, 1.085, .955, .00, .82, .00, .82, .00, .82]
The sum condition gives $d=(n-2b-2c)/(n-3)$.  This gives the product
$$b(b-c)c\left(\frac{n-2b-2c}{n-3}\right)^{n-3}$$
and we can maximize this by maximizing
$$\ln(b)+\ln(b-c)+\ln(c)+(n-3)\ln(n-2b-2c).$$
Setting partial derivatives equal to $0$ gives
$$\frac{1}{b}+\frac{1}{b-c}+\frac{-2(n-3)}{n-2b-2c}=0$$
$$\frac{-1}{b-c}+\frac{1}{c}+\frac{-2(n-3)}{n-2b-2c}=0$$
Solving with the constraint $b>c$, $n>0$, we get
$$b=\frac{3+\sqrt{3}}{4},\ c = \frac{3-\sqrt{3}}{4}$$
which leads to the maximal sequence
$$0, \frac{3+\sqrt{3}}{4},\frac{3-\sqrt{3}}{4},0,1,0,1,\ldots,0,1$$
and its cyclic product of absolute differences
$$\frac{3\sqrt{3}}{16}.$$