# Monday Math: Pythagorean Triples

It just so happens that I am teaching elementary number theory this term. So how about the triumphant return of Monday Math!

For those playing the home game, the course textbook is A Friendly Introduction to Number Theory (Third Ed.) by Joseph Silverman. Let’s begin.

I’m sure we all remember the Pythagorean Theorem. That’s the one that says that the sides of a right triangle satisfy the equation:

$a^2+b^2=c^2$

where c is the length of the hypotenuse (the side opposite the right angle). You might wonder if it is possible for a, b and c to all be integers. Indeed it is, as the following equation shows:

$3^2+4^2=5^2$

The next question, then, is whether there are infinitely many such “Pythagorean triples,” that is, triples of integers that satisfy the Pythagorean equation. Yes there are, as the following list suggests:

$\begin{matrix} (6, 8, 10) & (9, 12, 15) \\ (12, 16, 20) & (15, 20, 25) \end{matrix}$

Of course, we obtained this list by multiplying (3, 4, 5) by two, three, four and five. It is not hard to prove that if we multiply the entries of a Pythagorean triple by the same number, the result is another triple.

Somehow, though, that doesn’t really seem to be in the spirit of things. It seems reasonable to say that the four triples above, and all the other ones I could obtain in a similar fashion, are effectively identical to (3,4,5). When we ask for infinitely many Pythagorean triples, we are really asking if there are infinitely many fundamentally different triples. That leads us to a definition.

We shall say a Pythagorean triple is primitive if the three entries have no common factor (other than one, of course). Thus, (3, 4, 5) is primitive, as is (5, 12, 13). But (21, 28, 35) is not primitive since all of the entries are multiples of seven.

It turns out that there are, indeed, infinitely many primitive Pythagorean triples, but the proof of that requires a few steps. Let’s get started today, and we will see the rest in a future post.

Here’s a list of all the primitive Pythagorean triples with hypotenuse smaller than 100:

$\begin{matrix} (3, 4, 5) & (5, 12, 13) & (7, 24, 25) & (8, 15, 17) \\ (9, 40, 41) & (11, 60, 61) & (12, 35, 37) & (13, 84, 85) \\ (16, 63, 65) & (20, 21, 29) & (28, 45, 53) & (33, 56, 65) \\ (36, 77, 85) & (39, 80, 89) & (48, 55, 73) & (65, 72, 97) \end{matrix}$

Notice anything? It seems that in every triple the hypotenuse is odd, and the legs are of different parity (that is, one is even and one is odd). That is not a coincidence.

It is easy to see that we can’t have that a and b are both even. For if they were it would follow immediately, since the sum of two even numbers is even, that c must be even as well. That would mean that a, b, c are all even, which is impossible in a primitive Pythagorean triple.

What happens if a and b are both odd? In this case, since the sum of two odd numbers is even, we would have that c is even. Therefore, we can write, for some appropriate values of x, y and z that:

$a=2x+1 \phantom{xxxxx} b=2y+1 \phantom{xxxxx} c=2z.$

Plugging into the Pythagorean equation gives:

$\left( 2x+1 \right)^2 + \left( 2y+1 \right)^2 = \left(2z)^2 ,$

and multiplying out now gives:

$\left(4x^2+4x+4y^2+4y \right)+2=4z^2$

This, alas, is simply impossible. The right-hand side is a multiple of four. But the left-hand side is plainly two more than a multiple of four. We conclude that we can not have that a and b are both odd. The only remaining possibility is that one of the legs is odd and the other is even. This forces the hypotenuse to be odd.

Good progress, but we still have some work to do. Let’s save that for next week!

1. #1 Matt
January 17, 2011

But wait…? Isn’t there is the correspondence between Pythagorean triples and rational points on the circle that is given by dividing by the hypotenuse and clearing denominators respectively?

And aren’t the rational points on the unit circle except (-1,0) just parametrized by where a line of rational slope through (-1,0) intersects with the unit circle? Certainly any other rational point on the circle will give rise to a rational slope, and a little algebra easily shows that any line of rational slope through (-1,0) intersects the circle at a rational point.

No biggie (smalls).

2. #2 Steven Carr
January 17, 2011

Isn’t it easy to prove there are infinitely many triples, by turning c^2 = a^2 + b^2 into a^2 = (c-b)(c+b) ?

For any odd square, it is easy to see that we can solve c -b = 1 and c + b = a^2 and get whole numbers for c and b.

Just half the square number, and add and subtract 0.5 to get the whole numbers c and b.

3. #3 andre3
January 17, 2011

Is there some simple proof as to why you cannot have two even legs and an even hypotenuse? You kind of just fly by that one as if it’s a given.

4. #4 Blaise Pascal
January 17, 2011

@andre3:

You can have a Pythagorean Triple with all three sides even: (6,8,10) is an easy example. But a primitive Pythagorean Triple must have no common factor to all three sides. (6,8,10) is not primitive, because all three sides share 2 as a factor.

In fact, it’s easy to see that if all three sides are even, then all three sides must share a common factor of 2 (by the definition of even), and therefore can’t be a primitive Pythagorean Triple.

5. #5 James W
January 17, 2011

Andre3:

Yeah… I stumbled on that one for a while, until I realised the reason Jason glossed over it is that it’s essentially true by definition.

We are counting primitive triples – which by definition do not have common factors; since all even numbers share a common factor of 2, then a triple consisting entirely of even numbers is not primitive.

Regards

James

6. #6 Stephen Lucas
January 17, 2011

Matt: you are correct with your discussion on rational points on the circle. Cut-the-Knot has an excellent discussion on generating Pythagorean triples this way using geometry at
http://www.cut-the-knot.org/pythagoras/pythTriple.shtml
However, I’m guessing that Jason will pursue the more classical derivation in his next post on the topic.

Jason: a friendly introduction to number theory? How generous of you! I’d jump straight into Hardy & Wright 🙂

7. #7 Markk
January 17, 2011

Just a note – Firefox 4 on Linux and I am getting no rendering of the equations, just LaTeX type source.

8. #8 Jason Rosenhouse
January 17, 2011

Matt —

I was saving the geometric proof for a later post. Silverman gives that argument its own chapter. I think it’s interesting, though, that the problem can be solved using only basic number theory techniques.

Steven Carr–

Dude! Ever heard the phrase “spoiler alert”?

That little factoring trick is precisely what I am building up to. I should probably have clarified that our goal is more than just showing there are infinitely many triples. We also want a formula for producing all of them. Your method would only get us triples in which the hypotenuse is one more than one of the legs.

Stephen Lucas —

I’m pretty sure Hardy and Wright would make their heads explode! It’s too early in the term to determine whether Silverman will have the same effect.

Markk —

Sorry about the rendering problems. It seems to be working fine in Safari.

9. #9 g
January 17, 2011

The equations display fine for me (FF4/Windows, if that turns out to matter). Markk, does it actually work better with a different browser?

10. #10 James Sweet
January 17, 2011

So it’s sort of a funny coincidence that this happened to me on the same post where Markk had a problem: When I loaded this page, my internet connection was having some kind of major hiccup. Data was still coming through, but only a trickle.

And a funny thing happened. Only the LaTeX source appeared for probably a good three or four minutes. Finally the page loaded fully and I saw the equations.

Edit: It turned out the reason my connection was wonky was because I accidentally had my browser set up to go through the proxy server at work — which normally has no effect unless I’m, you know, at work, but I am working from home today and connected via VPN. So all web requests were going via VPN to a non-always-blazing-fast proxy. Plus my internet connection has been a little funky lately too.

There ya go.
Clearly the problem was all on my end — just a momentarily wonky connection — but I wonder if some similar connection issue could have caused what Markk saw?

11. #11 Ned Rosen
January 17, 2011

Three easy problems to assign early once they have the basics of modular arithmetic: show that any triple contains a number divisible by 3, a number divisible by 4, and a number divisible by 5 (not necessarily distinct, of course). These are just souped up versions of the of the odd-even argument.

More challenging: Find the next triple after 3,4,5 and 20,21,29 for which b = a + 1. Find a way to generate all such triples with (leg) gap equal 1.

Generalization: Which numbers occur as (leg) gaps in primitive triples? How can we generate all primitive triples with a given gap g? I think these questions are related to quadratic reciprocity.

12. #12 g
January 18, 2011

James, that’s my guess too and the reason why I said “if that turns out to matter” and asked Markk whether the problem went away with a different browser.

It looks to me as if some Javascript magic replaces the LaTeX code with SVG images computed and cached on mathcache.appspot.com. (I haven’t checked but guess that if your browser doesn’t do SVG you’ll get PNG images instead.) So if for any reason someone’s unable to connect to there, or if it’s broken, the LaTeX markup will stay on the page and not get replaced.

13. #13 Jon Wharf
January 19, 2011

I’ve forgotten where the line is between algebra and number theory…. but I wasted a goodly amount of time and Excel space messing about with primitive pythagorean triples some time ago.

The two-parameter formula for generating primitive triples is pretty much just algebra and careful thinking about coprimality.

The possible leg gap value appears to be fussy about its value in modulo 120 – {1, 7, 17, 23, 31, 41, 47, 49, 71, 73, 79, 89, 97, 103, 113, 119}. Not all such numbers qualify. I couldn’t quickly figure out the details, except that they are some of the roots (mod 120) of 1 and 49 – but not all of them. I’m probably missing some other structure.

14. #14 Jon Wharf
January 21, 2011

I just had another little ponder on this, and it’s clear that I can generate every possible two-parameter set from the positive integers, one-to-one. So now it’s a one-parameter process (leading to the two-parameter formula).