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 c^{2} = a^{2 }+ b^{2}. 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 c^{2} = a^{2} + b^{2} 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 c^{2 }has a factor of 4 - that is, c^{2} 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 a^{2} + b^{2} = (2 * x + 1)^{2} + (2 * y + 1)^{2 }= 4 * (x^{2} + y^{2} + x + y) + 2, which has a remainder of 2 when divided by 4 and so can not be equal to c^{2}, 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 c^{2}
= a^{2
}+
b^{2
}we get
c^{2
}- a^{2
}=
b^{2},
(c
+ a)
* (c
- a)
= b^{2}.
If we can choose a and c so that (c + a) * (c - a) is a perfect square then we have our triple.
b^{2} 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 = 5^{2 }=25and (c - a)/2 = 4^{2}=16.
From the equation, b^{2} /4= 25*16. b^{2} = 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 = m^{2 }and (c - a)/2 = n^{2} and proceeding as we did above.
We get b^{2}/4 = m^{2}*n^{2}, b=2*m*n.
c/2
+ a/2 =
m^{2}
c/2
- a/2 =
n^{2}
Adding and subtracting these equations gives:
c
= m^{2}+
n^{2}
a
= m^{2
}- n^{2}
As further confirmation, we can
directly substitute
the above values for a, b
and c
to show that (m^{2
}+
n^{2})^{2}
= (m^{2
}- n^{2})^{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:
m^{2
}+ n^{2}=
c
m^{2
}- n^{2}
=
a
Adding and subtracting these
equations we get
the original conditions:
m^{2}
= c/2 + a/2
n^{2}
= 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:
m^{2}
= (p*(r+s))/2
n^{2
= }(p*(r-s))/2 ,
implying
that m^{2
}and n^{2
}have a common factor of p,
which contradicts the condition
that m^{2
}and n^{2
}have no common factor.
For the case where p=2,
note that p and 2 cancel in the above equation giving:
m^{2}
= r + s
n^{2}
= r - s
m^{2
}and
n^{2 }must
both be odd or must both be even, contradicting the assumption that one
of m^{2}
and n^{2
}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 7^{3}. 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.
z^{2}
= (m + ni)^{2}
= (m^{2}
- n^{2})
+ (2*m*n)i. |z^{2}|
= |z|^{2}
= (m^{2}
+
n^{2})
.
The real and imaginary parts of z^{2
}and
the absolute value of z^{2 }form
a Pythagorean triple.
Because we know that any Pythagorean triple must have the form:
(m^{2}
- n^{2}),
(2*m*n), (m^{2}
+ n^{2}),
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 n_{1} and n_{2} are each the sum of two squares then so is n_{1}×n_{2}. Let's do this with a specific example and then show the algebraic formula. We have 5=2^{2} + 1^{2} and 25 = 3^{2} + 4^{2}. We want to show that 5 ×25 = 125 is the sum of two squares.
Using the fact that for two complex numbers z_{1} and z_{2}, |z_{1} × z_{2}| = |z_{1}|×|z_{2}|,
|(2+i)(3+ 4i)|^{2} = 5 × 25 = 125.
|2 + 11i|^{2} = 125, so 125 = 11^{2} + 2^{2}.
Also |(2 - i)(3 + 4i)|^{2} = 125
|10 + 5i|^{2} = 125, 125 = 10^{2} + 5^{2}
If n_{1} = a_{1}^{2} +
b_{1}^{2} and n_{2} = a_{2}^{2}
+ b_{2}^{2} then
|(a_{1} + b_{1} i)(a_{2}+b_{2} i)|^{2}
= |(a_{1} - b_{1} i)(a_{2}+b_{2}i)|^{2}
= (a_{1}^{2} + b_{1}^{2})(a_{2}^{2}
+ b_{2}^{2})
(a_{1}^{2}
+ b_{1}^{2})(a_{2}^{2} + b_{2}^{2}) = (a_{1}×a_{2} - b_{1}×b_{2})^{2} + (a_{1}×b_{2} + a_{2}×b_{1})^{2} =
(a_{1}×a_{2} + b_{1}×b_{2})^{2} + (a_{1}×b_{2} - a_{2}×b_{1})^{2}
In particular, if we have c_{1}^{2 }= (a_{1}^{2} + b_{1}^{2}) and c_{2}^{2} = (a_{2}^{2} + b_{2}^{2}) 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 c_{1}×c_{2}. 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 x^{n} + y^{n} = z^{n} 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=h^{2}.
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:
(y^{2}-
x^{2},
2xy, x^{2}
+ y^{2}
= z^{2}).
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
h^{2}
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 (m^{2}-n^{2}) can be approximated as m^{2}. The even side of 2mn multiplies m by 2n which is much smaller than the factor of m multiplying the m of m^{2}. 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: (m^{2}-n^{2}) - 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=x^{2}, b=y^{2} and c=z^{2} then we would have x^{(2)2} + y^{(2)2} = z^{(2)2}, or x^{4} + y^{4} = z^{4}, in violation of Fermat's Theorem.