Triangle inequality

FreeProbabilityEasyJane StreetSIGFive Rings

Three independent random variables XX, YY, and ZZ are each uniformly distributed on [0,1][0, 1]. What is the probability that XX, YY, and ZZ are the side lengths of a valid triangle?

Solution

Idea

Work with the complement: a triple fails the triangle inequality if and only if one side is at least as large as the sum of the other two. The three failure events turn out to be mutually exclusive, so the failure probability is simply 3P(A)3P(A) for any one of them.

Setup

Let X,Y,ZiidUniform[0,1]X, Y, Z \overset{\text{iid}}{\sim} \text{Uniform}[0,1]. Define the failure events

A={X+YZ},B={X+ZY},C={Y+ZX}.A = \{X+Y \le Z\}, \quad B = \{X+Z \le Y\}, \quad C = \{Y+Z \le X\}.

Mutual Exclusivity of AA, BB, CC

Suppose ABA \cap B occurs: X+YZX+Y \le Z and X+ZYX+Z \le Y. Adding these inequalities gives 2X+Y+ZY+Z2X + Y + Z \le Y + Z, hence X0X \le 0. Since X0X \ge 0 a.s., this forces X=0X = 0, an event of probability zero. By symmetry, every pairwise intersection has measure zero, so AA, BB, CC are mutually exclusive a.s. Combined with symmetry of the joint distribution,

P(ABC)=P(A)+P(B)+P(C)=3P(A).P(A \cup B \cup C) = P(A) + P(B) + P(C) = 3\,P(A).

Computing P(A)P(A)

Condition on Z=zZ = z. The event {X+Yz}\{X + Y \le z\} within [0,1]2[0,1]^2 traces the right triangle {x0,y0,x+yz}\{x \ge 0,\, y \ge 0,\, x+y \le z\}, which has area z2/2z^2/2. Therefore

P(A)=01z22dz=1213=16.P(A) = \int_0^1 \frac{z^2}{2}\,dz = \frac{1}{2} \cdot \frac{1}{3} = \frac{1}{6}.

Final Answer

P(valid triangle)=1316=112=12.P(\text{valid triangle}) = 1 - 3 \cdot \frac{1}{6} = 1 - \frac{1}{2} = \boxed{\dfrac{1}{2}}.

Related problems