I don't understand how to algebraically approach expected value problems that include absolute values. Let's take a very simple example:
Find $E(|X_1 - X_2|)$, where $X1, X2$ ~ $U(0,1)$ and are independent.
I understand that I should split these up into two cases, where $X_1 < X_2$ and where $X_1 > X_2$, and then compute something like
$ \int_{0}^{1}(1 - P(|X_1-X_2| > z))dz$
How do I split those cases up in a context like this?
Hint: Just start from first principles: $$ \mathbb{E}\left[\left|X_{1}-X_{2}\right|\right] =\int_{0}^{1}\int_{0}^{1}\left|x_{1}-x_{2}\right|dx_{2}dx_{1} =\int_{0}^{1}\left(\int_{0}^{x_{1}}x_{1}-x_{2}dx_{2}+\int_{x_{1}}^{1}x_{2}-x_{1}dx_{2}\right)dx_{1}. $$