Generating Pythagorean Triples
Here is a neat little formula for generating Pythagorean triples,
which are positive integers which could form a
right triangle.
- Take any two positive integers. Call the larger m and the smaller n.
- The legs of the right triangle are given by m² - n²
and 2mn, and the hypotenuse is m² + n².
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.
Here's a quick-and-dirty Java applet to calculate some values quickly.
If you're a big fan of Java applets, you may also want to check out
my applet for Pascal's Art. Also visit
cut-the-knot.com because
they have some interesting ones.
View Source Code.
Here is a table of the first few numbers generated by this formula:
| a
| b
| Leg X (a2 - b2)
| Leg Y (2ab)
| Hypotenuse (a2 + b2)
| 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.
Last updated November 26, 2001.
URL: http://www.stormloader.com/ajy/pythtriples.html
For questions or comments email James Yolkowski.
Math Lair home page
|
|