Here is a neat little formula for generating Pythagorean triples, which are positive integers which could form the side lengths of a right triangle.
For example, with m = 2 and n = 1, we get the familiar triangle with side lengths 3, 4, and 5. You can see that there is an infinite number of different Pythagorean triples, because the number of natural numbers is infinite.
Where a, b, and c have no common factors, the triple is called a fundamental Pythagorean triple or a primitive Pythagorean triple. It can be shown that, where m and n have no common factors and they are not both odd, the formula above generates a fundamental Pythagorean triple. This formula for generating Pythagorean triples was discovered by the Greek mathematician Diophantus around 250 A.D.
Here's a quick-and-dirty Java applet to quickly generate some Pythagorean triples. If you like Java applets, you may also want to check out my applet for Pascal's Art. Also visit cut-the-knot.org because they have some interesting ones.
Here is a table of the first few numbers generated by this formula:
m | n | Leg X | Leg Y (2mn) | Hypotenuse | Triangle Type | |
---|---|---|---|---|---|---|
Primitive | Composite | |||||
2 | 1 | 3 | 4 | 5 | P_{1} | |
3 | 1 | 8 | 6 | 10 | 2P_{1} | |
4 | 1 | 15 | 8 | 17 | P_{2} | |
5 | 1 | 24 | 10 | 26 | 2P_{4} | |
6 | 1 | 35 | 12 | 37 | P_{3} | |
7 | 1 | 48 | 14 | 50 | 2P_{7} | |
3 | 2 | 5 | 12 | 13 | P_{4} | |
4 | 2 | 12 | 16 | 20 | 4P_{1} | |
5 | 2 | 21 | 20 | 29 | P_{5} | |
6 | 2 | 32 | 24 | 40 | 8P_{1} | |
7 | 2 | 45 | 28 | 53 | P_{6} | |
4 | 3 | 7 | 24 | 25 | P_{7} | |
5 | 3 | 16 | 30 | 34 | 2P_{2} | |
6 | 3 | 27 | 36 | 45 | 9P_{1} | |
7 | 3 | 40 | 42 | 58 | 2P_{5} | |
5 | 4 | 9 | 40 | 41 | P_{8} | |
6 | 4 | 20 | 48 | 52 | 4P_{4} |
See also Pythagoras.