Suppose $x_1$ and $x_2$ are two uniformly distributed points from unit cube $(0,1)^3$, what's the distribution of the distance between $x_1$ and $x_2$? I did a quick simulation and find that this distribution's kurtosis is 2.5, smaller than 3. can anyone help me with a closed form pdf? thanks.


This is such a natural problem to study that I would check to see if it has been done before, and it seems it has:

"On the distribution of the distance between two points in a cube" by Antanas Žilinskas, Random Operators and Stochastic Equations, Volume 11, Issue 1, Pages 21–24, March 2003. Abstract: We are interested in the distribution of distance between two random points in a cube. It is well known, that the derivation of the formulae of the distribution function of interest implies integration problems which are almost intractable. We show, that the problem may be successfully solved using a symbolic computation tool.

I was unable to find the paper for free online.

I also found what looks like a proof of the exact same thing at http://www.degruyter.com/view/j/rose.2000.8.issue-4/rose.2000.8.4.339/rose.2000.8.4.339.xml . It also is behind a paywall. Tantalizingly, you can see part of the answer on the first page of the paper, which is displayed at that URL.

This paper was free online: "THE PROBABILITY DISTRIBUTION OF THE DISTANCE BETWEEN TWO RANDOM POINTS IN A BOX", posted at http://www.math.kth.se/~johanph/habc.pdf , which actually answers the more difficult problem with a box with not necessarily equal sides. This would be harder to use, but easier to get for free right away.

  • $\begingroup$ Great find! I downloaded this myself to check out the results...I figured that the actual derivation of my below steps would be daunting. $\endgroup$ – user76844 Jan 7 '14 at 13:58
  • $\begingroup$ @Eupraxis1981 : I think I used Google Scholar. The papers were easy to find. I haven't used MathSciNet in decades. $\endgroup$ – Stefan Smith Jan 8 '14 at 1:50

I have not seen an explicit result for this, but I can outline the steps you can use to get the analytical solution - its somewhat involved, and since this is homework, I will not derive it here.

First, recognize that the random variable you want is as follows, for two 3-D points $p_1,p_2$:

$D(p_1,p_2)=\sqrt{(x_1-x_2)^2+(y_1-y_2)^2+(z_1-z_2)^2}$ Where $x,y,z\sim U(0,1)$

We can derive the distribution in parts, starting from the differences of each component:

  1. The difference of two standard uniforms has standard triangular distribution
  2. The square of the standard triangular distribution, (S), will have cdf: $P(S\leq t) = 2F_{Tri}(\sqrt{t})-1,t\geq0$ where $F_{Tri}$ is the CDF of the standard triangular distribution.
  3. This is the annoying part: you need to take the convolution of the sum of three random variables distributed according to S, above. Since the triangular distribution is not a smooth function, it will need to be dealt with piecewise.
  4. After step 3, you will have the distribution of $D^2$, so you can get the distribution of D by recognizing that $P(D\leq d)= P(D^2\leq d^2)$ since both distributions have non-negative domains.

Hope that helps. Have fun...


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.