Suppose you had five sticks of length 1, 2, 3, 4, and 5 inches. If you chose three at random, what is the likelihood tht the three sticks could be put together, tip to tip, so as to form a triangle?
Now suppose you had twenty sticks, of lengths 1 through 20 inches. If you picked three at random, what is the likelihood that the three could be put together, tip to tip, to form a right triangle?
(Assume that a triangle has to have some area)
The following program produces two answers (one not asked): the probability that any triangle would be formed from a random selection from 20 sticks, and the probability that a
right triangle would be formed (as asked):
n = 20
PRINT
FOR i = 1 TO n  2
FOR j = i + 1 TO n  1
FOR k = j + 1 TO n
tot = tot + 1
IF k < i + j THEN
suc = suc + 1
IF i * i + j * j = k * k THEN
suc2 = suc2 + 1
PRINT STR$(i) + STR$(j) + STR$(k)
END IF
END IF
NEXT
NEXT
NEXT
PRINT
PRINT USING \"### ### #### #.####### #.#######\"; suc; suc2; tot; suc / tot; suc2 / tot
Its output,
3 4 5
5 12 13
6 8 10
8 15 17
9 12 15
12 16 20
525 6 1140 0.4605263 0.0052632
shows the 6 possibilities for forming a right triangle, out of the 1140 possible combinations of sticks that could be produced, giving a probability of .0052632 that a right triangle could be formed.
As for the unasked question, 525 out of the 1140 combinations could form
triangle, for a probability of .4605263.
For a further unasked question: as the number of sticks gets larger and larger, it seems as if the probability approaches 1/2 that some form of triangle can be formed. At n=200, it's 651750/1313400 = 0.4962312. It would be nice to prove this with multiple integrals, but when I try I get absurd answers (assuming random real numbers between 0 and 1).
What I tried was
∫{0 to 1}∫{x to 1} (1xy) dy dx
divided by
∫{0 to 1}∫{x to 1} (1y) dy dx
but along the way I got 1 for the former and 1/6 for the latter, giving a probability = 6, which is absurd.

Posted by Charlie
on 20031105 15:30:46 