# Probability of forming a triangle

#### MarkFL

Staff member
You have a thin rod of length $\ell$ and you cut it randomly into three pieces. Calculate the probability that the three pieces can form a triangle.

#### Opalg

##### MHB Oldtimer
Staff member
You have a thin rod of length $\ell$ and you cut it randomly into three pieces. Calculate the probability that the three pieces can form a triangle.
This sort of probability is a bit outside my usual comfort zone, but I'll have a go at it.

The length $\ell$ is immaterial, so I'll assume $\ell=1$.

Suppose that the cuts occur at $y$ and $x$, with $x,\,y$ independently uniformly distributed in $[0,1]$ and $x$ denoting the larger of them. We must have $x\geqslant1/2$ if the three segments are to form a triangle (because none of the sides can be greater than $1/2$). So one side on the triangle has length $1-x$. The difference between the other two sides must be at most $1-x$, and so $y$ must lie in the interval $\bigl[x-\tfrac12,\tfrac12\bigr]$, of length $1-x$ (see the picture). The probability of that happening (for a given $x$) is $\frac{1-x}x$. However, the probability distribution of $x$ (as the maximum of the two cut points) is not uniform, but has p.d.f. $2x$. So the overall probability of the three segments forming a triangle is $$\int_{1/2}^1 \frac{1-x}x\,2x\,dx = \Bigl[2x-x^2\Bigr]_{1/2}^1 = 1-\frac34 = \frac14.$$

(I hope that's right!)​

#### chisigma

##### Well-known member
You have a thin rod of length $\ell$ and you cut it randomly into three pieces. Calculate the probability that the three pieces can form a triangle.
Clearly we can suppose without loss of generality that $\ell=1$. Setting $x_{1}$, $x_{2}$ and $x_{3}$ the length ot the three segments, the requested probability is the probability that none of the lengths of the segments is greater that $\frac{1}{2}$, i.e. ...

$$P = \int_{0}^{\frac{1}{2}} \int_{\frac{1}{2}- x_{1}}^{\frac{1}{2}} \frac{1}{1-x_{1}}\ d x_{2}\ d x_{1} = \frac{1}{2}\ \int_{0}^{\frac{1}{2}} \frac{x_{1}}{1 - x_{1}}\ d x_{1} = |- x_{1} - \ln (1-x_{1})|_{0}^{\frac{1}{2}} = - \frac{1}{2} + \ln 2 = .19314718...$$

Kind regards

$\chi$ $\sigma$

Last edited:

#### MarkFL

Staff member
This sort of probability is a bit outside my usual comfort zone, but I'll have a go at it.

The length $\ell$ is immaterial, so I'll assume $\ell=1$.

Suppose that the cuts occur at $y$ and $x$, with $x,\,y$ independently uniformly distributed in $[0,1]$ and $x$ denoting the larger of them. We must have $x\geqslant1/2$ if the three segments are to form a triangle (because none of the sides can be greater than $1/2$). So one side on the triangle has length $1-x$. The difference between the other two sides must be at most $1-x$, and so $y$ must lie in the interval $\bigl[x-\tfrac12,\tfrac12\bigr]$, of length $1-x$ (see the picture). The probability of that happening (for a given $x$) is $\frac{1-x}x$. However, the probability distribution of $x$ (as the maximum of the two cut points) is not uniform, but has p.d.f. $2x$. So the overall probability of the three segments forming a triangle is $$\int_{1/2}^1 \frac{1-x}x\,2x\,dx = \Bigl[2x-x^2\Bigr]_{1/2}^1 = 1-\frac34 = \frac14.$$

(I hope that's right!)​
Your result is correct, but I have used a pre-calculus method to solve the problem which I will post within 24 hours, to give a few others a chance to write a solution.

I appreciate seeing a more advanced technique!

#### chisigma

##### Well-known member
Clearly we can suppose without loss of generality that $\ell=1$. Setting $x_{1}$, $x_{2}$ and $x_{3}$ the length ot the three segments, the requested probability is the probability that none of the lengths of the segments is greater that $\frac{1}{2}$, i.e. ...

$$P = \int_{0}^{\frac{1}{2}} \int_{\frac{1}{2}- x_{1}}^{\frac{1}{2}} \frac{1}{1-x_{1}}\ d x_{2}\ d x_{1} = \frac{1}{2}\ \int_{0}^{\frac{1}{2}} \frac{x_{1}}{1 - x_{1}}\ d x_{1} = |- x_{1} - \ln (1-x_{1})|_{0}^{\frac{1}{2}} = - \frac{1}{2} + \ln 2 = .19314718...$$

Kind regards

$\chi$ $\sigma$
Because a different solution with different result has been proposed the 'mental construction' I followed has to be explained with the scope to identify my error...

If $x_{1}$ is the first segment and we suppose it uniformely distributed in $[0,1]$, then $x_{2}$ is uniformely distributed in $[0,1 - x_{1}]$. The condition that $x_{1}$, $x_{2}$ and $x_{3}$ are the sides of the triangle means that none of them exceeds $\frac{1}{2}$ so that we are searching the probability that $\frac{1}{2} -x < x_{2} < \frac{1}{2}$ conditioned by the probability that $x_{1} = x < \frac{1}{2}$ ...

Kind regards

$\chi$ $\sigma$

#### chisigma

##### Well-known member
Because a different solution with different result has been proposed the 'mental construction' I followed has to be explained with the scope to identify my error...

If $x_{1}$ is the first segment and we suppose it uniformely distributed in $[0,1]$, then $x_{2}$ is uniformely distributed in $[0,1 - x_{1}]$. The condition that $x_{1}$, $x_{2}$ and $x_{3}$ are the sides of the triangle means that none of them exceeds $\frac{1}{2}$ so that we are searching the probability that $\frac{1}{2} -x < x_{2} < \frac{1}{2}$ conditioned by the probability that $x_{1} = x < \frac{1}{2}$ ...

Kind regards

$\chi$ $\sigma$
My 'error' has been that, setting $\xi_{1}$ and $\xi_{2}$ the coordinates of the first and second selected point, I have considered only the case $\xi_{1}<\xi_{2}$ and the computed probability is...

$$P_{1} = - \frac{1}{2} + \ln 2\ (1)$$

Now if we consider also the case $\xi_{1}>\xi_{2}$ we compute the residual probability as...

$$P_{2} = \int_{\frac{1}{2}}^{1} \int_{x_{1}- \frac{1}{2}}^{\frac{1}{2}}\frac{1}{x_{1}}\ d x_{2}\ d x_{1} = \int_{\frac{1}{2}}^{1} \frac{1 - x_{1}}{x_{1}}\ d x_{1} = |\ln x_{1} - x_{1}|_{\frac{1}{2}}^{1} = \ln 2 - \frac{1}{2}\ (2)$$

... so that the final result is...

$$P=P_{1} + P_{2} = 2\ \ln 2 -1= .386294361...\ (3)$$

Kind regards

$\chi$ $\sigma$

Last edited:

#### Klaas van Aarsen

##### MHB Seeker
Staff member
$$P = \int_{0}^{\frac{1}{2}} \int_{\frac{1}{2}- x_{1}}^{\frac{1}{2}} \frac{1}{1-x_{1}}\ d x_{2}\ d x_{1} = ... = - \frac{1}{2} + \ln 2 = .19314718...$$

Kind regards

$\chi$ $\sigma$
You selected the same approach I did.

But shouldn't it be the following?
$$P = \frac {\text{sum favorable outcomes}}{\text{total sum possible outcomes}} = \frac {\displaystyle\int_{0}^{\frac{1}{2}} \int_{\frac{1}{2}- x_{1}}^{\frac{1}{2}} \ d x_{2}\ d x_{1}} {\displaystyle\int_{0}^{1} \int_{1- x_{1}}^{1} \ d x_{2}\ d x_{1}} = \frac 1 4$$

#### Prove It

##### Well-known member
MHB Math Helper
I must be missing something, because I thought you could always make a triangle out of any three lengths...

#### Bacterius

##### Well-known member
MHB Math Helper
I must be missing something, because I thought you could always make a triangle out of any three lengths...
Really?

--

--

----------------------------

Good luck

[JUSTIFY]Specifically the triangle inequality puts a lower bound on the minimum total length required of the two smaller sides in order to form a triangle. If the larger side has length L, then the two other sides must sum to a length strictly more than L in order to form a triangle (less than L and no triangle is possible, equal to L and the best you can do is a degenerate triangle with three colinear vertices).

In Euclidean space, anyway.[/JUSTIFY]

Last edited:

#### Prove It

##### Well-known member
MHB Math Helper
Really?

--

--

----------------------------

Good luck

[JUSTIFY]Specifically the triangle inequality puts a lower bound on the minimum total length required of the two smaller sides in order to form a triangle. If the larger side has length L, then the two other sides must sum to a length strictly more than L in order to form a triangle (less than L and no triangle is possible, equal to L and the best you can do is a degenerate triangle with three colinear vertices).

In Euclidean space, anyway.[/JUSTIFY]
Yes, that's what I was missing. Serves me right for picturing triangles in my mind and manipulating them, rather than picturing different lengths haha.

- - - Updated - - -

Actually, I think I'm still right - you can form a triangle with any three lengths - it's just not guaranteed that the ends of your lengths will form the vertices

#### chisigma

##### Well-known member
I apologize for the confusion I created yesterday [] and I do hope to be able to return 'on the right way'...

We call $x_{1}$ and $x_{2}$ the sequencially selected r.v., both uniformely distributed in [0,1]. Once we have selected $x_{1}$ we have two possibilities...

a) may be that $x_{2} > x_{1}$ with probability $1-x_{1}$ and in this case the probability that none of the segments is greater than $\frac{1}{2}$ is...

$$P_{a}= \frac{1}{2}\ \int_{0}^{\frac{1}{2}} \int_{x_{1}}^{x_{1} + \frac{1}{2}} d x_{2}\ d x_{1} = \frac{1}{8}\ (1)$$

b) may be that $x_{2} < x_{1}$ with probability $x_{1}$ and in this case the probability that none of the segments is greater than $\frac{1}{2}$ is...

$$P_{b}= \frac{1}{2}\ \int_{\frac{1}{2}}^{1} \int_{x_{1} - \frac{1}{2}}^{x_{1}} d x_{2}\ d x_{1} = \frac{1}{8}\ (2)$$

Combining a) and b) we have...

$$P = P_{a} + P_{b} = \frac{1}{4}\ (3)$$

Kind regards

$\chi$ $\sigma$

#### MarkFL

Staff member
Like everyone else, I observed that without loss of generality, we may let the rod be of unit length.

Let $x$ be the length of the first piece, $y$ be the length of the second piece, then $1-(x + y)$ will be the length of the third. We know we must have:

$$\displaystyle 0<x<1$$

$$\displaystyle 0<y<1$$

$$\displaystyle 0<1-(x + y)< 1$$

Graphing these 3 inequalities, we find that we may represent the total sample space $S$ by the area bounded by the lines:

$$\displaystyle x=0$$

$$\displaystyle y=0$$

$$\displaystyle x+y=1$$

which is a right isosceles triangle of area $$\displaystyle A_S=\frac{1}{2}$$. Each point in $S$ represents a possible partitioning of the rod. This area is shaded in red:

By the triangle inequality, we know all of the pieces must be less than 1/2 unit in length:

$$\displaystyle 0<x<\frac{1}{2}$$

$$\displaystyle 0<y<\frac{1}{2}$$

$$\displaystyle 0<1-(x+y)<\frac{1}{2}$$

Graphing these 3 inequalities, we find that we may represent these conditions by the area $T$ bounded by the lines:

$$\displaystyle x=\frac{1}{2}$$

$$\displaystyle y=\frac{1}{2}$$

$$\displaystyle x+y=\frac{1}{2}$$

which is a right isosceles triangle of area $$\displaystyle A_T=\frac{1}{8}$$. Each point in $T$ represents a partitioning in which a triangle may be formed. This area is shaded in green:

Thus, the probability in question is:

$$\displaystyle P(\text{triangle is possible})=\frac{A_T}{A_S}=\frac{1}{4}$$

#### Opalg

##### MHB Oldtimer
Staff member
I just came across this page, with two very clever solutions to the problem.

#### bl00d

##### New member
This sort of probability is a bit outside my usual comfort zone, but I'll have a go at it.

The length $\ell$ is immaterial, so I'll assume $\ell=1$.

Suppose that the cuts occur at $y$ and $x$, with $x,\,y$ independently uniformly distributed in $[0,1]$ and $x$ denoting the larger of them. We must have $x\geqslant1/2$ if the three segments are to form a triangle (because none of the sides can be greater than $1/2$). So one side on the triangle has length $1-x$. The difference between the other two sides must be at most $1-x$, and so $y$ must lie in the interval $\bigl[x-\tfrac12,\tfrac12\bigr]$, of length $1-x$ (see the picture). The probability of that happening (for a given $x$) is $\frac{1-x}x$. However, the probability distribution of $x$ (as the maximum of the two cut points) is not uniform, but has p.d.f. $2x$. So the overall probability of the three segments forming a triangle is $$\int_{1/2}^1 \frac{1-x}x\,2x\,dx = \Bigl[2x-x^2\Bigr]_{1/2}^1 = 1-\frac34 = \frac14.$$

(I hope that's right!)​
can i ask why the pdf of x is 2x?

##### Active member
can i ask why the pdf of x is 2x?
The key here is that x is defined to be the maximum of the two cuts. Since we have two (probabilistically) independent cuts, each with a uniform pdf, their maximum will have a pdf of 2x.

For my own sake, I will try to put together (and post) a more formal argument for the above statement. It agrees with my intuition, but requires probing.

#### bl00d

##### New member
The key here is that x is defined to be the maximum of the two cuts. Since we have two (probabilistically) independent cuts, each with a uniform pdf, their maximum will have a pdf of 2x.

For my own sake, I will try to put together (and post) a more formal argument for the above statement. It agrees with my intuition, but requires probing.
thanks a lot im new

##### Active member
The key here is that x is defined to be the maximum of the two cuts. Since we have two (probabilistically) independent cuts, each with a uniform pdf, their maximum will have a pdf of 2x.

For my own sake, I will try to put together (and post) a more formal argument for the above statement. It agrees with my intuition, but requires probing.
This comes from a neat little trick I picked up in probstats, which I'm glad I found useful enough to remember.

Suppose that u and v are taken to be two independent cuts, each with a uniform distribution. We then take the definitions $x:=max\{u,v\}$ and $y:=min\{u,v\}$. Now, I will state that for any $t\in[0,1]$, we have:
$$P(x\leq t) = P(u\leq t)\, P(v\leq t) = (t)(t) = t^2$$
Note that the above holds because u and v follow independent uniform distributions over $[0,1]$.

From there, by the definition of a probability distribution, we have
$$\int_0^t pdf_x(x)\,dx = t^2$$
Now for the clever bit: we differentiate both sides with respect to t, applying the fundamental theorem of calculus. Doing so gives us
$$pdf_x(t)=2t$$
as desired.

Last edited:

#### Opalg

##### MHB Oldtimer
Staff member
can i ask why the pdf of x is 2x?
The pdf for a uniformly distributed variable on the unit interval is the constant function $1$. The cumulative distribution function (cdf) is the integral of the pdf, namely the function $x$. The rule (which I don't know how to prove, not being a probabilist) is that for the maximum of two independent random variables, you multiply the cdf's. In this case, that gives you $x^2$ for the cdf of the max. You then differentiate the cdf to get the pdf, so that is where the $2x$ comes from.

Suppose $Z=\max(X,Y)$ with independent $X$ and $Y$, then:
$$P(Z \le z)=P(X \le z \wedge Y \le z)=P(X \le z) P(Y \le z) \qquad \blacksquare$$