I recently came across this problem while toying with the problem of the average distance between 2 points in the unit square. These two points also define a rectangle, so I was wondering: What is the expected value of the area of that rectangle?
I took this problem to Python and it turns out to be somewhere around one-ninth. However, I have no idea where to start actually calculating the exact value. If someone could share how to get a more exact answer (more efficiently, obviously) via computer science, or how to get the precise answer with calculus, that would help out a bunch.
The expected area is exactly $\frac19$.
In principle we could compute it via the integral $$ \int_0^1 \int_0^1 \int_0^1 \int_0^1 |x_1 - x_2| \cdot |y_1 - y_2| \,dx_1\,dy_1\,dx_2\,dy_2 $$ but there is an easier way. Given two points $(x_1,y_1)$ and $(x_2,y_2)$, the four lines $x=x_1, x=x_2, y=y_1, y=y_2$ divide the square into $9$ pieces, and we show that the expected areas of those pieces are all equal.
It's enough to show that the distances $\min\{x_1,x_2\}$, $|x_2 - x_1|$, and $1 - \max\{x_1,x_2\}$ are all equal in expectation (and so they are all $\frac13$). By symmetry, the same is true for the $y$-distances, and the areas are just products of independent variables, so the products will all be $\frac19$ in expectation.
To see that the distances are all equal, we show that:
By symmetry, it doesn't matter if we condition on $x_1 \le x_2$ or $x_1 > x_2$, and by transitivity we get that all three distances are equal in expectation for both cases.