I have to solve this exercise and I have no idea how to do it... Help is highly appreciated.
We make the following experiment: we ask 2 persons to write one real number from [0, 5] each on a paper, and then we calculate the distance between these numbers. We assume that people choose numbers uniformly from that interval, and also that the choices are independent. If we will repeat this experiment many times, independently asking each time 2 persons, and if we will calculate then the average of the calculated distances, what will be the approximate value of that average?
Let the random variables be $X$ and $Y$. Note that $\mathbb{E}(\min \{X, Y \}) = \frac{5}{3}$, and $\mathbb{E}(\max \{X, Y \}) = \frac{10}{3}$. So the average distance is $\frac{5}{3}$.
Another approach: I will replace $5$ with $1$; we will just multiply $5$ at the end. Suppose person 1 chooses $x$. Then there is a probability $x$ of person 2 choosing between 0 and $x$, with expected distance $\frac{x}{2}.$ The probability of choosing above $x$ is $1-x$ with average distance $\frac{1-x}{2}.$ So the average distance for a given $x$ is $\frac{x^2+(1-x)^2}{2} = x(x-1)+\frac{1}{2}$. Integrating from $0$ to $1$ gives a final value of $\frac{1}{3}$, and multiplying back the $5$ gives $\frac{5}{3}$ as an average.
Another approach; we integrate the probability:
\begin{align} &\int_0^5\int_0^5|x-y|\,dx\,dy\\ =&\int_0^5\left[\int_0^y(y-x)dx+\int_y^5(x-y)dx\right]dy\\ =&\int_0^5\left[\left[xy-\frac{1}{2}x^2\right]_0^y+\left[\frac{1}{2}x^2-xy\right]_y^5\right]dy\\ =&\int_0^5\frac{1}{2}y^2+\frac{25}{2}-\frac{1}{2}y^2-5y+y^2dy\\ =&\left[\frac{25}{2}y-\frac{5}{2}y^2+\frac{y^3}{3}\right]_0^5\\ =&\frac{125}{3} \end{align}
Put this over $25$ (the area of the region we integrated over) to arrive at $\frac{5}{3}$ as the final answer.