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 | P1 | |
3 | 1 | 8 | 6 | 10 | 2P1 | |
4 | 1 | 15 | 8 | 17 | P2 | |
5 | 1 | 24 | 10 | 26 | 2P4 | |
6 | 1 | 35 | 12 | 37 | P3 | |
7 | 1 | 48 | 14 | 50 | 2P7 | |
3 | 2 | 5 | 12 | 13 | P4 | |
4 | 2 | 12 | 16 | 20 | 4P1 | |
5 | 2 | 21 | 20 | 29 | P5 | |
6 | 2 | 32 | 24 | 40 | 8P1 | |
7 | 2 | 45 | 28 | 53 | P6 | |
4 | 3 | 7 | 24 | 25 | P7 | |
5 | 3 | 16 | 30 | 34 | 2P2 | |
6 | 3 | 27 | 36 | 45 | 9P1 | |
7 | 3 | 40 | 42 | 58 | 2P5 | |
5 | 4 | 9 | 40 | 41 | P8 | |
6 | 4 | 20 | 48 | 52 | 4P4 |
See also Pythagoras.