Two points are chosen at random within a sphere of radius $r$. How to calculate the probability that the distance of these two points is $< d$?

My first approach was to divide the volume of a sphere with radius d by a sphere with radius r. But it does not seem to work, at least not for $d > r$.

$$P = \frac{ 4/3 \pi d ^3}{ 4/3 \pi r ^ 3 }\tag{?}$$

Any help would be hugely appreciated.

  • $\begingroup$ What is $d$ here? Diameter? If so, then why do you refer to "radius d" and "at least not for for d > r"? $\endgroup$ – Joel Reyes Noche Aug 28 '15 at 14:13
  • $\begingroup$ d is the distance between the two random points and a constant $\endgroup$ – Erik Kalkoken Aug 28 '15 at 14:15
  • $\begingroup$ Your first approach will not work when the first point is more than $r-d$ from the centre of the sphere $\endgroup$ – Henry Aug 28 '15 at 14:21
  • $\begingroup$ It also depends on how you randomize... $\endgroup$ – Dr Xorile Aug 28 '15 at 16:09
  • $\begingroup$ To clarify lets assume the random function is an equal distribution of points within the sphere. $\endgroup$ – Erik Kalkoken Aug 28 '15 at 17:18

How are you at three-dimensional integrals?
Let the first point be at $(0,0,z)$. There are two spheres: One of radius $r$, centered at the origin, and one of radius $d$, centered at $(0,0,z)$. I would let $r=1$ to remove one letter from your calculations.
The spheres' intersection is symmetric about the $z$ axis, which should help you calculate the volume of the intersection. You rotate the intersection of two semicircles about the $z$ axis.
Once you have $P(z,d)$, you need to calculate the following.
$$P(d)=\frac{\int_0^1 z^2P(z,d)dz}{\int_0^1z^2dz}$$

  • $\begingroup$ Thanks for your fast and comprehensive response. My math is limited, so I have problems to understand the solution. However I have 3 questions: 1) The first point is at random coordinates within the sphere with radius r, not at (0,0,z) 2) I am looking for a solution for different r, so setting it to 1 does not help me. 3) How do you define P(z,d) ?? What I am really looking for, is a function P(r, d), which gives me the %-probability for any r, d > 0. Ideally something that I can calculate in Google sheets. $\endgroup$ – Erik Kalkoken Aug 28 '15 at 17:16
  • $\begingroup$ @bji74: $P(r,d)=P(1,d/r)$, so it suffices to solve the problem for $r=1$. $\endgroup$ – joriki Aug 28 '15 at 21:26
  • $\begingroup$ @bji74 (1) Pick the first point. Then change the coordinate system so that it is at (0,0,z). (2) P(r,d) = P(1, d/r) $\endgroup$ – steven gregory Aug 28 '15 at 22:44
  • $\begingroup$ @StevenGregory: I suspect you intended to ping bji74? $\endgroup$ – joriki Aug 28 '15 at 22:45

According to MathWorld, the density for $d$ is

$$ \frac{3d^2}{r^3}-\frac{9d^3}{4r^4}+\frac{3d^5}{16r^6}\;. $$

Thus the cumulative distribution function that you're looking for is

$$ \int_0^d\left(\frac{3d'^2}{r^3}-\frac{9d'^3}{4r^4}+\frac{3d'^5}{16r^6}\right)\mathrm dd'=\left(\frac dr\right)^3-\frac9{16}\left(\frac dr\right)^4+\frac1{32}\left(\frac dr\right)^6\;. $$

Here's a plot.


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.