Pythagorean TriplesAre integer length sides of right triangles. Here's a trick for finding them. |
What might one want to do with a list of pythagorean triples? Here are a few ideas:
How it worksThe formulas for x, y, and z are as follows: x = 2*s*t, y = t^2 -s^2, and z = t^2 +s^2, you pick s and t from the positive integers. For example, if s=1 and t=2 you get (3,4,5). If you want to ensure that the triple can't be reduced by dividing by a common factor, follow this rule: make s and t coprime (having no common divisors other than 1) and not both odd. A non-reducable Pythagorean triple is called a primitive Pythagorean triple. It can easily be verified that x^2 +y^2 = z^2, with x, y, and z in terms of s and t, the tough part is in deriving these equations from scratch. I've even gone so far as to generate Pythagorean triples from one number. |
Back to Robert's Neat Math page