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)
There are 20x19x18 permutations and 20x19x18/6 combinations.
The latter is
1140 distinct combinations.
As for the right triangles, just determine all Pythagorean triples with numbers ≤ 20, and you find there are six of them...
6/1140 =
1/190 =
.005263
(BTW, you can
generate all Pythagorean triples easily.)
___________________
Well... I think a more interesting possibility is to answer the FIRST question with the 20 pieces...
1 is the first leg
Can't, because that wouldn't make a triangle.
2 is the first leg
(The other two sides must be adjacent... like 3&4, or 16&17 inches)
2, 3, 4
2, 4, 5
...
2, 19, 20
The second leg determines the third leg, and the second ranges from 3-19, so
17 possibilities.
3 is the first leg
(The other two must be within 2 of each other)
3, 4, 5
3, 4, 6
3, 5, 6
3, 5, 7
...
3, 18, 19
3, 18, 20
3, 19, 20
The second leg determines TWO third legs, and the second ranges from 4-19, but there's no 21 (so 19 as a 2nd leg only produces one triangle)
So, we have 15 x 2 + 1 =
31 additional possibilities.
4 is the first leg
4, 5, 6
4, 5, 7
4, 5, 8
4, 6, 7
...
4, 17, 18
4, 17, 19
4, 17, 20
4, 18, 19
4, 18, 20
4, 19, 20
The second leg determines THREE third legs, and the second ranges from 5-19, but with 18 and 19 you can't go past 20 inches...
So, we have 13 x 3 + 2 + 1 =
42 additional possibilities
5 is the first leg
The second leg determines FOUR third legs, and second ranges from 6-19, but with 17-19, you can't go past 20 inches...
So, we have 11 x 4 + 3 + 2 + 1 =
50 additional possibilities
6 is the first leg
The second leg determines FIVE third legs, and second ranges from 7-19, but with 16-19, you can't go past 20 inches...
So, we have 9 x 5 + 4 + 3 + 2 + 1 =
55 additional possibilities
7 is the first leg
The second leg determines SIX third legs, and second ranges from 8-19, but 15-19, have limited third legs...
So, we have 7 x 6 + 5 + 4 + 3 + 2 + 1 =
57 additional possibilities
8 is the first leg
SEVEN third legs each, 2nd ranges from 9-19, 14-19 are limited, so we have
5 x 7 + 6 + 5 + 4 + 3 + 2 + 1 =
56 additional
9 is the first leg
EIGHT third legs each, 2nd ranges from 10-19, 13-19 are limited, so we have
3 x 8 + 7 + 6 + 5 + 4 + 3 + 2 + 1 =
52 additional
10 is the first leg
Now, they're all limited... and we can simply take the rest 2 at a time...
There are 10 (11 through 20) others... taken two at a time...
So, 10x9 / 2 =
45 additional
11 is the first leg
There are 9 (12-20) others, taken two at a time...
So, 9x8 / 2 =
36 additional
and so on:
12: 8x7/2 =
28 additional
13: 7x6/2 =
21 additional
14: 6x5/2 =
15 additional
15: 5x4/2 =
10 additional
16: 4x3/2 =
6 additional
17: 3x2/2 =
3 additional
18: 2x1/2 =
1 additional
and of course 19 and 20 can't be the first leg
So... assuming I haven't made any errors... we add this all up... and we get
17 + 31 + 42 + 50 + 55 + 57 + 56 + 52 + 45 + 36 + 28 + 21 + 15 + 10 + 6 + 3 + 1
= 525
divided by the total combinations =
525/1140 =
35/76 =
.460526315
_________________________
Now, frankly, I think this would have been easier to brute force with a simple computer program... but I think Charlie said he wanted to do that. :-)
Oh, whoops... he already did it... :-)