Tuesday, January 29, 2013

Using the generating function for relatively prime Pythagorean triples.

Yesterday's post ended with the statement of the generating function for Pythagorean triples. Take any two distinct whole numbers j and k and let j be the larger. Here are the formulas for a, b and c.

a = j² - k²
b = 2jk
c = j² + k²

Example #1: j = 2, k = 1
a = 4-1 = 3
b = 2 × 2 × 1 = 4
c = 4+1 = 5

Example #2: j = 3, k = 1
a = 9-1 = 8
b = 2 × 3 × 1 = 6
c = 9+1 = 10

Example #3: j = 3, k =2
a = 9-4 = 5
b = 2 × 3 × 2 =12
c = 9+4 = 13

Not surprisingly, using the three smallest pairs around (2, 1) (3, 1) and (3, 2), we get the three smallest Pythagorean triples. But notice that (3, 1) generates 8-6-10 which is not a relatively prime triple, since all the numbers are even. Looking at this carefully, we see that if both j and k are odd, this will make a, b and c even.

a = odd² - odd² = even
b = 2×odd×odd = even
c = odd² + odd² = even

To generate a relatively prime Pythagorean triple, we need two things to be true about j and k.

1. j and k must be relatively prime.
2. j - k must be odd. (Another way to state this is one is odd and the other even.)

Tomorrow, a few more rules about the relatively prime Pythagorean triples.