So, this is an interesting question to think about…

If you were to break a piece of spaghetti randomly twice, to yield three smaller pieces, what are the chances that your three pieces would form a triangle?

I encourage you to take some time to think about this before reading my solution.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

I had a little intuition based on the triangle inequality, which says that for any pair of sides of a triangle, their sum must be greater than the third side: a+b>c.

After making that guess, I actually tried to prove this to myself geometrically before moving to try a simulation via computer program, so I guess I’m still a mathematician at heart even though my current teaching load is all computer science courses! 🙂

The outer triangle, AEF, is the probability space for the spaghetto we’re talking about, assuming (without loss of generality) that the original spaghetto has length 1. The x-axis represents our (random) choice for the first break, which could be any number between 0 and 1 with equal/uniform probability. Let’s call the random number chosen x*. The y-axis then represents our (random) choice for the second break, which is now constrained with an upper bound of 1-x*, based on however long our first broken piece was (thus the hypotenuse of the right triangle, y=1-x). Only two breaks (or, equivalently, random numbers) are needed, 0≤x*≤1, and 0≤y*≤1-x*, since the third piece is completely determined by the first two, as 1-x*-y*.

Within our probability space, the bluish-green region in the lower right is out-of-bounds for trianglehood, since an initial break of my first piece x*>0.5 would mean that I’m left with a piece less than 0.5 which still needs to be broken into two, and that means those two pieces could never sum to more than my first piece (the triangle inequality). The magenta region near the top is similarly off-limits, even if my initial break is small enough, if my second break yields a y*>0.5, the first and third pieces could never sum to more than the second. Finally, the yellow region near the bottom represents non-triangles where both the first and second breaks are two short, yielding a combined sum less than 0.5, and therefore a third/final piece greater than 0.5 which would dominate the first two and thus not allow triangularity to flourish from our three pieces of spaghetti.

So the only triangularly-valid region is the center, which is 1/4 the total area of our probability space.

After becoming certain of this answer, I did mock up a quick random number generator function in Python:

While this was indeed closer to 0.25 than any other option in the initial poll, the fact that I ran 10,000,000 trials and got consistently less than 0.2 (and not closer to 0.25) does worry me that I coded one of the assumptions wrong. I’m still 99% certain that 0.25 is the correct answer. But if anyone spots a program error, or a logic error, please let me know!