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.
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





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.
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
NIntegrateclaims an area of about $4.520\color{red}{21146}\ldots$, compared to expected value viaNSolveof$$\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.