Probability that the centroid of a triangle is inside its incircle

521 Views Asked by At

Question: The vertices of triangles are uniformly distributed on the circumference of a circle. What is the probability that the centroid is inside the incricle.

enter image description here

Simulations with $10^{10}$ trails give a value of $0.457982$. It is interesting to note that this agrees with $\displaystyle \frac{G}{2}$ to six decimal places where $G$ is the Catalan's constant.

Julia source code:

using Random

inside = 0
step = 10^7
target = step
count = 0

function rand_triangle()
    angles = sort(2π * rand(3))
    cos_angles = cos.(angles)
    sin_angles = sin.(angles)
    x_vertices = cos_angles
    y_vertices = sin_angles
    return x_vertices, y_vertices
end

function incenter(xv, yv)
    a = sqrt((xv[2] - xv[3])^2 + (yv[2] - yv[3])^2)
    b = sqrt((xv[1] - xv[3])^2 + (yv[1] - yv[3])^2)
    c = sqrt((xv[1] - xv[2])^2 + (yv[1] - yv[2])^2)
    s = (a + b + c) / 2
    incenter_x = (a * xv[1] + b * xv[2] + c * xv[3]) / (a + b + c)
    incenter_y = (a * yv[1] + b * yv[2] + c * yv[3]) / (a + b + c)
    incircle_radius = sqrt(s * (s - a) * (s - b) * (s - c)) / s
    return incenter_x, incenter_y, incircle_radius
end

while true
    count += 1
    x_vertices, y_vertices = rand_triangle()
    centroid_x = sum(x_vertices) / 3
    centroid_y = sum(y_vertices) / 3
    incenter_x, incenter_y, incircle_radius = incenter(x_vertices, y_vertices)
    centroid_inside = sqrt((centroid_x - incenter_x)^2 + (centroid_y - incenter_y)^2) <= incircle_radius
    inside += centroid_inside
    if count == target
        println(count, " ", inside, " ", inside / count)
        target += step
    end
end
3

There are 3 best solutions below

6
On BEST ANSWER

A follow-up to my comment on Dan's post:

In the $x,y$ plane, the boundary of the region $R$ is defined by the implicit function

$$15+6\cos(2y)-5\cos(4y)=(6+10\cos(2y))\cos(2x)-12(\cos(3y)-\cos y) \cos x$$

so that solving for $x$ and denoting $c=\cos y$, we arrive at

$$\cos x = \frac{3c^3 - 3c \pm 4c^2 \sqrt{2-c^2}}{5c^2-1} \\ \implies x = x_{\color{red}{\pm}}(y) = \pm \arccos \frac{3c^3 - 3c \color{red}{\pm} 4c^2 \sqrt{2-c^2}}{5c^2-1}$$

where the $\pm$ subscript corresponds to the same sign on the root. In the plot, $x_-(y)$ and $x_+(y)$ are resp. shown in blue and red.

enter image description here

It can be shown that $\min x_-(y)=0$ at $y=\arccos\dfrac15$ (orange), which can be used as a cut-off to split up the integral for the area w.r.t. $y$:

$$\iint_R dA = 2 \iint_{R \land x\ge0} dA = 2 \left(\int_0^{\arccos\tfrac15} x_+(y) \, dy + \int_{\arccos\tfrac15}^\tfrac\pi2 \left(x_-(y) - x_+(y)\right) \, dy\right)$$

Double that and divide by $\pi^2$ to get the probability. Numerically, Mathematica with NIntegrate claims an area of about $4.520\color{red}{21146}\ldots$, compared to expected value via NSolve of

$$\frac{2 \times \text{area of }R}{\pi^2} = \frac G2 \implies \text{area of }R \approx 4.520\color{red}{10902\ldots}$$

I suspect the discrepancy is due to floating-point error.

3
On

This is not an answer, but I have a plot of what the probability space looks like.

Fix the first vertex at the top. Choose two real values between $0$ and $1$ uniformly at random, let them be $p_1$ and $p_2$. The second vertex is $p_1$ the way around the circle, and $p_2$ respectively. Plot the points on the coordinate plane, where $p_1$ is $x$ and $p_2$ is $y$.

The entire space of possibilities is the square from $(0,0)$ to $(1,1)$. We plot the point only if the centroid is in the incircle. We get a figure like such ($10^4$ steps sampled from each axis):

normal plot

Bonus: Here is the same plot but with the fixed point on the opposite side instead.

shifted plot

I do not know where to proceed from here. I am not sure how to intuitively understand why six negative petals appear.

Code for anyone interested:

import matplotlib.pyplot as plt
import numpy as np
import math

sqrt = math.sqrt
PI = math.pi
cos = math.cos
sin = math.sin
def dist(p1, p2):
    d1 = p1[0]-p2[0]
    d2 = p1[1]-p2[1]
    return sqrt(d1*d1 + d2*d2)

def GInsideIncircle(p1, p2):
    try:
        v = ((1,0), (cos(2*PI*p1), sin(2*PI*p1)), (cos(2*PI*p2), sin(2*PI*p2)) )
        g = (( v[0][0]+v[1][0]+v[2][0] ) /3, ( v[0][1]+v[1][1]+v[2][1] ) /3)
        a = dist(v[1], v[2])
        b = dist(v[0], v[2])
        c = dist(v[0], v[1])
        p = a+b+c
        s = p/2
        i = ( (a*v[0][0]+b*v[1][0]+c*v[2][0])/p, (a*v[0][1]+b*v[1][1]+c*v[2][1])/p )
        A2 = s*(s-a)*(s-b)*(s-c)
        if A2<0: A2 = 0
        r = sqrt( A2 ) / s
        return dist(g, i) < r
    except ZeroDivisionError:
        return False

def draw(a,b):
    x.append(a)
    y.append(b)

x = []
y = []
steps = 10000

for xd in range(steps):
    for yd in range(steps):
        if GInsideIncircle(xd/steps, yd/steps): draw(xd/steps, yd/steps)

plt.scatter(x, y)
plt.show()
3
On

Long comment.

Here is evidence that $0.457<P<0.459$.

Assume that the circle is a unit circle centred at the origin, and the vertices of the triangle are:
$A\space(\cos(-2Y),\sin(-2Y))$ where $0\le Y\le\pi$
$B\space(\cos(2X),\sin(2X))$ where $0\le X\le\pi$
$C\space(1,0)$

So:
$a=BC=2\sin X$
$b=AC=2\sin Y$
$c=AB=|2\sin(X+Y)|$

The incircle has centre $\left(\frac{a\cos (-2Y)+b\cos (2X)+c}{a+b+c},\frac{a\sin (-2Y)+b\sin (2X)}{a+b+c}\right)$ and radius $\sqrt{\frac{(s-a)(s-b)(s-c)}{s}}$ where $s=\frac{a+b+c}{2}$.

The coordinates of the centroid are $\left(\frac{\cos (-2Y)+\cos (2X)+1}{3},\frac{\sin (-2Y)+\sin (2X)}{3}\right)$.

So the probability in the OP is the probability that

$$\left(\frac{\cos (-2Y)+\cos (2X)+1}{3}-\frac{a\cos (-2Y)+b\cos (2X)+c}{a+b+c}\right)^2+\left(\frac{\sin (-2Y)+\sin (2X)}{3}-\frac{a\sin (-2Y)+b\sin (2X)}{a+b+c}\right)^2<\frac{(s-a)(s-b)(s-c)}{s}$$

This probability is the ratio of the area of the shaded region to the area of the square in the graph below.

enter image description here

By symmetry, we only need to consider the bottom-left shaded region and the bottom-left half of the square. Rotate these regions $45^\circ$ anticlockwise about the origin, then shrink by factor $\frac{1}{\sqrt2}$, by letting $X=y-x$ and $Y=y+x$.

enter image description here

We want to find the area of the three unshaded regions inside the triangle. By symmetry, they have equal areas, so we only need to consider the top unshaded region.

As can be seen in a demos graph (where you can zoom in),

  • $\color{red}{y=f(x)=\arccos \frac15+0.06x^2-0.002|x|^3+0.0101x^4}$ lies above the top boundary of the shaded region
  • $\color{green}{y=g(x)=\arccos \frac15-10^{-5}+0.06x^2-0.004|x|^3+0.0113x^4}$ lies below the top boundary of the shaded region.

(I got $f(x)$ and $g(x)$ by trial and error.)

So an upper bound for the probability is

$$1-\frac{3\int_0^{\pi/2}\left(\frac{\pi}{2}-\color{red}{f(x)}\right)\mathrm dx}{\frac{\pi^2}{8}}=0.4589372...$$

and a lower bound for the probability is

$$1-\frac{3\int_0^{\pi/2}\left(\frac{\pi}{2}-\color{green}{g(x)}\right)\mathrm dx}{\frac{\pi^2}{8}}=0.457077...$$