# Pythagorean Triples

Three integers a, b, and c that satisfy a2 + b2 = c2 are called Pythagorean Triples. There are infinitely many such numbers and there also exists a way to generate all the triples. Let n and m be integers, n>m. Then define

 (*) a = n2 - m2, b = 2nm, c = n2 + m2.

The three number a, b, and c always form a Pythagorean triple. The proof is simple:

 (n2 - m2)2 + (2mn)2 = n4 - 2n2m2 + m4 + 4n2m2 = n4 + 2n2m2 + m4 = (n2 + m2)2.

The formulas were known to Euclid and used by Diophantus to obtain Pythagorean triples with special properties. However, he never raised the question whether in this way one can obtain all possible triples.

The fact is that for m and n coprime of different parities, (*) yields coprime numbers a, b, and c. Conversely, all coprime triples can indeed be obtained in this manner. All others are multiples of coprime triples: ka, kb, kc.

As an aside, those who mastered the arithmetic of complex numbers might have noticed that

 (n + im)2 = (n2 - m2) + i2mn.

Which probably indicates that (*) has a source in trigonometry. But the proof below only uses simple geometry and algebra.

First of all, note that if a2 + b2 = c2, then (a/c)2 + (b/c)2 = 1. With x = a/c and y = b/c we get x2 + y2 = 1. This is the well known equation of the unit circle with center at the origin. Finding Pythagorean triples is therefore equivalent to locating rational points (i.e., points (x, y) for which both x and y are rational) on the unit circle. For if (p/q)2 + (r/s)2 = 1, multiplication by a common denominator leads to an identity between integers.

Rational numbers approximate irrational to any degree of accuracy. Therefore, the set of rational pairs is dense in the whole plane. So, perhaps, one might expect that any curve should contain a lot of rational pairs or meander wildly to avoid them. But this is not the case. The recent proof of Fermat's Last Theorem lets us claim that the curves xN + yN = 1 with N > 2 contain no rational points (except of course for the trivial ones - (0, 1) and (1, 0).) But there are simpler examples. From Lindemann's theorem, we conclude that the graph of a perfectly smooth function y = ex contains a single rational point, (0,1). Moreover, pulling the unit circle even a little aside may change the picture drastically. Let (xk, yk) = (√2/k, √3/k), and consider a unit circle with center at (xk, yk). As k grows, the point approaches the origin, but for no k, such a circle contains a rational point. (It can be shown, in general, that on a circle with irrational center there are at most two rational points.) Let t be defined by

 (1) t = y/(x+1).

Then t(x+1) = y and

 t2(x + 1)2 = y2 = 1 - x2 = (1 + x)(1 - x).

We are not interested in negative x. So let's cancel (1+x) on both sides. The result is

 t2(x + 1) = (1 - x).

Solving for x we get

 (2) x = (1 - t2)/(1 + t2)

From y = t(1+x) we also obtain

 (3) y = 2t/(1 + t2)

Formulas (1)-(3) show that t is rational iff both x and y are rational.

There is another way to look at the just described configuration.

The configuration consists of the unit circle centered at the origin and a straight line passing through the point (-1, 0) which lies on the circle. Unless the line is tangent to the circle, the two have a second common point. In order to find this point, we have to solve simultaneously two equations: the quadratic equation of the circle x2 + y2 = 1 and the linear equation of the line. By eliminating either x or y from the latter, and substituting the result into the former, we get a quadratic equation in one variable with integer coefficients. One solution of this equation is immediate - it is related to the point (-1, 0), and is rational. Therefore, the second solution of the equation is also rational and gives either x- or y-coordinate of the second point of intersection.

The applet below illustrates this concept. Several attributes are modifiable:

1. Drag the hollow circle on the slanted line to change its slope.
2. The line may or may not be snapped to the grid.
3. Change the scale by dragging point (1,0).
4. Drag the center of the coordinates to any desired position.
5. Drag the text box when it gets in the way.

### Remark

When the dot on the line is not confined to the grid, the dot appears to move freely. However, its center's location is naturally restricted to the pixels of your screen. The pixels may be many but, nonetheless, they are arranged into a rectangular grid. Relative to the grid of the applet's coordinate axes, pixels are located at the points with rational coordinates with the denominator always equal to the number of pixels between two ticks on either axis. The slope t is then also rational and leads to a Pythagorean Triple as above.

### References

1. K. Devlin, Mathematics: The Science of Patterns, Scientific American Library, 1997
2. S. Lang, The Beauty of Doing Mathematics, Springer-Verlag, 1985
3. W. Sierpinski, Pythagorean Triangles, Dover, 2003 Pythagorean triples 