Inequality on a sequence of $n$ reals whose sum is $0$ 
Consider $n\geq3$ real numbers $a_1,a_2,\dots ,a_n$ satisfying $a_1+a_2+\cdots+a_n=0$ and $$2a_k \leq a_{k-1}+a_{k+1}$$ for all $2\leq k\leq n-1$.  Prove that $$|a_k|\leq\frac{n+1}{n-1}\,\max\big\{|a_{1}|,|a_{n}|\big\}$$ for all $2\leq k\leq n-1$. 

I'm not sure how to approach this problem. I have tried an inductive approach, but to no avail. 
 A: Let $j\in\{1,2,\ldots,n\}$ be such that $a_j$ is the smallest.  Ergo, for every $k\in\{1,2,\ldots,n\}$, we have
$$\left|a_k\right|\leq \max\big\{\left|a_1\right|,\left|a_j\right|,\left|a_n\right|\big\}\,.$$
For $k=1,2,\ldots,j$, we can see that $$a_k\leq \frac{j-k}{j-1}a_1+\frac{k-1}{j-1}a_j\,.$$  On the other hand, for $k=j,j+1,\ldots,n$, we obtain 
$$a_k\leq\frac{n-k}{n-j}a_j+\frac{k-j}{n-j}a_n\,.$$
Hence, $$\begin{align}
0=\sum_{k=1}^n\,a_k&=\left(\sum_{k=1}^{j}\,a_k\right)-a_j+\left(\sum_{k=j}^n\,a_k\right)
\\&\leq \left(\frac{j}{2}a_1+\frac{j}{2}a_j\right)-a_j+\left(\frac{n-j+1}{2}a_j+\frac{n-j+1}{2}a_n\right)\,.\end{align}$$
Therefore,
$$-a_j\leq \frac{j}{n-1}a_1+\frac{n-j+1}{n-1}a_n\,.$$
Since $a_j$ is negative, we have $-a_j=\left|a_j\right|$, whence
$$\left|a_j\right|\leq \frac{j}{n-1}a_1+\frac{n-j+1}{n-1}a_n\leq \frac{j}{n-1}\left|a_1\right|+\frac{n-j+1}{n-1}\left|a_n\right| \leq \frac{n+1}{n-1}\max\big\{\left|a_1\right|,\left|a_n\right|\big\}\,.$$
The equality holds if and only if there exists $t\geq 0$ and $j\in\{2,3,\ldots,n-1\}$ such that
$$a_k=\frac{j-k}{j-1}t-\frac{(k-1)(n+1)}{(j-1)(n-1)}t=\frac{j(n-1)+(n+1)-2kn}{(j-1)(n-1)}t$$
for each $k=1,2,\ldots,j$, and that
$$a_k=-\frac{(n-k)(n+1)}{(n-j)(n-1)}t+\frac{k-j}{n-j}t=\frac{2kn-n(n+1)-j(n-1)}{(n-j)(n-1)}t$$
for each $k=j+1,j+2,\ldots,n$.

Integral Analogue

Given $a,b\in\mathbb{R}$ with $a<b$ and a convex function $f:[a,b]\to\mathbb{R}$ satisfying $\displaystyle\int_a^b\,f(x)\,\text{d}x=0$, it holds that $$-\inf\Big\{f(x)\,\boldsymbol{\Big|}\,x\in[a,b]\Big\}\leq\max\Big\{\big|f(a)\big|,\big|f(b)\big|\Big\}\,.$$  The equality holds if and only if there exist $u\in\mathbb{R}_{\geq 0}$ and $\lambda\in[a,b]$ such that $$f(x)=\left\{\begin{array}{ll}\left(1-\frac{2(x-a)}{\lambda-a}\right)u\,,&\text{ if }a\leq x\leq \lambda\,,\\\left(1-\frac{2(b-x)}{b-\lambda}\right)u\,,&\text{ if }\lambda \leq x \leq b\,.\end{array}\right.$$

