# trying to verify pdf for distance between normally distributed points

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 (http://www.pupr.edu/hkettani/papers/HICS2008.pdf) 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)

-
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

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.