Probability – Triangle Inscribed in Square Comprising at Least 1/4 of Area

contest-mathgeometric-probabilityprobability

Question: Suppose that points $P_1$, $P_2$, and $P_3$ are chosen uniformly at random on the sides of a square $T$. Compute the probability that $$\frac{[\triangle P_1 P_2 P_3]}{[T]}>\frac{1}{4}$$ where $[X]$ denotes the area of polygon $X$.

Without loss of generality, I assumed the side length of the square to be $1$. Because the question mentions $\frac{1}{4}$ of the square, I considered splitting the square into quadrants.

  • It is obvious that all three points cannot lie in the same quadrant of the square.
  • Similarly, there cannot be two points in the same quadrant because the area must be less than $\frac{1}{2} \cdot \frac{1}{2} \cdot 1=\frac{1}{4}$. [EDIT: This is wrong]

This means that all three vertices must lie in different quadrants in the square. From here, I considered cases:

Case 1: Two of the points are on the same side, which occurs with probability $\frac{9}{16}$.

Case 2: All three points are on different sides, which occurs with probability $\frac{3}{8}$.

From here, my efforts have consisted of just labeling lengths and finding the area in terms of said lengths. However, this has led me with some inequalities that I don't know how to find the probabilities of being true, namely:

  • $x-xz+yz<\frac{1}{2}$ for $0 \leq x,y,z \leq 1$
  • $(x-y)z<\frac{1}{2}$ fo $0 \leq y<x \leq 1$ and $0 \leq x \leq 1$

If anyone knows how to either find the probability of these inequalities being satisfied (which I think requires multivariable calculus) or a way that circumvents these inequalities, please let me know.


Here's my full attempt at the question, though I'm unsure about the accuracy of how I find the probabilities of the three-variable inequalities being satisfied. [NOTE: this method has a few errors in it, a correct version is in the answers below.]


Without loss of generality, consider the square with vertices $(0,0), (0,1), (1,0), (1,1)$.

We proceed using casework:

  1. All three vertices are on different sides of the square. This occurs with probability $\frac{9}{16}$.

Let the vertices be $(x_1,0)$, $(0,y_1)$, and $(x_2,1)$. Using the determinant form for the area of a triangle, the area is given by $$A=\frac{1}{2} \begin{vmatrix} x_1 & 0 & 1 \\ 0 & y_1 & 1 \\ x_2 & 1 & 1 \end{vmatrix}=\frac{1}{2}x_1-\frac{1}{2}y_1 (x_1-x_2)$$

Assume that $x_1>x_2$. Then, $$\frac{1}{2}x_1-\frac{1}{2}y_1 (x_1-x_2)>\frac{1}{4} \implies x_1-y_1 (x_1-x_2)>\frac{1}{2}$$

For convenience, replace $x_1$ with $y$, $x_2$ with $x$, and $y_1$ with $z$. We now have the system of inequalities $\begin{cases} y-yz+xz>\frac{1}{2} \\ y>x \\ 0 \leq x,y,z \leq 1 \end{cases}$.

We now consider graphing the inequality $y-yz+xz>\frac{1}{2}$ with $z$ as a constant. The $x$-intercept is $\frac{1}{2z}$ and the $y$-intercept is $\frac{1}{2(1-z)}$.

  • If $0<z \leq \frac{1}{2}$, then the area of the region is given by $\frac{4z-1}{8z-8}$. Therefore, the desired probability for this case is $\int^{\frac{1}{2}}_{0} \frac{4z-1}{8z-8} \, dz=\frac{1}{8}(2-\ln 2)$.
  • If $\frac{1}{2} \leq z<1$, then the area of the region is given by $\frac{1}{8z}$. Therefore, the desired probability for this case is $\int^{\frac{1}{2}}_{0} \frac{1}{8z}=\frac{1}{8} \ln 2$.

The overall probability for this case is $$\frac{9}{16} \cdot \frac{1}{2} \cdot \frac{1}{4}=\frac{9}{128}$$

  1. Two vertices lie on the same side of the square and the third vertex lies on the opposite side. This occurs with probability $\frac{1}{8}$.

Let the vertices be $(y,1)$, $(x,1)$, and $(z,0)$ where $y>x$. Then, the area is given by $\frac{1}{2}(y-x)$, meaning we need $y-x>\frac{1}{2}$. It is easy to find the probability for this case is $$\frac{1}{8} \cdot \frac{1}{8}=\frac{1}{64}$$

  1. Two vertices lie on the same side of the square and the third vertex lies on an adjacent side. This occurs with probability $\frac{1}{4}$.

Let the vertices of the triangle be $(x,1)$, $(y,1)$, and $(1,1-z)$ where $y>x$. Then, the area is given by $\frac{1}{2}(y-x)(z)$, meaning we need $(y-x)z>\frac{1}{2}$.

It is easy to see that this is only possible for $\frac{1}{2} \leq z <1$, in which case the probability is $\frac{2z-1}{8z^2}$. The probability for this case is thus $$\frac{1}{4} \cdot \int^{1}_{\frac{1}{2}} \frac{2z-1}{8z^2} \, dz=\frac{1}{64} \ln 4-\frac{1}{64}$$

Therefore, the final answer is $$\frac{1}{64} \ln 4-\frac{1}{64}+\frac{1}{64}+\frac{9}{128}=\boxed{\frac{9+4 \ln 2}{128}}$$

Best Answer

If I have a triangle in $\mathbb{R}^2$ with vertices at $(x_1,y_1)$, $(x_2,y_2)$, and $(x_3,y_3)$, the area of the triangle is $$\frac{1}{2}\Biggl|\begin{array}{lll}x_1 & y_1 & 1 \\ x_2 & y_2 & 1 \\ x_3 & y_3 & 1\end{array}\Biggr|,$$ where for a square matrix $A$, $|A|$ denotes the absolute value of the determinant of $A$. To avoid having to deal with the annoying $1/2$, we will look at situations where $$\Biggl|\begin{array}{lll}x_1 & y_1 & 1 \\ x_2 & y_2 & 1 \\ x_3 & y_3 & 1\end{array}\Biggr|\geqslant 1/2.$$

[https://www.cuemath.com/geometry/area-of-triangle-in-determinant-form/][1]

Everything is scale and translation invariant, so we can assume the square is in the plane with vertices at $(0,0)$, $(1,0)$, $(0,1)$, and $(1,1)$.

We let $b,t,l,r$ denote the bottom, top, left, and right edges of the square. We let $pqr$ ($p,q,r\in \{b,t,l,r\}$) denote a particular way for the vertices to land on the sides of the square. So $bbb$ means all vertices are on the bottom, $btl$ means the first vertex is on the bottom, the second is on the top, and the third is on the left. There are $1/64$ equally likely values of $pqr$. We will calculate the probability that the area $|T|$ of the triangle $T$ is at least $1/4$ given a particular $pqr$. We denote this by $\mathbb{P}(|T|\geqslant 1/4|prq)$. In other words, $\mathbb{P}(|T|\geqslant 1/4|ttb)$ denotes the probability that the area of the triangle is at least one quarter given that the first vertex is on the top edge, the second vertex is on the top edge, and the third vertex is on the bottom.

By symmetry, there are only four types of configurations we need to consider: All three points land on the same edge (which happens with probability $4/64=1/16$), two land on the same edge and one is on the opposite edge (which happens with probability $12/64=3/16$), two land on the same edge and one is on an adjacent edge (which happens with probability $24/64=3/8$), or all three land on different edges (which happens with probability $24/64=3/8$). All of the last cases are equivalent, since in that case, we have a side/adjacent side/opposite side triple.

If all three land on the same edge, the triangle has area zero, and $$\mathbb{P}(|T|\geqslant 1/4|ppp)=0$$ for $p\in \{t,b,l,r\}$.

Suppose that two land on a common edge and the third lands on the opposite edge. Without loss of generality, we can assume the first two land on the bottom and the third lands on the top. Then we have three random vectors $$\begin{pmatrix} X \\ 0 \end{pmatrix},\begin{pmatrix}Y\\0\end{pmatrix},\begin{pmatrix}Z\\1\end{pmatrix}.$$ We want to know what is the probability that $$1/2\leqslant \Biggl|\begin{array}{lll}X & 0 & 1 \\ Y & 0 & 1 \\ Z & 1 & 1\end{array}\Biggr|=|X-Y|.$$ We consider the probability that $X-Y\geqslant 1/2$ (which can happen only if $X\geqslant 1/2$) and note that, by symmetry, the probaiblity that $X-Y\leqslant -1/2$ is the same. We calculate $$\mathbb{P}(X-Y\geqslant 1/2) = \int_{1/2}^1\int_0^{x-1/2}dydx = 1/8.$$ So $\mathbb{P}(X-Y\leqslant -1/2)=1/8$, and the probability that the triangle has area at least $1/4$ in this case is $1/4$.

Assume that two vertices land on the same side and the third lands on an adjacent side. Without loss of generality, we can assume the first two vertices land on the bottom and the third lands on the left. Then we want to know the probability that $$1/2\leqslant \Biggl|\begin{array}{lll}X & 0 & 1 \\ Y & 0 & 1 \\ 0 & Z & 1\end{array}\Biggr|=Z|X-Y|.$$ Again, we check the probability that $Z(X-Y)\geqslant 1/2$ and then double this. The inequality can only be satisfied if $X-Y>1/2$, which can only happen if $X>1/2$. So $x$ will range over $(1/2,1)$, for a given $x$, $y$ will range over $(0,x-1/2)$, and for a given $x,y$, $z$ will range over $(\frac{1}{2(x-y)},1)$. Therefore we get \begin{align*}\mathbb{P}(|T|\geqslant 1/4|bbl) & = \int_{1/2}^1 \int_0^{x-1/2}\int_{\frac{1}{2(x-y)}}^1 dzdydx \\ & = \int_{1/2}^1 \int_0^{x-1/2} 1-\frac{1}{2(x-y)} dy dx \\ & = \int_{1/2}^1 x-1/2 - \frac{\log(x)-\log(1/2)}{2} dx \\ & = \frac{1}{2}\int_{1/2}^1 2x-1-\log(x)-\log(2)dx \\ & = \frac{1}{2}\Bigl[\frac{1}{4} -\frac{\log(2)}{2}+\frac{1}{2}-\frac{\log(2)}{2}\Bigr] \\ & = \frac{\frac{3}{4}-\log(2)}{2}.\end{align*} Doubling this yields that $$\mathbb{P}(|T|\geqslant 1/4|bbl)=\frac{3}{4}-\log(2).$$

Last, assume the three vertices land on three different edges. Without loss of generality, we can assume these are bottom, top, and left. We want to know the probability that $$1/2\leqslant \Biggl|\begin{array}{lll}X & 0 & 1 \\ Y & 1 & 1 \\ 0 & Z & 1\end{array}\Biggr|=|(1-Z)X+ZY|.$$ This can only ever be positive, so we need to calculate the probability that $(1-Z)X+ZY\geqslant 1/2$. Let $G=(1-Z)X+ZY$. Note that $$1-G=1-[(1-Z)X+ZY]=(1-Z)(1-X)+Z(1-Y),$$ which has the same distribution as $G=1-(1-Z)X+ZY.$ This is because $1-X,1-Y,Z$ are iid $\text{Uniform}(0,1)$ just as $X,Y,Z$ are. Since $G,1-G$ have the same distribution, $$\mathbb{P}(G\leqslant 1/2)=\mathbb{P}(1-G\leqslant 1/2).$$ But $1-G\leqslant 1/2$ iff $G\geqslant 1/2$, so $$\mathbb{P}(G\leqslant 1/2)=\mathbb{P}(G\geqslant 1/2).$$ Since $G$ is a continuous random variable, $\mathbb{P}(G=1/2)=0$, so $$\mathbb{P}((1-Z)X+ZY\geqslant 1/2)=1/2.$$

So the overall probability is $$\frac{3}{16}\Bigl(\frac{1}{4}\Bigr)+\frac{3}{8}\Bigl(\frac{3}{4}-\log(2)\Bigr)+\frac{3}{8}\Bigl(\frac{1}{2}\Bigr)=\frac{33-24\log(2)}{64}\approx 0.2556948.$$

Here's python code to simulate. It took me about 30 seconds to run. The result was $0.25581$.

import numpy as np
from numpy.linalg import det

sample_size = 10**6
result = np.empty(sample_size)

np.random.seed(123)

def put_vec(edge,position_along_edge):
    if edge == 'b':
        return([position_along_edge,0,1])
    elif edge == 't':
        return([position_along_edge,1,1])
    elif edge == 'l':
        return([0,position_along_edge,1])
    else:
        return([1,position_along_edge,1])
    
for trial in range(sample_size):
    p,q,r = np.random.choice(['b','t','l','r'],size=3,replace=True)
    X,Y,Z = np.random.uniform(size=3)
    result[trial] = 1*(abs(det(np.array([put_vec(p,X),put_vec(q,Y),put_vec(r,Z)]))) >= .5)
    
print(result.mean())
Related Question