Pythagorean Triples



A Pythagorean triple is a set of three integers a, b and c that specify the lengths of a right triangle - that is c2 = a2 + b2. The numbers 3, 4 and 5 is one example. We want to find a way of generating all Pythagorean triples. Actually, we are only interested in the triples that have no common factor. For example, we are not interested in finding the triple (6, 8, 10) since this is easily generated from (3, 4, 5) by multiplying each term by 2.

This is an example of a problem in number theory, which is the study of the properties of whole numbers. The good thing about number theory is that students can readily relate to it, since we are all more comfortable with whole numbers than fractions and decimals. The unfortunate thing about number theory is that it has fewer practical applications than other branches of mathematics. The problem of Pythagorean triples, for example, does not have any practical use. However, it has such a simple and satisfying solution that it deserves to be part of the high school mathematics curriculum.

The proof that follows draws upon that found in The Enjoyment of Mathematics by Hans Rademacher and Otto Toeplitz. I highly recommend this book to those with a high school level knowledge of mathematics who are willing to expend a little bit of effort.

Preliminary Result:

To show: If a,b and c are integers satisfying c2 = a2 + b2 where a, b and c have no common factor then:

1. c is an odd number
2. one of a and b is odd and the other even.

Proof: Since the sum and difference of two even numbers is even, if two of a, b and c were even then the other would be also, which is not allowed since the numbers would then have a common factor of two. If none of a, b and c were even then a, b and c would all be odd, which is impossible since the sum or difference of two odd numbers is an even number. Therefore exactly one of a, b and c is even.

Suppose that c is the even number. Then c has a factor of 2 and c2 has a factor of 4 - that is, c2 is divisible by 4. If we choose two odd numbers, say 1 and 3, and add their squares (10 in this case) we will find that the sum is not divisible by 4. Since a and b are both odd they have the form a = 2 * x + 1 and b = 2 * y + 1. Then a2 + b2 = (2 * x + 1)2 + (2 * y + 1)2 = 4 * (x2 + y2 + x + y) + 2, which has a remainder of 2 when divided by 4 and so can not be equal to c2, which is exactly divisible by 4. Therefore the assumption that c is even is incorrect. Since we showed that one of the terms must be even, one of a and b must be even and the other odd.

We can assume without loss of generality that b is the even term.

Factorization:

From c2 = a2 + b2 we get
c2 - a2 = b2,
(c + a) * (c - a) = b2.

If we can choose a and c so that (c + a) * (c - a) is a perfect square then we have our triple.

b2 is divisible by 4 since we are assuming that b is even, and both (c + a) and (c - a) are even since c and a are both odd. We can divide both sides by 4 and still be working with integer values.

(c + a)/2 * (c - a)/2 = (b/2)2.

Specific Example:

The right side of the equation is still a perfect square. The simplest way to get the left side to be a perfect square is to set (c + a)/2 and (c - a)/2 each to perfect squares. For example, suppose (c + a)/2 = 52 =25and (c - a)/2 = 42=16.

From the equation, b2 /4= 25*16. b2 = 4*25*16 = 1600. b = 40.

For a and c we have two equations in two unknowns:

c/2 + a/2 = 25
c/2 - a/2 = 16

Adding and subtracting the equations yields:

c =25 + 16 = 41 and a = 25 - 16 = 9.

The Pythagorean triplet is then (9, 40, 41).

General Case:

For any choice of integers m and n we can get a Pythagorean triple by setting (c + a)/2 = m2 and (c - a)/2 = n2 and proceeding as we did above.

We get b2/4 = m2*n2, b=2*m*n.

c/2 + a/2 = m2
c/2 - a/2 = n2

Adding and subtracting these equations gives:

c = m2+ n2
a = m2 - n2

As further confirmation, we can directly substitute the above values for a, b and c to show that (m2 + n2)2 = (m2 - n2)2 + (2*m*n)2 . We have found a way of generating infinitely many Pythagorean triples.

Completion of Proof:

Remember that what we want are Pythagorean triplets with no common factor. What will be shown is that we can generate all such triples by adding the further restrictions on m and n that one of them must be even and the other odd and that m and n have no common factor. The proof falls into two parts:

  1. Show that for m and n with one even and the other odd and having no common factor, the values (m2 + n2), (m2 - n2 ) and (2*m*n) have no common factor.
  2. Show that for any other solution of c2 = a2 + b2, a, b and c have a common factor.
Proof that all values have no common factor:
The key to this proof is the fact that we can go backwards from the values for a, b and c to the original choice of values for m and n.

From the equations in the previous section we get:
m2 + n2= c
m2 - n2 = a

Adding and subtracting these equations we get the original conditions:
m2 = c/2 + a/2
n2 = c/2 - a/2

Now suppose that a and c have a common prime divisor p, where p is different from 2. c=p*r and a = p*s for some r and s. Substituting these values in the above equations gives:
m2 = (p*(r+s))/2
n2 = (p*(r-s))/2 ,
implying that m2 and n2 have a common factor of p, which contradicts the condition that m2 and n2 have no common factor.

For the case where p=2, note that p and 2 cancel in the above equation giving:
m2 = r + s
n2 = r - s

m2 and n2 must both be odd or must both be even, contradicting the assumption that one of m2 and n2 must be even and the other odd. We have shown that our method of choosing Pythagorean triples will never have a common factor.

Proof that any other Pythagorean triples must have a common factor:

(c/2 + a/2) * (c/2 - a/2) has to be a perfect square. We have covered the case where (c/2 + a/2) and (c/2 - a/2) are each perfect squares. Let us consider the remaining cases.

If (c/2 + a/2) is not a perfect square then it must have some prime factor raised to an odd numbered power. Suppose for example that (c/2 + a/2) is divisible by 73. Since the product of (c/2 + a/2) and (c/2 - a/2) must be a perfect square this means that (c/2 - a/2) must also be divisible by 7 raised to an odd power, so that both (c/2 + a/2) and (c/2 - a/2) are divisible by 7 and in general (c/2 + a/2) and (c/2 - a/2) will both be divisible by some prime p. We then have (c/2 + a/2) = p*r and (c/2 - a/2) = p*s for some numbers r and s.

(c/2 + a/2) = p*r
(c/2 - a/2) = p*s
Adding and subtracting these equations gives c = p*(r + s) and a = p*(r - s), giving c and a a common factor of p, as was to be proved.

Complex Numbers

Here is an interesting outcome of the preceding discussion. Consider a complex number z = m + ni, where m and n are integers chosen as above.

z2 = (m + ni)2 = (m2 - n2) + (2*m*n)i. |z2| = |z|2 = (m2 + n2) .

The real and imaginary parts of z2 and the absolute value of z2 form a Pythagorean triple. Because we know that any Pythagorean triple must have the form:
(m2 - n2), (2*m*n), (m2 + n2), we can conclude that for any Pythagorean triple (a,b,c), the complex number z=(a+bi) is a perfect square - it has a square root of the form m+ni where m and n are integers. We also know that m and n have no common factor and that one of them is even and the other is odd.
______________________________________________________________________________

We can use complex numbers to derive the general result that if  n1 and n2 are each the sum of two squares then so is n1×n2.  Let's do this with a specific example and then show the algebraic formula.  We have 5=22 + 12 and 25 = 32 + 42.  We want to show that 5 ×25 = 125 is the sum of two squares.

Using the fact that for two complex numbers z1 and z2,  |z1 × z2| =  |z1|×|z2|,

|(2+i)(3+ 4i)|2 = 5 × 25 = 125.
|2 + 11i|2 = 125, so 125 = 112 + 22.

Also |(2 - i)(3 + 4i)|2 = 125
|10 + 5i|2 = 125,  125 = 102 + 52

If n1 = a12 + b12 and n2 = a22 + b22 then
|(a1 + b1 i)(a2+b2 i)|2 = |(a1 - b1 i)(a2+b2i)|2 = (
a12 + b12)(a22 + b22)  
(a12 + b12)(a22 + b22)  =    (a1×a2 - b1×b2)2 + (a1×b2 + a2×b1)2  =   
 
                                        (a1×a2 + b1×b2)2 + (a1×b2 - a2×b1)2

In particular, if we have c12 =  (a12 + b12) and c22 = (a22 + b22) each as the hypotenuse of a right triangle, we can use the formulas above to get one, and possibly two, different right triangles with hypotenuse c1×c2.  This will not necessarily result in Pythagorean triples, because we cannot guarantee that the results will not have a common factor.

We know that (3,4,5) and (5,12,13) are Pythagorean triples.  Use the formulas to get two triples for hypotenuse = 5 × 13 =65.

Irrationality of Square Root of Two

There is a more clever proof not related to Pythagorean triples that has the advantage of being gernealizable to showing the irrationality of the square roots of all primes, but I like this proof because it follows immediately from what has been done here and may very well be the one that was first used by Pythagoras, who as you probably know first proved the relationship between the sides of a right triangle. He was also the first to discover the existence of irrational numbers.

From the right triangle whose two short sides are of unit length Pythagoras knew that the hypotenuse had to have a length whose square was equal to two.  Pythagoras had strongly believed that all numbers could be expressed as the ratio of integers and was so horrified to discover that the square root of two was irrational that his followers were sworn to secrecy.

Perhaps he reasoned as follows.  Suppose that the square root of two can be expressed as a/b where this fraction is in lowest terms.  That is, a and b have no common factor.
(1, 1, a/b) form the sides of a right triangle.  Multiply each of the sides by b to get (b, b, a),  which is also a right triangle and is in fact a Pythagorean triple.  Because the two short sides are the same they must both be even or odd, which violates what was proved above.  We are forced to conclude that the square root of two cannot be expressed as a/b.  It is irrational.


Further Historical Context - Fermat's Theorem

The ancient Greeks knew how to generate Pythagorean triples. The seventeenth century mathematician Pierre de Fermat spent a great deal of time trying to extend the result to problems of the form xn + yn = zn for integers x, y, z and n where n > 2. Fermat was convinced that no such solutions existed. The story goes that Fermat wrote in his notes that he had produced a proof of this. For the next 300 hundred years mathematicians attempted unsuccessfully to produce a proof of what has come to be known as Fermat's Theorem. Because of the simplicity of the statement of the problem and of the elusiveness of its solution, it drew the attention of a great many non-mathematicians. It is not often that mathematical proofs make newspaper headlines but in 1993 when the American mathematician Andrew Wiles announced that he had at long last proved Fermat's Theorem it made front page news in the New York Times and other newspapers.

Exercises

1. Find a Pythagorean triple where the hypotenuse has length 25. Show that if h is the hypotenuse of a Pythaorean triple then there is a Pythagorean triple with hypotenuse=h2.

Thanks to Cooper Morse for suggesting this problem.

2. When m=2 and n=1, plugging into the equation for Pythagorean triples gives the familiar (3,4,5) triangle. Using m=3 and n=2 gives (5,12,13). In both these cases the side with even length is the second largest. Can you find values for m and n that will have the even side as the shortest? What relationship between m and n seems to determine whether the even side is shortest or in the middle? Determine an exact criterion for this.

3. Show that Fermat's Theorem implies that that there are no Pythagorean triples that are all perfect squares.

Answers

1. m=4 and n=3 produces the Pythagorean triple (7,24,25). In general, if there is a Pythaogorean triple (x,y,z) where y is the larger of the two legs, then a new Pythagorean triple can be formed by setting m=y and n=x giving:
(y2- x2, 2xy, x2 + y2 = z2). Note that this is an if and only if condition since you can work backwards to show that if there is a Pythagorean triple with hypotenuse h2 then there must be triple with hypothenuse h. Use this fact to easily show that there is no Pythagorean triple with hypotenuse = 81.

2. It is not diffiecult to see that when m is much larger than n the even side will be smallest. When m is much larger than n, the odd side of length (m2-n2) can be approximated as m2. The even side of 2mn multiplies m by 2n which is much smaller than the factor of m multiplying the m of m2. Conversely, when the two sides are sufficiently close the even side will be second.

To determine an exact criterion for the relative size of the even side, let k=m/n, m=nk. Plug this value of m into the difference between the two short sides: (m2-n2) - 2mn. This will produce a quadratic equation. Solving the equation gives k=1+sqrt(2), so the even side will be shortest whenever m/n > 1 + sqrt(2) and it will be second when m/n < 1 + sqrt(2). To test this out, note that 1+sqrt(2)=2.414... Try m=23 and n=10 for m/n=2.3 as compared to m=5 and n=2 for m/n=2.5.

3. If we had a=x2, b=y2 and c=z2 then we would have x(2)2 + y(2)2 = z(2)2, or x4 + y4 = z4, in violation of Fermat's Theorem.




HOME