Recall that a function $f$ is said to be convex if, for any $x_{1}, x_{2}$ and for $0 \leq \lambda \leq 1$,
$$
f\left(\lambda x_{1}+(1-\lambda) x_{2}\right) \leq \lambda f\left(x_{1}\right)+(1-\lambda) f\left(x_{2}\right) .
$$
(a) Let $Z$ be a random variable that takes on a (finite) set of values in the interval $[0,1]$, and let $p=\mathbf{E}[Z]$. Define the Bernoulli random variable $X$ by $\operatorname{Pr}(X=1)=p$ and $\operatorname{Pr}(X=0)=1-p$. Show that $\mathbf{E}[f(Z)] \leq \mathbf{E}[f(X)]$ for any convex function $f$.
(b) Use the fact that $f(x)=\mathrm{e}^{t x}$ is convex for any $t \geq 0$ to obtain a Chernoff-like bound for $Z$ based on a Chernoff bound for $X$.