TITLE: $X<Y$ implies $E[X]<E[Y]$?
QUESTION [5 upvotes]: I just read a proof in a text that first established that
$$(X-\mu_X)(Y-\mu_Y)\le \frac12\left[(X-\mu_X)^2+(Y-\mu_Y)^2\right]$$
then took the expectation of both sides of the inequality.
$$E[(X-\mu_X)(Y-\mu_Y)]\le \frac12E\left[(X-\mu_X)^2+(Y-\mu_Y)^2\right]$$
How is taking the expectation of both sides of the inequality justified?

REPLY [6 votes]: It is known that $\mathbb{E}[X]\leq \mathbb{E}[Y]$. This comes from the definition of expected value on a probability space $(S, \mathcal{G}, P)$ as
$$
\mathbb{E}[X] = \int_{S}XdP,
$$
where the integral is the Lebesgue integral. This property can be verified using the definition of the Lebesgue integral.
Now in your question you have also asked whether $X<Y$ (almost surely) implies $\mathbb{E}[X]<\mathbb{E}[Y]$ (with $<$ instead of $\leq$). This is also true: Suppose that $X<Y$ and $\mathbb{E}[X]=\mathbb{E}[Y]$. Define a random variable $T=Y-X$; this is nonnegative and 
$$
0\leq \mathbb{E}[T]=0.
$$
As a result, $T=0$ a.e., therefore, $X=Y$ a.e., which is a contradiction (we have used the fact that for any nonnegative random variable $T$, $\mathbb{E}[T]=0$ implies that $T=0$ a.s.).