Problem. Let $\left(\Omega, \mathcal A, \Bbb{P} \right)$ be a probability space and $X,Y$ be real-valued random variables with finite expected value. Then $$E(Y)-E(X)= \int_\Bbb{R}\Bbb{P}(X<t\leq Y)-\Bbb{P}(Y<t\leq X)\, dt.$$
My attempt. This isn't much of an attempt, but I've written $$\int_\Bbb{R}\Bbb{P}(X<t\leq Y)-\Bbb{P}(Y<t\leq X)\, dt = \int_\Bbb{R} E\left(\mathbf 1\{X<t\leq Y\}-\mathbf 1\{Y<t\leq X\} \right) dt$$ Can we interchange integration and $E$? How could we proceed?