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 = 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 =25 and (c - a)/2 = 42=16.
From the equation, b2 /4= (c + a)/2 * (c - a)/2 =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:
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.
A Curious Fact
One side of every Pythagorean triple is divisible by 5. The side divisible by 5 may be the hypotenuse, the even leg or the odd leg.
If you are familiar with modular arithmetic, the proof is straightforward though not very elegant. All that is necessary is to consider the possible cases.
m and n are congruent mod
5 to 0, 1, 2, 3 or 4. m2
and n2 are
congruent to 0, 1 or 4. We want to show that one of the sides
of
a Pythagorean triple is congruent to 0 mod 5. If m or n is congruent to 0
then 2mn
also is. Otherwise if m2 an n2 are both congruent to either 1 or 4
then m2 -
n2 is congruent to 0. The remaining
case is if one of m2 and
n2 is congruent to
4 and the other is congruent to 1, in which case
m2 +
n2 is congruent to 0.
You can use a similar analysis to show that either the even or odd leg of a Pythagorean triple must be divisible by 3.
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.
Then (1, 1, a/b) must 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. Show that every number divisible by 4 is one of the short sides of at least one Pythagorean triple.3. 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.4. 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.
Answers
1. Let
k be any number divisible by 4. We want to find m and n such that k=2mn
where m and n meet the appropriate conditions. Since k is divisible by
4, k/2 = mn must be divisible by 2. If we set m=k/2 and n=1 we
have met the condition that one of m and n is even and the other odd
and m and n have no common factor.
As an example, let k=20. Then m=10 and n=1, giving the Pythagorean triple of (99, 20, 101).
See if you can find the three Pytharogean triples that have a short side equal to 60.
2. Let k be any odd number. We want to find m and n of the appropriate type satisfying k = (m2 - n2).
k = (m2 - n2) = (m + n)(m - n). We can satisfy this equation by having m + n = k and m - n = 1.
Adding and subtracting these equations gives m = (k + 1)/2 and n = (k -
1)/2. m and n must be integers because k being odd means that (k
+ 1) and (k - 1) are even and hence divisible by 2. m
- n = 1 means that m is one greater than n.. From this it follows
immediately that one of m and n is even and the other odd.
Further, we can deduce from m being 1 greater than n that m and n
have no common factor, since any number that divides n must have a
remainder of 1 when divided into m.
As an example, let k = 7. Then m = 4 and n = 3, giving the Pythagorean triple (7, 24, 25).
3. 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.
4. 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.