Skip to main content
\( \newcommand{\lt}{ < } \newcommand{\gt}{ > } \newcommand{\amp}{ & } \)

Section3.4Pythagorean Triples

Subsection3.4.1Definition

There are a lot of other interesting questions that one can ask about pure integers, and polynomial equations they might satisfy (so-called Diophantine equations). However, answering many of those questions will prove challenging without additional tools, so we will have to take a detour soon. But one such question is truly ancient, and worth exploring more in this chapter.

It is also quite geometric. We just used the Pythagorean Theorem above, but you'll note that we didn't really care whether the hypotenuse was an integer there. Well, when is it? More precisely:

Question3.4.1

When are all three sides of a right triangle integers?

Definition3.4.2

We call a triple of integers \(x,y,z\) such that \(x^2+y^2=z^2\) a Pythagorean triple.

There isn't necessarily evidence that Pythagoras thought this way about them. However, Euclid certainly did, and so will we. For that matter, we should also think of them as \(x,y,z\) that fit on the quadratic curve \(x^2+y^2=z^2\), given \(z\) ahead of time.

Let's try this out for a little bit. When do we get a triple? (Keep in mind that we will always expect the triple \((z,0,z)\) and \((0,z,z)\) where \(0^2+z^2=z^2\), but that's not really what we are interested in.)

Subsection3.4.2Characterizing Pythagorean triples

It seems quite random for which \(z\) we get a Pythagorean triple existing! (We'll return to that question later.) Let's see what triples are even possible.

First, it turns out we really only need to worry about the case when \(x,y,z\) are all relatively prime to each other.

Definition3.4.3

A Pythagorean triple with \(x,y,z\) mutually relatively prime is called a primitive Pythagorean triple.

So let's consider just the case of primitive triples. In just a little while we will discover we have the proof of a result, Theorem 3.4.5.

We can start with very elementary considerations of even and odd. By the previous proposition, \(x\) and \(y\) can't both be even.

I claim they can't both be odd, either. For if they were, we would have \(x=2k+1\) and \(y=2\ell+1\) for some integers \(k,\ell\), and then \begin{equation*}(2k+1)^2+(2\ell+1)^2=4\left(k^2+\ell^2+k+\ell\right)+2\end{equation*} But this contradicts Proposition 2.1.4 with respect to the remainder of a perfect square when divided by four.

So we may assume without loss of generality that \(x\) is odd and \(y\) is even, (which means \(z\) is odd).

Subsubsection3.4.2.1An intricate argument

So we have \(\gcd(x,y,z)=1\) and \(x,z\) are odd and \(y\) is even. Now we will do a somewhat intricate, but familiar, type of argument about factorization and divisibility.

Let's rewrite our situation as \begin{equation*}y^2=z^2-x^2\; .\end{equation*}The right-hand side factors as \begin{equation*}z^2-x^2=(z-x)(z+x)\, .\end{equation*} Certainly \(z-x\) and \(z+x\) are both even, so that \(z-x=2m\) and \(z+x=2n\). But since their product is a square (\(y^2\)), then that product \(2m\cdot 2n=4mn\) is also a perfect square. Since \(y\) is even, \(y=2k\) for some \(k\in\mathbb{Z}\) and \(y^2=4k^2\), so \(mn=k^2\) is a perfect square.

Let's look at these mysterious factors \(m=\frac{z-x}{2}\) and \(n=\frac{z+x}{2}\). Are they relatively prime? Well, if they shared a factor, then \(x=m+n\) and \(z=n-m\) also share that factor. But \(\gcd(x,z)=1\), so there are no such factors and \begin{equation*}\gcd\left(\frac{z-x}{2},\frac{z+x}{2}\right)=\gcd(m,n)=1\end{equation*}

Now recall that \(y\) is even. Letting \(y=2j\), we see that \(y^2=4mn\) yields \(j^2=mn\); however, this time \(m\) and \(n\) are relatively prime!

At this point we need what may seem to be an intuitive fact about squares and division; if coprime integers make a square when multiplied, then they are each a perfect square. (See Proposition 3.7.2.) So \(m=p^2\) and \(n=q^2\) for some integers (obviously coprime) \(p\) and \(q\).

This clearly implies that \(j^2=p^2q^2\), so \(y=2pq\).

Subsubsection3.4.2.2The punch line

Now we can put everything together. \begin{equation*}z-x=2p^2,\; z+x=2q^2,\; \text{ and }y=2pq\, . \end{equation*} That is:

Definition3.4.6

We say two integers \(p,q\) have opposite parity if one is even and the other is odd, and we say they have the same parity otherwise.

It's really worth trying to find these by hand; it gives one a very good sense of how this all works.

Of course, you could generate some by computer as well …

Remark3.4.8

One can find many infinite subfamilies of Pythagorean triples. A nice brief article by Roger Nelsen [C.6.18] shows that there are infinitely many Pythagorean triples giving nearly isoceles triangles (where the smaller sides are just one unit different). What families can you find?

Subsection3.4.3Areas of Pythagorean triangles

Subsubsection3.4.3.1Which areas are Possible?

Historically, one of the big questions one could ask about such Pythagorean integer triangles was about its area. For primitive ones, the legs must have opposite parity (do you remember why?), so the areas will be integers. (For ones which are not primitive, the sides are multiples of sides with opposite parity, so they are certainly also going to have an integer area.)

So what integers work? You all know one with area 6, and it should be clear that ones with area 1 and 2 can't work (because the sides would be too small and because \(2,1\) doesn't lead to a triple); can you find ones with other areas?

It is worth asking why there are no odd numbers in the list so far. In fact, we can prove quite a bit about these things.

Remember, \(x\) and \(y\) can be written as \(x=q^2-p^2\) while \(y=2pq\), for relatively prime opposite parity \(q>p\). Then the area must be \begin{equation*}pq(q^2-p^2)=pq(q+p)(q-p)\, .\end{equation*} So can the area be odd?

So one could analyze a number to see if it is possible to write as a product of four relatively prime integers as a starting point. E.g. \(30=2\cdot 3\cdot 5\cdot 1\) is the only way to write \(30\) as a product of four such numbers (assuming no more than one of those is 1!), and since \(q+p\) must be the biggest, we must set \(q+p=5\). Quickly one can see that \(q=3,p=2\) works with this, so there is such a triangle. What are the sides?

This turns out to be a very deep unsolved problem. This news update from the American Institute of Mathematics gives some background on the congruent number problem, which asks the related question of which Pythagorean triangles with rational side lengths give integer areas. This page in particular is interesting from our present point of view.

Subsubsection3.4.3.2Which areas are square?

But we can ask another question, which led Fermat to some of his initial investigations into this theory.

Question3.4.10

Namely, when is the area of a Pythagorean triple triangle a perfect square?

If you'll notice, we don't see to be getting a lot of these. In fact, none. What would we need to do to investigate this?

Remember, \(x\) and \(y\) can be written as \(x=q^2-p^2\) while \(y=2pq\), for relatively prime opposite parity \(q>p\). Then the area must be \begin{equation*}pq(q^2-p^2)=pq(q+p)(q-p)\, .\end{equation*} Now, in the previous section, we showed each of these quantities was relatively prime to each other. So if the area is also a perfect square, then since they are coprime, they themselves are all perfect squares!

Now we will do something very clever. It is a proof strategy, similar to something the Greeks used occasionally, and it is something Fermat used for many of his proofs, called infinite descent. We are going to take that (hypothetical) triangle, and produce a triangle with strictly smaller sides but otherwise with the same properties – including integer sides and square area! That means we could apply the same argument to our new triangle, and then the next one … but the Well-Ordering Principle (1.2.1) won't allow that. So the original triangle was impossible to begin with.

So let's make that smaller triangle!

In Exercise 3.6.9 you will use this to prove the famous first case of Fermat's Last Theorem: \begin{equation*}x^4+y^4=z^4\end{equation*} is not possible for any three positive integers \(x,y,z\). See also Subsection 14.2.2.