What is $E|X-Y|$ when $X$, $Y$ are i.i.d and uniform on $[0,1]$?
I want to do something like
$$ E(|X-Y|)=\iint_{x>y}(x-y)\;dxdy+\iint_{y>x}(y-x)\;dxdy=2\iint_{x>y} (x-y)\;dxdy $$
But am not sure how to solve that last double integral or if this setup is right.
Indeed, the expectation by symmetry is just
\begin{align} \mathbb E[|X-Y|]&=\mathbb E[(X-Y)1_{X>Y}]+\mathbb E[(Y-X)1_{Y>X}] \\&=2\,\mathbb E[(X-Y)1_{X>Y}] \\&=2\iint (x-y)1_{0<y<x<1}\,\mathrm{d}x\,\mathrm{d}y \\&=2\int_0^1\int_y^1 (x-y)\,\mathrm{d}x\,\mathrm{d}y \\&=\frac13 \end{align}