A conjecture generalization of Karamata inequality Fist I observe function $f(x)=x^2$ in the figure as following

I found that when $x_1 \ge y_1$ and $x_2 \le y_2$     $\Rightarrow$ $AB \ge CD$ 
$\Rightarrow$  $$\frac{f(x_1)+f(x_2)}{2}-f(\frac{x_1+x_2}{2}) \ge \frac{f(y_1)+f(y_2)}{2}-f(\frac{y_1+y_2}{2})$$ (1).
Note that: When $x_1+x_2=y_1+y_2$  the inequality (1) is Karamata inequality (with case n=2)
$$f(x_1)+f(x_2) \ge f(y_1)+f(y_2)$$ 

From above observation, I am looking for a proof of a conjecture generalization of Karamata inequality as following:

Let $I$ be an interval of the real line and let $f$ denote a real-valued, convex function defined on $I$. If $x_1, . . . , x_n$ and $y_1, . . . , y_n$ are numbers in $I$ such that:


*

*$x_1 \ge x_2 \ge x_3...\ge x_n,$ and $y_1 \ge y_2 \ge y_3...\ge y_n$


2.x_1+x_2+...+x_i \ge y_1+y_2+...+y_i for i=1,...,n-1 and 
3. x_n \le y_n 
2'. $x_1+...+x_i \ge y_1+...+y_i$ and $x_{i+1}+...+x_n \le y_{i+1}+...+y_n$ for $i=1,...,n-1$ then 
$$\frac{f(x_1)+f(x_2)+...+f(x_n)}{n}-f(\frac{x_1+x_2+...+x_n}{n}) \ge \frac{f(y_1)+f(y_2)+...+f(y_n)}{n}-f(\frac{y_1+y_2+...+y_n}{n}) $$
The inequality holds with equality if and only if $x_i=y_i$ for all $i \in {1, 2,...,n}$
 A: *

*Conditions (1,2,3) are not enough for the inequality to hold. Take $n=3$, $x_1=x_2=3,x_3=0$, $y_1=3,y_2=y_3=0$. Then we need the multiset $(3,3,0,1,1,1)$ (all three $x$'s and 3 times mean of $y$'s) to majorate $(3,0,0,2,2,2)$. But four largest elements of the first multiset have sum $3+3+1+1=8$, while in the second it is $3+2+2+2=9$. So, the claim does not hold in full generality. To be more explicit, we get an opposite inequality for $f(x)=\max(x-2,0)$.

*Conditions (1) and
(2') $x_1+...+x_i \geqslant y_1+.....+y_i$ and $x_{i+1}+...+x_n \leqslant y_{i+1}+...+y_n$ for $i=1,....,n-1$
are enough. We prove it by verifying that the multiset of $2n$ numbers $A:=\{x_1,\dots,x_n,y,y,\dots,y\}$ majorates the multiset $B:=\{y_1,\dots,y_n,x,x,\dots,x\}$, where $x=\frac1n \sum x_i$, $y=\frac1n \sum y_i$. Without loss of generality $x\leqslant y$, else change signs of all $x$'s and $y$'s. We have to check that the sum $w_m$ of $m$ largest elements of $B$ does not exceed the sum of $m$ largest elements of $A$. Let $m$ largest elements of $B$ be $y_1,\dots,y_s$ and $(m-s)$ times $x$. Consider two cases.
1-st case. $s\leqslant n-1$. Then $w_m=y_1+\dots+y_s+(m-s)x\leqslant x_1+\dots+x_s+(m-s)y$.
2-nd case. $s=n$. Then $w_m=y_1+\dots+y_n+(m-n)x\leqslant n\cdot y+x_1+\dots+x_{m-n}$.
In both cases we found $m$ elements of $A$ with a sum at least $w_m$, as desired.
A: *

*I prove that the inequality (1) is hold with $x_1 \ge y_1$ and $y_2 \ge x_2$ as followings:


$$y(x)=\frac{f(x)+f(x_2)}{2}-f(\frac{x+x_2}{2})- \frac{f(y_1)+f(y_2)}{2}+f(\frac{y_1+y_2}{2})$$
$$y'=\frac{f'(x)}{2}-\frac{1}{2}f'(\frac{x+x_2}{2})$$
Because $f'' \ge 0$ so $y'(x) \ge y'(x_2)=0$ because $x \ge x_2$, because $x_1 \ge y_1$ so $y(x_1) \ge y(y_1)$, therefor
$$y(x_1) \ge y(y_1)=\frac{f(y_1)+f(x_2)}{2}-f(\frac{y_1+x_2}{2})- \frac{f(y_1)+f(y_2)}{2}+f(\frac{y_1+y_2}{2})=\frac{f(x_2)}{2}-f(\frac{y_1+x_2}{2})- \frac{f(y_2)}{2}+f(\frac{y_1+y_2}{2})  $$
Let $$g(t)=\frac{f(x_2)}{2}-f(\frac{t+x_2}{2})- \frac{f(y_2)}{2}+f(\frac{t+y_2}{2})  $$ with $t \ge y_2$, we have:
$$g'(t)=-\frac{1}{2}f'(\frac{t+x_2}{2})+\frac{1}{2}f'(\frac{t+y_2}{2})  $$
Because $f'' \ge 0$ and $y_2 \ge x_2$ so $g'(t) \ge 0$ so 
$g(y_1) \ge g(y_2)=\frac{f(x_2)}{2}-f(\frac{y_2+x_2}{2})- \frac{f(y_2)}{2}+f(\frac{y_2+y_2}{2})=\frac{f(x_2)+f(y_2)}{2}-f(\frac{y_2+x_2}{2}) \ge 0$ because $f'' \ge 0$


*Remark with the same proof, I can prove the inequality (1) with weights $\lambda_i$ holds.


Let $x_1 \ge y_1$ and $x_2 \le y_2$, $\lambda_i >0 $ and $\lambda_1+\lambda_2=1$ we have:
$$\lambda_1f(x_1)+\lambda_2f(x_2)-f(\lambda_1x_1+\lambda_2x_2) \ge \lambda_1f(y_1)+\lambda_2f(y_2)-f(\lambda_1y_1+\lambda_2y_2)$$ (2)


*Now let $I$ be an interval of the real line and let $f$ denote a real-valued, convex function defined on $I$. If $x_1, . . . , x_n$ and $y_1, . . . , y_n$ are numbers in $I$ such that:


(i). $x_1 \ge x_2 \ge x_3...\ge x_n,$ and $y_1 \ge y_2 \ge y_3...\ge y_n$
(ii). $x_1+...+x_i \ge y_1+...+y_i$ and $x_{i+1}+...+x_n \le y_{i+1}+...+y_n$ for $i=1,...,n-1$
$$\frac{f(x_1)+f(x_2)+...+f(x_n)}{n}-f(\frac{x_1+x_2+...+x_n}{n}) \ge \frac{f(y_1)+f(y_2)+...+f(y_n)}{n}-f(\frac{y_1+y_2+...+y_n}{n}) $$
The inequality holds with equality if and only if $x_i=y_i$ for all $i \in {1, 2,...,n}$
