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]$.
Asked
Active
Viewed 449 times
3
-
intuitively, wouldn't it simply be 0? – Jul 08 '16 at 19:53
-
2@Ethan Zell Distance is always positive. – Will Sherwood Jul 08 '16 at 19:55
-
Chosen uniformly: the cdf of the distribution is $\text{cdf}(t)=t$ for $t \in [0,1]$. – Will Sherwood Jul 08 '16 at 19:59
-
An answer is given here http://mathworld.wolfram.com/HypercubeLinePicking.html – user15994 Jul 08 '16 at 20:56
-
Also https://math.stackexchange.com/q/1294800/321264. – StubbornAtom May 16 '20 at 19:33
1 Answers
0
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?

BruceET
- 51,500