TITLE: Average distance between two points on a unit square.
QUESTION [6 upvotes]: Consider the unit square $S =[0,1]\times[0,1]$.  I'm interested in the average distance between random points in the square.
Let $ \mathbf{a} = \left< x_1,y_1 \right>$ and  $ \mathbf{b} = \left< x_2,y_2 \right>$ be random points in the unit square.  By random, I mean that $x_i$ and $y_i$ are uniformly distributed on $[0,1]$.
The normal approach is to use multiple integration to determine the average value of the distance between $\mathbf{b}$ and $\mathbf{a}$.  I would like to try another approach.
$\mathbf{a}$ and $\mathbf{b}$ are random vectors, and each element has known distribution. So, the vector between them also has known distribution.  The difference between two uniformly random variables has triangular distribution.  
So $\mathbf{c} = \mathbf{b} - \mathbf{a}$.  Then, the average distance is the expectation of $\lVert \mathbf{c} \rVert$.  Perhaps it would be easier to calculate the expectation of $\lVert \mathbf{c} \rVert^2$.
In any case, I am not sure how to calculate the expectation for $\lVert \mathbf{c} \rVert^2$.
Can someone guide me in the right direction?

REPLY [3 votes]: This has very little to do with linear algebra. The average distance is given by the integral:
$$ I = \int_{(0,1)^4}\sqrt{(x-X)^2+(y-Y)^2}\,d\mu.$$
Given $x$ and $X$, uniformly distributed and independent over $[0,1]$, the probability density function of $(x-X)^2$ is supported on $[0,1]$ and given by $-1+\frac{1}{\sqrt{t}}$. It follows that the PDF of $(x-X)^2+(y-Y)^2$ is supported on $[0,2]$ and given by $\pi+t-4\sqrt{t}$ on the interval $[0,1]$ and by $-2-t+4\sqrt{t-1}+2\arcsin\left(\frac{2}{t}-1\right)$ on the interval $[1,2]$. That leads to:
$$ I = \int_{0}^{1}\sqrt{t}\left(\pi+t-4\sqrt{t}\right)\,dt+\int_{1}^{2}\sqrt{t}\left(-2-t+4\sqrt{t-1}+2\arcsin\left(\frac{2}{t}-1\right)\right)\,dt$$
that simplifies to:
$$ I = \color{red}{\frac{2+\sqrt{2}+5\,\text{arcsinh}(1)}{15}}=0.521405433\ldots$$
Convexity arguments are enough to prove that $\frac{1}{2}<I<\frac{1}{\sqrt{3}}$ also without an explicit computation.