[Math] Three points on sides of equilateral triangle

geometric-probability

Let's choose three points on the sides of an equilateral triangle(one point on each side) and construct a triangle with these three points. what is the probability that area of this triangle be at least one half of the area of equilateral triangle?

Best Answer

Place the equilateral triangle s.t its vertices are in the points $A=(0,0), B=(1, \sqrt3), C = (2,0)$ (I'm assuming sidelength $2$ to have nicer constants). Denote by $x_1, x_2$ and $x_3$ the $x$-coordinates of the random points on the sides $AC, AB$ and $BC$ respectively. So

$$x_1 \in [0,2], x_2\in[0,1] x\in[1,2].$$

Then the $y$-coordinates are $y_1 = 0, y_2 = \sqrt3 x_2$ and $y_3 = \sqrt3(2-x_3)$. Now use the formula for the area of a triangle given its vertices to get (see for example here)

$$A(x_1, x_2, x_3) = \frac{\sqrt3}{2} \left|x_1x_2 + x_1x_3-2x_1-2x_2x_3+2_2\right|$$

The area of the original equlateral triangle is $\sqrt3$ so we are lead to the requirement that $$f(x_1, x_2, x_3) \geq 1$$ where $f(x_1, x_2, x_3) = |x_1x_2 + x_1x_3-2x_1-2x_2x_3+2_2|$. So the probability is given by the volume of the region of $X = [0,2]\times[0,1]\times[1,2]$ where this is satisfied, divided by $2$ (which is the total volume of $X$.

I haven't managed to calculate the volume (yet), but maybe we must split it in two parts $f\geq1$ and $f\leq-1$.

EDIT: I believe it can be calculated in $4$ parts depending on whether $f\geq1$ or $f\leq-1$ and whether $x_1 > 2x_2$ or $x_1 < 2x_2$. Let's denote by $\alpha$ the function that cuts the value to the inteval, i.e $\alpha(t) = 1$ if $t<1$, $\alpha(t) = t$ if $t\in[1,2]$ and $\alpha(t) = 2$ if $t>2$. I got the following:

$$I_1 = \int_0^2 { \int_0^{\frac{1}{2}x_1} {\alpha\left( \frac{-1+x_1x_2-2x_2}{x_1-2x_2}\right)} }dx_2dx_1$$ $$I_2 = \int_0^2 { \int_{\frac{1}{2}x_1}^1 {\alpha\left( \frac{1-x_1x_2+2x_1-2x_2}{x_1-2x_2}\right)} }dx_2dx_1$$ $$I_3 = \int_0^2 { \int_0^{\frac{1}{2}x_1} {\alpha\left( \frac{-1-x_1x_2+2x_1-2x_2}{x_1-2x_2}\right)} }dx_2dx_1$$ $$I_4 = \int_0^2 { \int_{\frac{1}{2}x_1}^1 {\alpha\left( \frac{1+x_1x_2-2x_2}{x_1-2x_2}\right)} }dx_2dx_1$$

If my calculations are correct, then the probability is $\frac{1}{2}(I_1+I_2+I_3+I_4)$. Still, I don't really know how to calculate these integrals. Plotting the the constraint equations $f=1$ and $f=-1$ in Wolfram alpha seems to indicate that they are hyperboloids but they are slanted and I dodn't know, maybe some coordinate transformation would be necessary(?), but then again our box is according to the coordinate axis.

EDIT2: Here's my python code I used in the simulation:

import math, random

#----Functions----------------
def area(a, b, c):
    return abs(a[0]*(b[1]-c[1])+b[0]*(c[1]-a[1])+c[0]*(a[1]-b[1]))/2.0

def random_between(a, b):
    t = random.random()
    return (a[0]+t*(b[0]-a[0]), a[1] + t*(b[1]-a[1]))

def mean(a):
    return sum(a)/float(len(a))

def var(a):
    m = mean(a)
    v = 0
    for x in a:
        v += (x-m)**2
    return v/float(len(a))
#-----------------------------


#The verteces of the original triangle
A = (0,0)
B = (2,0)
C = (1,math.sqrt(3))

AREA = area(A,B,C)
HALF_AREA = AREA/2.0

#----- the simulation---------
n = 1000000
count = 0
area_percents = []
for i in xrange(n):
    x = random_between(A, B)
    y = random_between(B, C)
    z = random_between(C, A)
    area_of_triangle = area(x,y,z)
    area_percents.append(area_of_triangle/AREA)
    if area_of_triangle >= HALF_AREA:
        count+=1

print "P(area over half) = "+str(float(count)/n)
print "Mean of the area percentages: " + str(mean(area_percents))
print "Variance of the area percentages: " + str(var(area_percents))

## I got the numbers for the distribution like this
## but there must be a better way to make a graph (with some libraries)
"""
graph = {}
categories = 100
d = 1.0/categories
for i in xrange(categories):
    # i ~ [i*d, (i+1)*d)
    graph[i] = 0

for x in area_percents:
    i = 0
    while x > (i+1)*d:
        i += 1
    graph[i] += 1

for x in graph.keys():
    print graph[x]
"""