# application of Fubini's Theorem

How could we use Fubini's theorem to prove $$\ E[Y-X] = \int_{X<Y} \int_{X< t< Y} dt dP - \int_{Y<X} \int_{Y< t< X} dt dP$$

-

These are the integrated versions of deterministic identities: for every real numbers $x$ and $y$, $$y-x=(y-x)^+-(x-y)^+,\qquad (y-x)^+=\mathbf 1_{x\lt y}\cdot\int_x^y\mathrm dt.$$ Thus, $$y-x=\mathbf 1_{x\lt y}\cdot\int_x^y\mathrm dt-\mathbf 1_{y\lt x}\cdot\int_y^x\mathrm dt,$$ which, integrated with respect to $\mathbb P_{(X,Y)}$, yields $$\mathbb E(Y-X)=\mathbb E\left(\mathbf 1_{X\lt Y}\cdot\int_X^Y\mathrm dt\right)-\mathbb E\left(\mathbf 1_{Y\lt X}\cdot\int_Y^X\mathrm dt\right).$$
Hint: Use that for a random variable $Z$, you have $E[Z] = \int_{\mathbb R} x \; dP_Z(x)$ Now split this integral in two $\int_0^\infty$ and $\int_{-\infty}^0$ and write $x = \int_0^x \, dt$ for the positive Part. That should get you started.