TITLE: An exercise in the properties of Lebesgue integrals
QUESTION [5 upvotes]: Suppose $f$ is a real-valued function on $\mathbb{R}$ such that $f\left( {\int\limits_0^1 {g\left( x \right)d{\rm{x}}} } \right) \le \int\limits_0^1 {f\left( {g\left( x \right)} \right)d{\rm{x}}} $, whenever $g$ is bounded and measurable. Prove that $f$ is convex.
I am totally clueless about how to proceed with this. Help me please!

REPLY [14 votes]: Let $a<b$. For each $\lambda\in(0,1)$, define
$$g(x)=\begin{cases}a, &0\leq x\leq\lambda\\
b, &\lambda<x\leq 1\end{cases}.$$
Clearly $g$ is bounded and measurable. Furthermore we have
$$\int_0^1g(x)dx=\lambda a+(1-\lambda)b,$$
and
$$\int_0^1f(g(x))dx=\int_0^\lambda f(a)dx+\int_\lambda^1f(b)dx=\lambda f(a)+(1-\lambda)f(b).$$
Thus the result follows.