I am looking for a proof of weighted version of the 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$

$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$

Let $\lambda_i >0$ and $\sum_1^{n} \lambda_i =1$

Then show that:

$$\lambda_1f(x_1)+\lambda_2f(x_2)+...+\lambda_nf(x_n)-f(\lambda_1x_1+\lambda_2x_2+...+\lambda_nx_n) \ge \lambda_1f(y_1)+\lambda_2f(y_2)+...+\lambda_nf(y_n)-f(\lambda_1y_1+\lambda_2y_2+...+\lambda_ny_n) $$

The inequality holds with equality if and only if $x_i=y_i$ for all $i \in {1, 2,...,n}$

**Remark:**

If $\lambda_1x_1+\lambda_2x_2+....+\lambda_nx_n=\lambda_1y_1+\lambda_2y_2+....+\lambda_ny_n$

Then we have **the weighted version of the Karamata inequality**:

$ \lambda_1f(x_1)+\lambda_2f(x_2)+...+\lambda_nf(x_n) \ge \lambda_1f(y_1)+\lambda_2f(y_2)+...+\lambda_nf(y_n) $