TITLE: Jensen's inequality and Averaging of Coefficients
QUESTION [7 upvotes]: I am using Jensen's inequality and conditional expectation to prove the following inequality: 
Let $\lambda_i$ be real for $i\in \{1,2,...,M\}$ and $\bar{\lambda}=\frac{\sum_{i=1}^M\lambda_i}{M}$. Let $X_i$, $i\in \{1,2,...,M\}$ be a set of real i.i.d random variables, then we have
\begin{align}
\mathbb{E}\left(f\left(\sum_{i=1}^M \bar{\lambda} X_i\right)\right) \le \mathbb{E}\left(f\left(\sum_{i=1}^M \lambda_i X_i\right)\right),
\end{align}
where $f(\cdot)$ is a convex function. The equal sign holds when $\lambda_{i}=\bar{\lambda}$ for all $i\in \{1,2,...,M\}$.
And my proof is given as:
Let
\begin{align}
X=\sum_{i=1}^M\bar{\lambda}X_i,
\end{align}
\begin{align}
W=\sum_{i=1}^M\lambda_iX_i,
\end{align}
and
\begin{align}
Z=X-W.
\end{align}
By the symmetric property of $X$, the conditional random variables $X_i|X$, $i\in \{1,...,M\}$, are identically distributed, which implies
\begin{align}
\mathbb{E}(X_1|X)=\mathbb{E}(X_2|X)= \cdots = \mathbb{E}(X_M|X).
\end{align}
Therefore
\begin{align}
\mathbb{E}(Z|X)&=\sum_{i=1}^M \bar{\lambda}\mathbb{E}(X_i|X)-\sum_{i=1}^M \lambda_{i}\mathbb{E}(X_i|X)\\
      &=\mathbb{E}(X_1|X)\left(\sum_{i=1}^M \bar{\lambda}-\sum_{i=1}^M \lambda_{i}\right)=0.
\end{align}
Since $f(\cdot)$ is convex, by Jensen's inequality we have
\begin{align}
\mathbb{E}(f(X-Z)|X)
&\ge f(\mathbb{E}((X-Z)|X)) \\
&=f(X-0)=f(X)
\end{align}
Therefore
\begin{align}
\mathbb{E}(f(W))=\mathbb{E}(\mathbb{E}(f(X-Z)|X))\ge \mathbb{E}(f(X)).
\end{align}
I think the proof is right, but not 100% sure, can someone give me a judgement of this proof?
Thanks!

REPLY [4 votes]: It looks all right to me.
(I would love to found some small error, or to have some improvement to suggest, or -damn- anything interesting to say so that the MSE system allows me to post this as answer without violating the "more than 30 characters" rule [well, that's done] and so that the downvoters deem this as a valid answer - but so is life. The question body is completely correct, and this answer is also  - especially when one disregards this paragraph)