Send
Close Add comments:
(status displays here)
Got it! This site "robinsnyder.com" uses cookies. You consent to this by clicking on "Got it!" or by continuing to use this website. Note: This appears on each machine/browser from which this site is accessed.
Pythagorean theorem
1. Pythagorean theorem
The Pythagorean theorem is a well known result about properties of right triangles.
2. Pythagoras
Pythagoras lived in Greece about 500 B.C. His most well-known result is the Pythagorean theorem. We are not otherwise concerned about Pythagoras and will ignore the fact that the result named for him appears to have been known well before his time and in many other places on the earth.
3. Right triangle
Start with a right triangle.
4. Theorem
In the image, the (red) vertical/rise y distance is
3, the (green) horizontal/run x distance is
4, and the (blue) hypotenuse distance is
5.
52 = 42 + 32
5. Pythagorean triples
A computer program can be used to find Pythagorean triples.
Here is a simple and somewhat clear Lua program, not necessarily the most efficient, to find all Pythagorean triples whose sides a and b are from 1 to 32.
6. Lua program
Here is the Lua code [#1]
7. Output
Here is the output of the Lua code.
Note that the commonly used example values 3, 4, and 5 is the minimal example of a Pythagorean triple.
8. Note
Note that to determine if three integer values form a Pythagorean triple, it is not necessary to do a square root operation. (left as an exercise)
9. End of page