Saturday, December 25, 2021

Probability of a broken stick in three pieces form a triangle.

Consider the unit interval $[0,1]$. Pick two points $A,B$ uniformly and independently in $[0,1]$. This gives three segments, $a, b, c$, formed by chopping the unit interval at $A,B$. What is the probability that the segments $a,b,c$ can form a triangle?

First we can simulate this to get an idea:

import random
n = 100000
t = 0
for i in range(n):
  v = [random.random(), random.random()]
  v.sort()
  a = v[0]
  b = v[1] - v[0]
  c = 1 - v[1]
  if (a+b>c)&(a+c>b)&(b+c>a):
    t = t+1
print(t/n)
Run here https://onecompiler.com/python/3xnebnwvm

And we see the result is about $\approx 0.25$. 

No comments:

Post a Comment