# Triangle forming probability for area

Say you have a stick which breaks randomly into three pieces (we can choose the points randomly). What is the probability that the area is greater than or equal to $0.4$?

I can see it has something to do with Heron's formula but I just can't put t together.

• what's the length of the stick? – Saketh Malyala Jul 5 '17 at 4:10
• Simulation suggests about $0.26$ for the conditional probability and that the expected value of the area is about $0.0299$, assuming the length of the stick is $1$ – Henry Jul 5 '17 at 7:46
• I get conditional probability = $\displaystyle\;4\int_{a}^{b} \sqrt{x^2(1-x^2)^2 - 0.32^2} dx \approx 0.2586458\;$ where $a \approx 0.37111$, $b \approx 0.76139$ are the two roots of polynomial $x(1-x^2) - 0.32$ in $(0,1)$. – achille hui Jul 5 '17 at 9:51
• @amWhy: it is a duplicate, but the earlier question (from the same person) does not have a response – Henry Jul 5 '17 at 20:46
• When this question has an answer, closing this as a duplicate to a question without answer (even from same user) server no useful purposes. A better choice is ask the OP to delete the old question. – achille hui Jul 5 '17 at 21:11

We will assume the length of the stick is $1$ and we break the stick by picking two points $u, v$ uniformly and independently from $(0,1)$.

Let $a = \min(u,v)$, $b = 1 - \max(u,v)$ and $c = |u-v| = 1 - a - b$. $a, b, c$ forms the sides of a triangle when and only when

$$a \le b+c,\;b \le c+a,\;c \le a+b\;\iff\;a \le \frac12,\;b \le \frac12,\;a+b \ge \frac12$$

Change variable to $x = 1-2a, y = 1-2b$, the lengths $a,b,c$ forms a triangle when $(x,y)$ falls inside another triangle $$\Delta = \big\{ (x,y) : x \ge 0, y \ge 0, x+y \le 1 \big\}$$ with area $\frac12$. It is clear conditional to $a,b,c$ forming a triangle, the probability "density" of picking a particular $(x,y)$ is $2dxdy$.

Let $A$ be the area of a triangle with sides $a,b,c$ and $A_0 = 0.04$. By Heron's formula, we have

\begin{align} A &= \sqrt{s(s-a)(s-b)(s-c)}\\ \iff 16A^2 & = 1(1-2a)(1-2b)(1-2c) = xy(1-x-y)\\ \iff 64A^2 & = ((x+y)^2 - (x-y)^2)(1-x-y) \end{align} Change variable once again to $p = (x+y), q = (x-y)$, the triangle $\Delta$ becomes

$$\Delta' = \big\{ (p,q) : 0 \le |q| \le p \le 1 \big\}$$

Furthermore,

$$A \ge A_0 \quad\iff\quad (p^2 - q^2)(1-p) \ge (8A_0)^2 \quad\iff\quad q^2 \le p^2 - \frac{(8A_0)^2}{1-p}$$ Let $\displaystyle\;f(p) = \sqrt{p^2 - \frac{(8A_0)^2}{1-p}}\;$ and $\lambda_1, \lambda_2$ be the two roots of $f(p)$ in $(0,1)$. The condition above is equivalent to $\lambda_1 \le p \le \lambda_2$ and $|q| \le f(p)$. Since $dpdq = 2dxdy$, the probability we seek equals to

$$\mathbb{P}[A\ge A_0] = \int_{\lambda_1}^{\lambda_2} \int_{-f(p)}^{f(p)} dqdp = 2\int_{\lambda_1}^{\lambda_2} f(p) dp$$

Change variable to $t = \sqrt{1-p}$, this becomes

$$\mathbb{P}[A\ge A_0] = 4\int_{\mu_1}^{\mu_2} \sqrt{t^2(1-t^2)^2 - (8A_0)^2} dt\tag{*1}$$

where $\mu_1, \mu_2$ are now the roots of the polynomial $\;t(1-t^2) - 8A_0\;$ in $(0,1)$.

For the problem at hand where $A_0 = 0.04$, we have

$$\mu_1 \approx 0.3711104191979701,\; \mu_2 \approx 0.7613913530813122$$ and $(*1)$ evaluates numerically to $$\mathbb{P}[A\ge A_0] \approx 0.2586458039398669$$ This is compatible with what another user @Henry obtained through simulation.

• Superb!! (+1). I tried in these lines and confirmed my approach through your answer – Satish Ramanathan Jul 6 '17 at 0:52
• @achillehui What numerical procedure did you follow to compute $(*1)$? My answer is coming out to be $\approx 0.249004$ which is different from our answer. I am trying to understand the reason behind the difference in the error. – Dhruv Kohli - expiTTp1z0 Jul 6 '17 at 5:32
• @expiTTp1z0 I have asked two CAS (maxima and WA) to compute the integral numerically and they return same number (upto last two digits, the difference most likely caused by rounding error on maxima). – achille hui Jul 6 '17 at 5:51
• @achillehui Can you please check this: Let $E$ be the event that three pieces form a triangle, then, $P(E) = 0.25$ and $P(A\geq0) = P(A\geq0|E)P(E) + P(A\geq0|E^C)P(E^C) = P(A\geq0|E)0.25 + 0 = 1 \cdot 0.25 = 0.25$ So how can $P(A\geq 0.04) > 0.25$ be true? Am I doing some mistake. – Dhruv Kohli - expiTTp1z0 Jul 6 '17 at 8:39
• @expiTTp1z0 the probability we are computing is the probability condition to three sticks forming a triangle. It is 4 times of that probability if we include events where triangle inequalities are violated. $\mathbb{P}[A > 0]$, or more precisely $\mathbb{P}[ A > 0 : \text{ forms a triangle } ]$, equals to $1$. There is no a prior reason for $P(A \ge 0.04 ) \le 0.25$. – achille hui Jul 6 '17 at 8:53

Assuming the length of stick is $2$. Let $X_1$ and $X_2$ be randomly sampled from $\text{Uniform}(0,2)$ and let $X_{(1)}, X_{(2)}$ be the order statistic.

The length of the three pieces will be,

$$a=X_{(1)},\ \ b=X_{(2)}-X_{(1)},\ \ c=2-X_{(2)}$$

Using,

• triangle inequality ($a+b\geq c, b+c \geq a, c+a\geq b$) and
• the range of $X_{(1)}$ and $X_{(2)}$ ($0 \leq X_{(1)} \leq X_{(2)} \leq 2$),

one can obtain the following condition for the three pieces to form a triangle,

$$0 \leq X_{(1)} \leq 1, \ \ 1 \leq X_{(2)} \leq 1+X_{(1)}$$

Using Heron's Formula,

$$A^2 = s(s-a)(s-b)(s-c) = 1(1-X_{(1)})(1-X_{(2)}+X_{(1)})(1-2+X_{(2)})$$

$$A^2 = X_{(1)}^2-X_{(2)}^2 +2X_{(2)} +X_{(1)}X_{(2)}^2-X_{(1)}^2X_{(2)}-X_{(1)}X_{(2)}-1$$

Let $E$ be the event that the three pieces form a triangle, then,

$$E = \{0 \leq X_{(1)} \leq 1 \text{ and } 1 \leq X_{(2)} \leq 1+X_{(1)}\}$$

and we need to find,

$$P(A^2 > c) = P(A^2>c|\text{E})P(E) + P(A^2>c|E^C)P(E^C) = P(A^2>c|E)P(E)$$

The joint pdf of $X_{(1)}, X_{(2)}$ is given by,

$$f_{X_{(1)},X_{(2)}}(x_1, x_2) = 2 \cdot \frac{1}{2} \cdot \frac{1}{2} = \frac{1}{2}, \ \ x_1, x_2 \in [0,2],\ x_1 \leq x_2$$

And therefore the probability of the event $E$ is,

$$P(E) = \int_{0}^{1}\int_{1}^{1+X_{(1)}}f_{X_{(1)},X_{(2)}}(x_1, x_2) \partial x_2 \partial x_1 = \frac{1}{4}$$

The conditional joint pdf of $X_{(1)}, X_{(2)}$ conditioned on $E$ is,

\begin{align} f_{X_{(1)},X_{(2)}|E}(x_1, x_2) &= \frac{f_{X_{(1)}, X_{(2)}}(x_1\mathbb{I}(x_1 \in [0,1]), x_2\mathbb{I}(x_2 \in [1, 1+x_1]))}{P(E)}\\\\ &= \frac{1/2}{1/4} \\\\ &= 2,\ x_1 \in [0,1], x_2 \in [1,1+x_1]\end{align}

Introduce two random variables $U$ and $V$ as follows,

$$U = X_{(1)}$$

$$V = A^2 = X_{(1)}^2-X_{(2)}^2 +2X_{(2)} +X_{(1)}X_{(2)}^2-X_{(1)}^2X_{(2)}-X_{(1)}X_{(2)}-1$$

Writing $X_{(1)}$ and $X_{(2)}$ in the form of $U$ and $V$,

$$X_{(1)} = U$$

$$X_{(2)}^2(1-U) + X_{(2)}(U^2+U-2)+V+1-U^2=0 \\\\ \implies X_{(2)}^2 - X_{(2)}(U+2)-\frac{V+1-U^2}{U-1}=0 \\\\ \implies X_{(2)} = \frac{U+2 \pm\sqrt{(U+2)^2+\frac{4(V+1-U^2)}{U-1}}}{2}$$

Based on the values $X_{(1)}, X_{(2)}$ can take so as to form a triangle, we obtain the values that $U$ and $V$ can take,

$$0 \leq U \leq 1, \ \ 1 \leq \frac{U+2 \pm\sqrt{(U+2)^2+\frac{4(V+1-U^2)}{U-1}}}{2} \leq 1+U \\\\ \implies 0 \leq U \leq 1, \ \ 0 \leq V \leq \frac{U^2(1-U)}{4}$$

In order to obtain the pdf of $U, V$ conditioned on $E$, we compute the determinant of the Jacobian of $X_{(1)}, X_{(2)}$ with respect to $U, V$ as follows,

$$J = \begin{pmatrix} \frac{\partial X_{(1)}}{\partial U} & \frac{\partial X_{(1)}}{\partial V} \\ \frac{\partial X_{(2)}}{\partial U} & \frac{\partial X_{(2)}}{\partial V} \end{pmatrix} = \begin{pmatrix}1 & 0 \\ \ldots & \frac{\pm 1}{\sqrt{((U+2)(U-1))^2+4(V+1-U^2)(U-1)}}\end{pmatrix} \\ \implies |det J| = \frac{1}{\sqrt{((U+2)(U-1))^2+4(V+1-U^2)(U-1)}}$$

Corresponding to the $\pm$ sign in above matrix, let there be two different matrices $J_+, J_-$. For both matrices, $|det J_{+}| = |det J_{-}| = |det J|$.

Now, we compute the pdf of $U,V$ conditioned on $E$,

\begin{align} f_{U,V|E}(u,v) &= f_{X_{(1)}, X_{(2)}|E}\left(u, \frac{u+2 +\sqrt{(u+2)^2+\frac{4(v+1-u^2)}{u-1}}}{2}\right) |det J_{+}| \\\\ & \ \ \ + f_{X_{(1)}, X_{(2)}|E}\left(u, \frac{u+2 -\sqrt{(u+2)^2+\frac{4(v+1-u^2)}{u-1}}}{2}\right) |det J_{-}| \\\\ &= 2 \cdot 2 \cdot |det J| \\\\ &= \frac{4}{\sqrt{((u+2)(u-1))^2+4(v+1-u^2)(u-1)}}\end{align}

It is easy to $\color{red}{\text{verify}}$ that,

$$\int_{0}^{1}\int_{0}^{\frac{u^2(1-u)}{4}}\frac{4}{\sqrt{((u+2)(u-1))^2+4(v+1-u^2)(u-1)}} \partial v \partial u = \int_{0}^{1} 2u \partial u = 1$$

Integrate over $U$ to obtain the marginal distribution of $V$ conditioned on $E$,

$$f_{V|E}(v) = \int_{u:\ 0 \leq u \leq 1,\ \ 0 \leq v \leq \frac{u^2(1-u)}{4}} f_{U,V|E}(u,v) \partial u$$

The cdf of $V$ conditioned on $E$ will then be,

$$P(V \leq c | E) = \int_{0}^{c}\int_{u:\ 0 \leq u \leq 1,\ \ 0 \leq v \leq \frac{u^2(1-u)}{4}} f_{U,V|E}(u,v)\partial u \partial v$$

Consider the equation $v = f(u) = \frac{u^2(1-u)}{4}, \ u \in [0,1]$. For a particular value of $v = c > 0$, there are two values of $u$ satisfying the equation. Let those values be $u_0$ and $u_1$.

Note that $u_0 \in [0,f^{-1}(v_{max})] \equiv [0,\frac{2}{3}]$ and $u_1 \in [f^{-1}(v_{max}), 1] \equiv [\frac{2}{3},1]$. With this argument, the above integral can be written as,

\begin{align}P(V \leq c | E) &= \int_{0}^{u_0}\int_{0}^{\frac{u^2(1-u)}{4}} f_{U,V|E}(u,v)\partial v \partial u + \int_{u_0}^{u_1}\int_{0}^{c} f_{U,V|E}(u,v) \partial v \partial u \\\\ & \ \ \ \ + \int_{u_1}^{1}\int_{0}^{\frac{u^2(1-u)}{4}} f_{U,V|E}(u,v)\partial v \partial u\\\\ &= \int_{0}^{u_0}2udu + \int_{u_0}^{u_1}\left(\frac{2 \sqrt{(u-1) (u^3 - u^2 + 4c)}}{u-1} + 2u \right) \partial u + \int_{u_1}^{1}2u \partial u\\\\ &= u_0^2 + \int_{u_0}^{u_1}\frac{2 \sqrt{(u-1) (u^3 - u^2 + 4c)}}{u-1} \partial u + u_1^2 - u_0^2 + 1 - u_1^2 \\\\ &= 1 + \int_{u_0}^{u_1}\frac{2 \sqrt{(u-1) (u^3 - u^2 + 4c)}}{u-1} \partial u \end{align}

Finally,

\begin{align} P(A^2>c) &= P(A^2 > c|E)P(E) \\\\ &= (1-P(V \leq c|E))P(E) \\\\ &= \left(- \int_{u_0}^{u_1}\frac{2 \sqrt{(u-1) (u^3 - u^2 + 4c)}}{u-1} \partial u \right)P(E) \end{align}

Now, the value of $c$ is $0.04^2$ for the case when the length of the stick is $1$. Scaling up this value for the stick of length $2$ so that the probability doesn't change,

$$\frac{c_{new}}{\text{(max area in case of length 2 stick)}^2} = \frac{c_{old}}{\text{(max area in case of length 1 stick)}^2} \\\\ \implies \frac{c_{new}}{\left(\frac{\sqrt{3}}{9}\right)^2} = \frac{c_{old}}{\left(\frac{\sqrt{3}}{36}\right)^2} \\\\ \implies c_{new} = 0.0256$$

For $c > 0$, the values $u_0$ and $u_1$ are the solutions of $c = \frac{u^2(1-u)}{4}$ in the intervals $[0,\frac{2}{3}]$ and $(\frac{2}{3}, 1]$, respectively. Therefore, for $c = c_{new} = 0.0256$, $u_0 = 0.420283$ and $u_1 = 0.862277$. Putting these values in the last equation,

$$P(A^2 > c_{new} | E) = -\int_{u_0}^{u_1}\frac{2 \sqrt{(u-1) (u^3 - u^2 + 4c_{new})}}{u-1} \partial u \approx \color{blue}{0.258646}$$

$$P(A^2 > c_{new}) = \frac{-\int_{u_0}^{u_1}\frac{2 \sqrt{(u-1) (u^3 - u^2 + 4c_{new})}}{u-1} \partial u}{4} = \color{blue}{0.0646615}$$

Note: Used Wolfram to compute the value of the integral.

• It should be compared to $\sqrt 3/9$ when the stick breaks to 3 equal parts. – Narasimham Jul 5 '17 at 5:45
• I suspect you are supposed to assume the length of the stick is $1$ – Henry Jul 5 '17 at 7:46
• @Henry The main ideas will remain same even if the length of the stick is taken to be $2$. I took the length as $2$ so that the semi perimeter becomes $1$. Spent few hours, still couldn't find the closed form solution. I ll try again later. – Dhruv Kohli - expiTTp1z0 Jul 5 '17 at 10:55
• I voted up for your try. Good try!! – Satish Ramanathan Jul 6 '17 at 0:53
• @satishramanathan Thanks. I have completed my solution now. – Dhruv Kohli - expiTTp1z0 Jul 6 '17 at 5:13