0

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.

joriki
  • 238,052

2 Answers2

3

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}$$

Empy2
  • 50,853
  • 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.

    – Erik Kalkoken Aug 28 '15 at 17:16
  • @bji74: $P(r,d)=P(1,d/r)$, so it suffices to solve the problem for $r=1$. – joriki Aug 28 '15 at 21:26
  • @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) – Steven Alexis Gregory Aug 28 '15 at 22:44
  • @StevenGregory: I suspect you intended to ping bji74? – joriki Aug 28 '15 at 22:45
1

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.

joriki
  • 238,052
  • 1
    The above formula for the CDF is worked out in an answer to the following question: https://math.stackexchange.com/questions/3848889/probability-involving-two-points-inside-a-sphere question – Christian Blatter Oct 16 '20 at 10:48