Let $X$ and $Y$ be i.i.d. random variables with Uniform $(0, 1)$ continuous distribution.
The problem is to find the expected value of the distance between X and Y.
My reasoning was, for all $(x, y) \in X \times Y$, any distance must be $0 \le |x - y| \le 1$, so we can consider two cases, $0 \le y - x \le 1$ and $0 \le x - y \le 1$.
So to find the expectated value of the distance, I would take the sum of the two integrals,
$ \int_0^1 \int_{y-1}^1 (y - x) \; dx \; dy $
$ \int_0^1 \int_{x-1}^1 (x- y) \; dy \; dx $
The first and second integrals each give $1/3$, so the answer I reached is $2/3$, whereas the correct answer for expected distance is $1/3$ and uses integrals over different limits of integration. I know what the correct answer says, but where am I going wrong here?