Next: Finding m and n Up: Pythagorean Triples, etc. Previous: Pythagorean Triples, etc.   Contents

# Generating all Pythagorean Triples

This section in pdf form. triples2.pdf

If is a positive integer solution to the equation

 (1)

then is a Pythagorean triple. If , and have no common divisors greater than , then is a primitive Pythagorean triple (PPT). Similarly, if where is a PPT then is primitive. In the following list only the second triangle is not primitive.

Clearly, if divides any two of , and it divides all three. And if then . That is, for a positive integer , if is a Pythagorean triple then so is . Hence, to find all Pythagorean triples, it's sufficient to find all primitive Pythagorean triples.

Let , and be relatively prime positive integers such that . Set

reduced to lowest terms, That is, . From the triangle inequality . Then

 (2)

Squaring both sides of (2) and multiplying through by we get

which, after canceling and rearranging terms, becomes

 (3)

There are two cases, either and are of opposite parity, or they or both odd. Since , they can not both be even.

Case 1. and of opposite parity, i.e., . So 2 divides b since is odd. From equation (2), divides . Since then , therefore also divides . And since , divides . Therefore . Then

 and from (2) (4)

Case 2. and both odd, i.e., . So 2 divides . Then by the same process as in the first case we have

 (5)

The parametric equations in (4) and (5) appear to be different but they generate the same solutions. To show this, let

and

Then , and . Substituting those values for and into (5) we get

 and (6)

where , , and and are of opposite parity. Therefore (6), with the labels for a and b interchanged, is identical to (4). Thus since , as in (4), is a primitive Pythagorean triple, we can say that is a primitive pythagorean triple if and only if there exists relatively prime, positive integers and , , such that and . And is a Pythagorean triple if and only if

and

where is a positive integer.

Alternatively, is a Pythagorean triple if and only if there exists relatively prime, positive integers and , , such that

and

Another Method (using Gaussian Integers).

Let

 (7)

where , and are pairwise, relatively prime, positive integers. Let and , where . Then and are Gaussian Integers, and is the conjugate of . Note that

 and (8)

Since then . Hence each of and is a square. That is, there exists integers and such that and . So, from equation (8),

 and

Since is a positive integer, and must be positive integers, . And since , and must be relatively prime and of opposite parity.

Equation (8) illustrates a method for finding primitive Pythagorean triangles where the hypotenuse is to a power. We have the identity,

 (9)

The absolute values are necessary since the terms on the left, depending on , may, or may not, be positive.

Example

Let , and . Then, from equation (9), we have,

Still another method -- the difference method.

Let be a primitive Pythagorean triple. Without loss of generality, let be odd. Equation (7) can be written as,

Set and . Thus,

 and (10)

Since is primitive, . This implies that each of and is a square. So, since any odd positive integer greater than 1 can be written as the difference of two positive integer squares, there exists positive integers and , , such that and . Hence, from equation (10),

 and

And, since , and must be relatively prime and of opposite parity.

Equation (10) illustrates an efficient method for finding primitive Pythagorean triples where the odd leg is to a power. We have the identity,

 (11)

Example

Let , and . Then, from equation (11), we have,

 That is,

Next: Finding m and n Up: Pythagorean Triples, etc. Previous: Pythagorean Triples, etc.   Contents
f. barnes 2008-04-29
Hosted by www.Geocities.ws