Probability – Centroid of a Triangle Inside Its Incircle

geometric-probabilitygeometryintegrationprobabilitytriangles

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

Best Answer

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()