In cartesian plane, $N$ points are randomly generated within a unit square defined by points $(0,0) (0,1) (1,1) (1,0)$, with uniform distribution. What is the mathematical expectation of the average distance of all distances between all points (distances between the point and the same point (which are obviously $0$) are excluded from the calculation of the average).
There are actually two versions of this question:
- Distance is defined as Euclidian.
- Distance is defined as Manhattan.
The context of this question is some performance benchmarking in computer science, which are of practical nature and far from pure mathemathics, so I am not going the bother the reader with these details.
You're looking for
$$\Bbb E\left(\frac{1}{\binom N2}\sum_{1\leqslant i < j \leqslant N} d(P_i,P_j)\right);$$
By linearity of expectation, that would be
$$\frac1{\binom N2}\sum_{1\leqslant i < j \leqslant N} \Bbb E\big(d(P_i,P_j)\big).$$
By (assumed) independence of the distribution of the points $P_i$, $\Bbb E\big(d(P_i,P_j)\big)$ is the same for all pairs $i\neq j$. Do you think you can take it from here?