What is the average distance of two points chosen uniformly on a unit square? What I am asking is how to calculate $E\left(\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}\right)$ for $x_1, x_2, y_1, y_2$ spread uniformly on $[0,1]$.
-
$\begingroup$ intuitively, wouldn't it simply be 0? $\endgroup$– user322548Jul 8, 2016 at 19:53
-
2$\begingroup$ @Ethan Zell Distance is always positive. $\endgroup$– Will SherwoodJul 8, 2016 at 19:55
-
$\begingroup$ Chosen uniformly: the cdf of the distribution is $\text{cdf}(t)=t$ for $t \in [0,1]$. $\endgroup$– Will SherwoodJul 8, 2016 at 19:59
-
$\begingroup$ An answer is given here mathworld.wolfram.com/HypercubeLinePicking.html $\endgroup$– user15994Jul 8, 2016 at 20:56
-
$\begingroup$ Also math.stackexchange.com/q/1294800/321264. $\endgroup$– StubbornAtomMay 16, 2020 at 19:33
1 Answer
Comments:
A brief simulation in R for a million points seems to confirm the answer in the link (2 or 3 place accuracy):
x1 = runif(m); x2 = runif(m)
y1 = runif(m); y2 = runif(m)
d = sqrt((x1-x2)^2 + (y1-y2)^2)
mean(d)
## 0.5215181
Can you start by getting the distribution of $(X_1 - X_2)^2,$ which seems to have expectation 1/6?