If I asked you to give a list of mathematical theorems, I suspect that you might well think of Pythagoras‘s theorem pretty early on. It has the rare distinction of being a theorem that’s commonly discussed (by name) in maths classes in schools today. It should probably be a theorem of the week in its own right, but for today I’d like to focus on some rather lovely number theory associated with it.

Let’s quickly remind ourselves what Pythagoras’s theorem says. Here’s a right-angled triangle.

The theorem says that : the square on the hypotenuse is equal to the sum of the squares on the other two sides. There are a lot of proofs of this, but they’ll have to wait for a future post, I’m afraid!

I think that a lot of people discover, in the course of their studies of Pythagoras’s theorem at school, that there are some particularly nice right-angled triangles. One has side lengths 3, 4, 5 (quick check: ). Another has side lengths 5, 12, 13 (check: ). Another has side lengths 6, 8, 10 (check: ). Of course, these are particularly nice because the side lengths are all whole numbers (integers). I’m going to concentrate on such solutions in this post.

This leads to lots of interesting questions. Are there more solutions (with integer side lengths)? How many more? Are there infinitely many? How can we find more solutions? Can we find them all? Are some more interesting than others? Are there any interesting patterns? How can we possibly hope to solve a single equation in three variables? I encourage you to think about these questions before reading on. (You could, for example, look for more solutions from yourself and see where you can go from there.) You might also have your own questions that you’d like to consider, of course.

Let’s think about the solutions we’ve seen so far.

I don’t think that 6, 8, 10 is a very interesting solution, because it’s just twice a solution we’d already seen (3, 4, 5). We could generate infinitely many solutions in this way, just by multiplying by different positive integers. (If you have doubts, you might like to convince yourself of this algebraically.) So that would give infinitely many solutions, but it doesn’t feel to me that we should really count them as different. I’d like to concentrate on solutions (a,b,c) where the side lengths aren’t all divisible by some number (they have no common factor bigger than 1: they are coprime). These are called *primitive* solutions. So I’m interested in (3,4,5) and (5, 12, 13), but I’m going to ignore (6, 8, 10) and (9, 12, 15) and (12, 16, 20) and (10, 24, 26) and so on.

Can we answer any of our questions above, now that we’ve got this extra rule?

Let’s suppose we’ve got a primitive solution, and see what we can say about it. Perhaps that will help us to learn something useful. So let’s suppose we’ve got three positive integers such that , and let’s assume that the highest common factor of , and is 1.

Where can we go from here? In such cases, it’s sometimes helpful to start eliminating possibilities by considering parities (whether numbers are odd or even). Let’s think about the parities of and .

If and are both even, then must be even too (using ). But then , and have 2 as a common factor, and that contradicts one of our assumptions. So and cannot both be even.

If and are both odd, then (mod 4). But, as we’ve seen before, 2 is not a square (mod 4) (there are no square numbers that leave 2 on division by 4), so there are no solutions to the congruence (mod 4). So and cannot both be odd.

So one of and is odd, and the other even. Without loss of generality, we can assume that is odd and even. Let’s say that , where is another positive integer.

We have coprime positive integers , and such that . Can we say any more? We have a single equation in three variables, so we can’t possibly expect to find a unique solution (of course, as we know there are multiple solutions — we’ve seen some already!), but we have the extra information that , and are integers, and that might help us to draw conclusions (as it has already done).

My eye was drawn to rearranging this equation to give , because I know that is the difference of two squares, and so factorises nicely: . So we know that . This feels promising to me, because everything in sight is a whole number, so the options are greatly reduced. In particular, the product must be divisible by 4. We know that is odd; let’s think about the possibilities for .

If is even, then and are both odd, so their product is odd. That’s no good.

So must be odd. Then and are both even (and their product is divisible by 4). Let’s say that and , where and are positive integers with . Then and .

That makes our equation into . Can we draw any conclusions from that? It might be tempting to suggest that and must be squares (since their product is a square). In general, that isn’t true. For example, . But in fact it *is* true in this case, because and are coprime. (If the prime divides and , then divides and , and also divides and so — but that contradicts our assumption that , and are coprime.) Unique factorisation then allows us to conclude that and are squares, say and .

Now we have , , and . To recap: if is a solution, and if , and are coprime, then they must be of the form , , , for some positive integers and with . So all the primitive solutions must be of this form. But does every triple of this form give a solution?

Let’s see. We can just do the algebra. We have , so we do indeed always get a solution. We do not necessarily get a primitive solution (where the side lengths are coprime), though. For example, and gives , , .

But let’s be a bit more careful. We know that with our primitive solution we had and odd, so one of and must be odd and the other even. The same must apply to and We also saw that we must have and coprime, so and must be coprime. If we impose those conditions (which would rule out , ), do we necessarily get a primitive solution? It turns out that we do. You might like to check this for yourself (it’s not too hard). And that gives this week’s theorem.

**Theorem** A triple of coprime positive integers is a solution to the equation if and only if it has the form for some coprime positive integers and , where and exactly one of and is even.

Wikipedia reveals that this is a theorem of Euclid.

In particular, this theorem tells us that there are infinitely many primitive solutions, but it tells us much more than that, because it describes all of them. It doesn’t get much better than that!

### Further reading

Wikipedia has lots of fascinating facts about Pythagorean triples. It also gives some other ways to generate such triples. Solving an equation like this (where the solutions have to be integers) belongs to the study of Diophantine equations, a key branch of number theory (named after Diophantus of Alexandria). As I’ve previously noted, it was in Bachet‘s translation of Diophantus that Fermat made his marginal note about what has possibly become the most famous Diophantine equation (inspired by Pythagoras’s equation above).

July 5, 2010 at 6:10 pm

I’m seeing four yellow and red “Latex path not specified” messages. They have sprouted on other pages that were previously clean. Is this due to a change in wordpress configuration?

I enjoy reading Theorem of the Week. If only my health permitted I would spend hours fiddling with the numbers and post some maths comments.

July 10, 2010 at 12:37 pm

Thanks for your comment, Alan. I don’t seem to have any LaTeX error messages now; are you still seeing them? Perhaps it was a temporary glitch; if they’re still there, I might need to investigate further.