Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Math people:

I am trying to find the probability density function for the distance between two points in $\mathbb{R}^3$ selected independently according to the Gaussian pdf $F(\mathbf{z}) = \left(\frac{1}{\sqrt{2\pi}}\right)^3 \exp(-\frac{1}{2}|\mathbf{z}|^2)$. I keep getting $f(t) = \frac{t^2\exp(-\frac{t^2}{4})}{2\sqrt{\pi}}$. I found a paper ( which, if I understand correctly, states that the actual pdf is $\sqrt{\frac{2}{\pi}} t^2\exp(-\frac{t^2}{2})$ (see p. 10, second "$f(x)$"). That paper actually proves a much more general result and gives this as a special case. I am reluctant to just take their word for it, since I used only Calc 3 techniques and their arguments are much more sophisticated and difficult. Has anyone seen this problem before, perhaps as a calculus or probability exercise? Assuming that either their formula or mine is right, is there an easy way to test which is right experimentally (generating random vectors, etc.)?

Stefan (STack Exchange FAN)

share|cite|improve this question
I tested it using Matlab. I generated 1000000 pairs of points in $\mathbb{R}^3$ according to that pdf. The proportion of them within distance $2$ of each other was about $0.4277$. My pdf said it should be about $0.442759$. According to the paper I cited, the proportion should be about $0.7385$. So either the paper is wrong or I misunderstood what they were saying. – Stefan Smith Feb 15 '13 at 23:42
I found an easier way to get the pdf. Letting $x_1, x_2, x_3, y_1, y_2$, and $y_3$ be the coordinates of the two points, $x_1-y_1$, $x_2-y_2$, and $x_3-y_3$ are normally distributed with mean $0$ and standard deviation $\sqrt{2}$. Letting $\mathbf{z} = \mathbf{x}-\mathbf{y}$, set up a triple integral for $P(|\mathbf{z}| < t)$, convert it to a single integral, then take the derivative of that integral with respect to $t$, and you get the pdf that I give above. – Stefan Smith Feb 16 '13 at 1:10
up vote 1 down vote accepted

The square of the distance is $r^2=(X_1-X_2)^2+(Y_1-Y_2)^2+(Z_1-Z_2)^2$, where the $X_i$s, $Y_i$s, and $Z_i$s are independent standard normal r.v.s. So, $r^2/2$ is $\chi^2$ distributed with $3$ degrees of freedom, and as you say, the distance $r$ has density $r^2\exp(-\frac{r^2}{4})/(2\sqrt{\pi}).$ p. 10 of the paper you mention is treating a different case, where each component of the difference between the two points is standard normal.

share|cite|improve this answer
Thanks. I am embarrassed that the problem seems to have been so easy. – Stefan Smith Feb 16 '13 at 7:08

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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