# Probability of distance of two random points in the unit circle

Inspired by the problem solve this probability problem symbolically which I have already generalized there I'd like to ask here the same question for a unit circle.

More precisely: given two randomly chosen points within (corrected after justified comments) a circle of radius 1, what is the probability that their distance is greater than $t$?

pc[t_] := 2 /\[Pi] Integrate[
r1 r2 Boole[r1^2 + r2^2 - 2 r1 r2 Cos[\[Phi]] > t^2],
{r1, 0, 1},
{r2, 0, 1},
{\[Phi], 0, 2 \[Pi]}, Assumptions -> t > 0]


Problems:

1) derive the expression for pc[t]
2) calculate pc[1], symbolically and numerically
3) plot pc[t] over the relevant range
4) derive a general symbolic solution, if possible

• mathworld.wolfram.com/DiskLinePicking.html – Dr. belisarius Mar 29 '16 at 17:52
• @Dr. belisarius Thanks, also an interesting problem. – Dr. Wolfgang Hintze Mar 29 '16 at 18:22
• I think this question suffers from ambiguity of whether it is about random points on a unit circle (dimension 1), or points in a unit disk (dimension 2). I guess it is about the unit disk (which is "inside" the unit circle), but still... – kirma Mar 29 '16 at 19:39
• It's important to understand that "randomly chosen" means nothing. We usually assume that "randomly chosen" means uniform probability distribution, it's easy to generate 1D distribution. It's harder with 2D. If you sample {R,phi} (in polar coordinates) as two independent uniformly distributed random values, you will get one possible distribution. If you sample {x,y} as two independent uniformly distributed random values and throw away the ones that lay outside of your disk, you will get another possible distribution. – BlacKow Mar 30 '16 at 16:03
• Don't have much time today, but this seems pretty quick and might provide insight. Given radius r and distance d, gives desired probability (no sanity checking done). distGreater[r_, d_] := 1 - Integrate[ 4 dx/(Pi r^2) (ArcCos[dx/(2 r)] - dx/(2 r) (1 - (dx/(2 r))^2)^(1/2)), {dx, 0, d}] – ciao Mar 30 '16 at 21:57

Based on my comment, I think this is what you're after:

Given radius r and distance d for valid values, this gives the probability of distance of two random points exceeding d:

distGreater[r_, d_] := 1 - Integrate[ 4 dx/(Pi r^2) (ArcCos[dx/(2 r)] -
dx/(2 r) (1 - (dx/(2 r))^2)^(1/2)), {dx, 0, d}]


Plugging in 1 for r and d for d returns the simple form:

(d*Sqrt[4 - d^2]*(2 + d^2) - 8*(-1 + d^2)*ArcCos[d/2])/(4*Pi)


Obligatory plot:

brute force simulation: probability of two points in a unit circle falling more than a specified distance of each other:

n = 10000;
pairs = Partition[
Select[RandomReal[{-1, 1}, {3 n, 2}], Norm[#] < 1 &], 2];
base = ListPlot[
MapIndexed[{#1, First@#2/Length@pairs} &,
Reverse@Sort[EuclideanDistance @@@ pairs]]]


now we can get at this analytically, assuming the first point is at distance d from the center, the probability of the second point lying within radius r of the first is given by the area of intersection of a circle centered at d from the center of the unit circle, or after integrating:

areaintersect[r1_, r2_, d_] := Module[{rp = r1 + r2, rm = r1 - r2},
Which[ d >= rp, 0, d <= Abs[rm] , Pi Min[r2, r1]^2 , True,
r1^2 ArcCos[(d^2 + rp rm)/(2 d r1)]
+ r2^2 ArcCos[(d^2 - rp rm)/(2 d r2)]
- 1/2 Sqrt[(rm^2 - d^2) (d^2 - rp^2)]]]

Show[{base,
ListPlot[Table[ {t,
1 - NIntegrate[2 d areaintersect[t, 1, d]/Pi, {d, 0, 1}] }, {t,
0, 2, .01}], PlotRange -> All, Joined -> True,
PlotStyle -> Red]}]


It seems unlikely that this will lead us to an analytic form..

• How does this match Plot[1 + ( 1/4 s Sqrt[4 - s^2] (2 + s^2) - 2 s^2 ArcSec[2/s] - 2 ArcSin[s/2])/\[Pi], {s, 0, 2}] ? – Dr. belisarius Mar 29 '16 at 19:32
• looks spot on.. – george2079 Mar 29 '16 at 19:34
• See my comment under the question :) – Dr. belisarius Mar 29 '16 at 19:36