5

A random circle (with random center and radius) is formed inside a bigger circle, which is a unit circle centered at origin. Given that the smaller circle is totally in the big circle, what is the probability that the small circle contains the center of the bigger circle?

Through sets of simulation of $1000$ runs, the solution comes around $16.6\%$. But I am curious about an analytic solution.

  • 4
    How exactly do you choose the random circle? Do you choose the center first, and then the radius from allowable values? Or...? – Milten Nov 05 '19 at 01:40
  • I supposed center first and then a feasible radius. I am not sure what difference it would make though. :) – Cengiz Baykal Nov 05 '19 at 01:43
  • 3
    In general, the way that one makes these kinds of choices is hugely important; see Bertrand's Paradox, https://en.m.wikipedia.org/wiki/Bertrand_paradox_(probability), for a great example. Out of curiosity, how (mechanically) did you select the point? I ask because the natural interpretation would be to use Cartesian coordinates, but that's not necessarily the easiest one to code. More generally, would you feel comfortable posting your code (or at least pseudocode)? – Aaron Montgomery Nov 05 '19 at 02:03
  • angle= random() * 2 * PI r = R * sqrt(random())------------------ (R=1 for this question; Reject if r>1/2)

    x = r * cos(angle) y = r * sin(angle)

    – Cengiz Baykal Nov 05 '19 at 02:13
  • The answer seems to be independent of the Radius of the bigger circle, according to the simulation results. – Cengiz Baykal Nov 05 '19 at 02:17
  • So you choose angle and $r$ like that, giving the center. Then how do you choose radius? – Milten Nov 05 '19 at 02:21
  • By the way, this is already different from what I and Cade Reinberger assumed. – Milten Nov 05 '19 at 02:25
  • @Milten I think only slightly though, it looks like (https://stackoverflow.com/questions/5837572/generate-a-random-point-within-a-circle-uniformly) the square root tool is just a trick to generate points with a triangular distribution (though that's mostly I guess. I still don't know for sure that's what the square root is doing). So, I think the only difference is that $r \leq \frac{1}{2}$, which is mostly the difference of a normalization constant. When I rerun the calculation with small radius uniformly distributed and $r$ constricted so I still don't get $\frac{1}{6}$ though. – Cade Reinberger Nov 05 '19 at 02:35
  • To clarify myself: I have chosen a random angle [0,PI]. Then the radius of small circle by r = R * sqrt(random(). Then the angle and r give the Cartesian coordinates. If the distance to the center is > 1/2 then reject that point otherwise accept. – Cengiz Baykal Nov 05 '19 at 02:36
  • @Cengiz sure, that'll give the center of the smaller circle. But how do you choose the radius of the small circle? – Cade Reinberger Nov 05 '19 at 02:38
  • Sqrt comes from CDF being x square. – Cengiz Baykal Nov 05 '19 at 02:39
  • The radius of small circle by r = R * sqrt(random() – Cengiz Baykal Nov 05 '19 at 02:39
  • 2
    I'm sorry, I still don't get it. We need two distances right? One that determines the center (i.e. where is the small circle), and one that determines the radius. – Milten Nov 05 '19 at 02:42
  • 3
    Maybe you could just paste your code in the question? Then it would be clearer I think. – Milten Nov 05 '19 at 02:43
  • Okay, so $(x,y)$ is a uniformly random point in the unit circle. Then you reject if $|(x,y)|>1/2$. But if just you accept all points with distance $<1/2$, then your get wrong results. Let's say $(x,y)=(1/4,0)$. Then we could have a small circle with center $(1/4,0)$ and radius $1/8$. That would not contain the origin, but your algorithm accepts it. – Milten Nov 05 '19 at 03:03
  • Got it. The small circle r changed with again (1-r) * sqrt(random(). – Cengiz Baykal Nov 05 '19 at 03:11
  • I tried without sqrt(random()). I used only rand(). Then it is corrected. Thank you – Cengiz Baykal Nov 05 '19 at 03:41

2 Answers2

6

I'm assuming you mean that the center is chosen uniformly at random from the interior of the unit circle and then the radius is chosen uniformly at random from the set of all possible radii. In this case, the probability density of selecting any point for the center is $\frac{1}{\pi}$.

Now we'll switch to polar coordinates. When we do so, however, the probability density of selecting some radius $r$ increases proportionally with $r$ as $r$ gets bigger, since, roughly speaking, the density of all points on any strip (circle concentric to the unit circle) should be the same, and the circumference of each such strip varies linearly with $r$. So $r$ has a pdf of $f(r)=2r$, which takes values between $0$ and $1$ proportionally with $r$, while having $\int_0^1 f(r) \ \text{d}r = 1$. The pdf for the angle is simply uniform, or $g(\theta) = \frac{1}{2\pi}$.

Now, our space of circles includes first a point (the center) in polar coordinates $(r, \theta)$, and the a radius of the smaller circle $\rho$ chosen uniformly between $0$ and $1-r$ (hopefully you can see why the biggest allowable radius is $1-r$--it's because that's the smallest circle that gets too big). Thus the probability density function for all such $\rho$ is $h(\rho) = \frac{1}{1-r}$.

So, the probability density we get the circle described by $(r, \theta, \rho)$ should be $$ V(r, \theta, \rho) = f(r) g(\theta)h(\rho) =\frac{1}{\pi} \frac{r}{1-r} $$ and just to check we're properly normalized we note that the integral of this density over our whole space is just $$ \int_{0}^{1} \int_{0}^{2\pi}\int_{0}^{1-r} \frac{1}{\pi}\frac{r}{1-r} \text{d}\rho \ \text{d}\theta \ \text{d}r = 1$$

So, our question is, of this space of circles $(r, \theta, \phi)$, which ones contain the center of the bigger circle? Well, it's true precisely when $\rho > r$. Indeed, since the center is in polar coordinates, $r$ is the distance from the center of the small circle to the center of the unit circle, so the center of the unit circle is in the small circle if and only if it's radius is bigger than $r$. Where does this happen? Well, it happens only when $r \leq \frac{1}{2}$, since for $r \geq \frac{1}{2}$ the small circle must contain the closest point on the unit circle for a smaller $\rho$ than it could contain the center of the unit circle with. When $r \leq \frac{1}{2}$, it happens in the set of values of $\rho$ bigger than $r$ but still less than $1-r$. If we simply integrate our density function $V$ over this region, we get our probability. If we call the probability we want $P$, we have $$ P = \int_0^{\frac{1}{2}}\int_0^{2\pi} \int_r^{1-r} V(r, \theta, \rho) \text{d}r \ \text{d}\theta \ \text{d}\rho = \int_0^{\frac{1}{2}}\int_0^{2\pi} \int_r^{1-r} \frac{1}{\pi}\frac{r}{1-r} \text{d}r \ \text{d}\theta \ \text{d}\rho $$ $$ = \int_0^{\frac{1}{2}}\int_0^{2\pi} \frac{1-2r}{\pi} \frac{r}{1-r} \text{d}r \ \text{d}\theta = \int_0^\frac{1}{2} \frac{2r-4r^2}{1-r} \text{d}r = \frac{3}{2} - \ln 4 \approx 11.37\%$$

Source code to test the result

import random
import math as m

def test():
    r = random.triangular(0, 1, 1)
    theta = random.uniform(0, 2 * m.pi)
    rho = random.uniform(0, 1 - r)
    return iverson_bracket(rho > r)

def iverson_bracket(boole):
    if boole:
        return 1
    else:
        return 0

num_trials = 1000000
tot = 0
for ind in range(0, num_trials):
    tot += test()
print("Average: " + str(tot/num_trials))

on a million trials it gave $0.11351$

4

Let $A$ be the event that center is contained by the little circle. Let $D$ be the distance from the center of the little circle to the origin, and let $R$ be the radius.

We have $P(A\mid D=x) = P(R>x | D=x) = \max(0,1-\frac{x}{1-x})$, since $R$ is chosen uniformly from $(0,1-x)$. In particular, the probability is $0$ if and only if $D\ge\frac12$.

We need to figure out the distribution of $D$. We have $P(D<x) = \frac{x^2\pi}{\pi}=x^2$. Therefore the PDF is $f_D(x)= \frac{d}{dx}x^2=2x$ for $0<x<1$.

By the law of total probability: $$ P(A) = \int P(A|D=x)f_D(x)dx = \int_0^\frac12 (1-\frac{x}{1-x})\cdot 2xdx = \frac32-2\log2 \approx 11.37\% $$

This is definitely different from your result (which could be 1/6 it seems). It could be a calculation mistake on my part, or that you chose the random circle differently than what I understood. Both cases are likely in my opinion ;)

Milten
  • 7,031