it's convex sequence inequality A sequence $a_0,a_1,\dots,a_n$ of real numbers is called concave if $a_{0}=0$, and for each $0<i<n$, we have $a_i\geq\dfrac{a_{i-1}+a_{i+1}}{2}$.
Find the largest $c(n)$ such that for every concave sequence $a_0,a_1,\dots,a_n$ of non-negative real numbers, we have
$$c(n)\sum_{i=1}^{n}a^2_{i}\le \left(\sum_{i=1}^{n}a_{i}\right)^2 .$$
I know $c(n)=\dfrac{n-1}{2}$ is well Khinchine inequality. But is it the best $c(n)$?
 A: $\newcommand{\R}{\mathbb{R}}$
The constant $c(n)$ can be improved from $\frac{n-1}2$ to the optimal value
\begin{equation}
 c_*(n):=\frac{3n(n-1)}{2(2n-1)}
\end{equation}
for $n\ge2$. 
Indeed, for $i\in[n]:=\{1,\dots,n\}$, let 
\begin{equation}
 g_i:=a_i-a_{i-1},\quad h_i:=\frac12\,(g_i-g_{i-1})=\frac12\,(a_i-2a_{i-1}+a_{i-2}),
\end{equation}
with $a_{-1}:=0=a_0$. Then for $j,k$ in $[n]$
\begin{equation}
 g_j=2\sum_{i=1}^jh_i,
\end{equation}
\begin{equation}
 a_k=\sum_{j=1}^kg_j=2\sum_{j=1}^k\sum_{i=1}^jh_i
 =2\sum_{i=1}^k h_i \sum_{j=i}^k 1=2\sum_{i=1}^k h_i (k-i+1), 
\end{equation}
\begin{equation}
 \sum_{k=1}^n a_k=2\sum_{k=1}^n \sum_{i=1}^k h_i (k-i+1)
 =2\sum_{i=1}^n h_i\sum_{k=i}^n(k-i+1)=
 \sum_{i=1}^n h_i (n-i+2)(n-i+1)=:A_1. 
\end{equation}
Note that $h_1=a_1/2\ge0$ and $h_i\le0$ for $i=2,\dots,n$. So, 
the best constant $c_*(n)$ is the reciprocal of the maximum of $\sum_{k=1}^n a_k^2$ given the conditions that $A_1=1$, $h_1\ge0\ge h_i$ for $i=2,\dots,n$, and $0\le a_n/2=\sum_{i=1}^k h_i (k-i+1)$. These conditions on $(h_1,\dots,h_n)$ define a polytope $\Pi$ in $\R^n$. It is easy to see that for any extreme point $(h_1,\dots,h_n)$ of $\Pi$ at most two of the $h_i$'s can be nonzero. If $0=h_1[=a_1]$, then by the concavity of the $a_i$'s and condition $a_0=0$, we have $a_i\le0$ for all $i$, which contradicts the condition $\sum_{k=1}^n a_k=A_1=1$. So, $h_1>0$ and no more than one of $h_2,\dots,h_n$ is nonzero, so that for some $j\in\{2,\dots,n\}$, some real $c\ge0$, and all $i=2,\dots,n$
\begin{equation}
 h_i=-c_j1_{\{i=j\}}.  
\end{equation}
Solving now the equation $A_1=1$ for $c$, we get 
\begin{equation}
 c=c_j:=\frac{h_1 n(n+1)-2}{(n-j+2)(n-j+1)}. 
\end{equation}
With $c=c_j$, we have 
\begin{equation}
 a_n=\frac{2-h_1 n(j-1)}{n-j+2}. 
\end{equation}
So, the conditions $c\ge0$ and $a_n\ge0$ now become 
\begin{equation}
 \frac2{n(n+1)}\le h_1\le\frac2{n(j-1)}. 
\end{equation}
Given this condition on $h_1$ and the condition $2\le j\le n$, we can maximize in $j,h_1$ the expression of  $\sum_{k=1}^n a_k^2$, which is algebraic in $n,j,h_1$. The maximum is indeed $\frac{2(2n-1)}{3n(n-1)}=1/c_*(n)$, attained at $j=2$ and $h_1=2/n$. Details of this latter maximization can be seen in the Mathematica notebook or its pdf image. 
