Let $X \sim U(0, 1)$ and $Y \sim U(0, 2)$ be independent random variables. What's the expected value of $|X – Y|$? I found $f_{X}(x) = 1$ and $f_{Y} = \frac{1}{2}$ so that $f_{XY}(x, y) = \frac{1}{2}$ and
$$\mathbb{E}[|x – y|] = \int_{0}^{1} \int_{0}^{2} \frac{|x – y|}{2} \mathop{dy} \mathop{dx},$$
but how can I compute this quantity? It looks tricky. I know the trick where you split the integral in the one-dimensional case, but I'm having trouble getting it in the two-dimensional case.
Best Answer
$$\int_{x=0}^1 \int_{y=0}^2 \frac{|x-y|}{2} \, dy \, dx = \int_{x=0}^1 \left( \int_{y=0}^x \frac{x-y}{2} \, dy + \int_{y=x}^2 \frac{y-x}{2} \, dy \right) \, dx.$$