#### Question 3.4.1.

When are all three sides of a right triangle integers?

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, as a representative of questions involving quadratic terms.

The question we will examine 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:

When are all three sides of a right triangle integers?

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^{ 5 }

, 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\text{,}\) given \(z\) ahead of time.

`aleph0.clarku.edu/~djoyce/java/elements/bookX/propX29.html`

Let’s try this out for a little bit – on paper or with this applet. 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\text{,}\) but that’s not really what we are interested in.)

When exploring, it can seem quite unpredictable for which \(z\) there exists a Pythagorean triple! (We’ll return to *that* question later.) Let’s see what triples are possible overall.

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

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

Any Pythagorean triple with two numbers sharing a factor can be reduced to a primitive triple.

If \(x=x'a\) and \(y=y'a\text{,}\) for instance, then

\begin{equation*}
x^2+y^2=(x')^2a^2+(y')^2a^2=z^2
\end{equation*}

which means that \(a^2\mid z^2\text{,}\) and hence that \(a\mid z\) as well. The other cases are similar. (One can prove the last statement with the gcd and Bezout as well, but I trust you believe it for now. See below in Proposition 3.7.1.)

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.6.

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\text{,}\) 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).

We have now reduced our investigation to the following case: we assume that \(\gcd(x,y,z)=1\text{,}\) that \(x,z\) are odd, and that \(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\text{.}
\end{equation*}

The right-hand side factors as

\begin{equation*}
z^2-x^2=(z-x)(z+x)\text{.}
\end{equation*}

Certainly \(z-x\) and \(z+x\) are both even, so that \(z-x=2m\) and \(z+x=2n\) for integer \(m,n\text{.}\) 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=2j\) for some \(j\in\mathbb{Z}\) and \(y^2=4j^2\text{,}\) so \(mn=j^2\) is a perfect square.

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

\begin{equation*}
\gcd\left(\frac{z-x}{2},\frac{z+x}{2}\right)=\gcd(m,n)=1\text{.}
\end{equation*}

As a result, not only do we have \(j^2=mn\text{,}\) but actually \(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\text{.}\)

This clearly implies that \(j^2=p^2q^2\text{,}\) so \(y=2pq\text{.}\) In addition, if we go back to the definitions of \(m,n\) above, we obtain \(z-x=2p^2\) and \(z+x=2q^2\text{.}\)

Now we can put everything together. We begin with a useful definition.

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.

For a primitive triple \(x,y,z\text{,}\) where \(x\) is odd, there exist integers \(p,q\) such that

\begin{equation*}
z=p^2+q^2,\; x=q^2-p^2,\; \text{ and }y=2pq\text{.}
\end{equation*}

Further, \(p\) and \(q\) must have opposite parity as well as be coprime.

We can find *all* primitive Pythagorean triples by finding coprime integers \(p\) and \(q\) which have opposite parity, and then using the formula in Theorem 3.4.6. We can obtain *all* Pythagorean triples by multiplying primitive triples by an integer greater than one.

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 …

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

Similarly, there are other ways to get the entire family of Pythagorean triples. Theorem 4 of [E.7.42] generates primitive triples via pairs \(a,b\) of *odd* coprime positive integers; see Exercise 3.6.25.

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 such triangle 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 that in a primitive triple, \(x\) and \(y\) can be written as \(x=q^2-p^2\) while \(y=2pq\text{,}\) for relatively prime opposite parity \(q>p\text{.}\) Then the area *must* be

\begin{equation*}
pq(q^2-p^2)=pq(q+p)(q-p)\text{.}
\end{equation*}

So can the area be odd? The following proposition helps answer this (Exercise 3.6.15) and many other questions.

In a primitive Pythagorean triple given by the formula in Theorem 3.4.6, the area of the corresponding triangle is \(pq(q^2-p^2)\text{.}\) In addition, the four factors of the area

\begin{equation*}
pq(q+p)(q-p)
\end{equation*}

must all be relatively prime to each other.

We already know that \(p\) and \(q\) are coprime, and that this is the correct formula for the area.

The factors \(p\) and \(p+q\) must also share no factors, since any factor they share is shared by \((p+q)-p=q\text{,}\) but \(\gcd(p,q)=1\text{.}\) The same argument will work in showing that \(p\) and \(q-p\) are, as well as \(q\) and either sum.

If \(q+p\) and \(q-p\) share a factor, since they are odd it must be odd, *and* it must be a factor of their sum and difference \(2q\) and \(2p\text{.}\) Since the putative factor is odd, it is coprime to \(2\text{,}\) and so we can use Proposition 2.4.10 to say that it is a factor of both \(p\) and \(q\text{,}\) which is impossible unless said factor is \(1\text{.}\)

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. For example, the only way to write \(30\) in such a way (assuming no more than one of them is 1) is \(30=2\cdot 3\cdot 5\cdot 1\text{.}\) Since \(q+p\) must be the biggest, we must set \(q+p=5\text{.}\) Quickly one can see that \(q=3,p=2\) works with this, so there is such a triangle. (A quick exercise is to determine the sides of this triangle.) See Exercise 3.6.16.

Trying to see if an integer is the area of a Pythagorean triangle turns out to be a *very deep* unsolved problem. This linked news update from the American Institute of Mathematics^{ 6 }

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 linked page^{ 7 }

in particular is interesting from our present point of view.

`www.aimath.org/news/congruentnumbers/`

`www.aimath.org/news/congruentnumbers/ecconnection.html`

But we can ask another question, which led Fermat (see Historical remark 13.0.4) to some of his initial investigations into this theory.

When is the area of a Pythagorean triple triangle a perfect square?

You’ll notice by the empty output that we don’t seem to be getting a lot of these. In fact, none. What would we need to do to investigate this?

In the previous section, we noted that each of the factors in the area, \(pq(q^2-p^2)=pq(q+p)(q-p)\text{,}\) are relatively prime to each other. So if the area is *also* a perfect square, then since the factors are coprime, we use Proposition 3.7.2 again to see 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, which 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 (Axiom 1.2.1) won’t allow infinite sets of positive integers less than a certain number – which yields the name of the proof technique! Then (by way of contradiction) the original triangle was impossible to begin with.

So let’s make that smaller triangle!

If a primitive Pythagorean triangle with sides \(x,y,z\text{,}\) where the hypotenuse is \(z\text{,}\) has area a perfect square, we can create another one of strictly smaller hypotenuse length.

We use the same notation as in Proposition 3.4.9. We know that \(q+p\) and \(q-p\) are (odd) squares. Call them \(u^2\) and \(v^2\text{.}\) Note we can write \(u\) and \(v\) as \(\frac{u+v}{2}+\frac{u-v}{2}\) and \(\frac{u+v}{2}-\frac{u-v}{2}\) (the terms of which are integers since \(u\) and \(v\) have the same parity).

Letting \(a=\frac{u+v}{2}\) and \(b=\frac{u-v}{2}\text{,}\) we have that \(q+p=(a+b)^2\) and \(q-p=(a-b)^2\text{.}\) Then a little algebra (do it slowly if you don’t see it right away) shows that \(q=a^2+b^2\) and \(p=2ab\text{.}\) These are both squares, so \(a^2+b^2=q=c^2\) (!), which defines a triangle with area \(\frac{ab}{2}=\frac{2ab}{4}=\frac{p}{4}\text{,}\) another perfect square (do you see why?).

Now let’s compare \(c\) and \(z\text{.}\) We have \(z=q^2+p^2=\left(c^2\right)^2+p^2=c^4+p^2\text{,}\) so that unless \(p=0\text{,}\) \(c\) is strictly less than \(z\text{.}\) But \(p=0\) doesn’t give a triangle at all! So we have our strictly smaller triangle satisfying the same properties.

No Pythagorean triangles can have area a perfect square.

If so, we can use the previous proposition infinitely often and violate Axiom 1.2.1, a contradiction.

No nonzero difference of nonzero perfect fourth powers can be a perfect square. That is,

\begin{equation*}
v^4-u^4=t^2
\end{equation*}

cannot be solved in positive integers.

It suffices to consider \(u,v\) coprime. In the previous proposition and corollary, we really showed that if \(q-p,q+p,q,p\) are all perfect squares (coming from the area of the triangle) then this leads to a strictly smaller (and hence impossible, by infinite descent) set with the same property, since the area of the smaller triangle is a product of coprime squares of the same form. If we let \(p=u^2\) and \(q=v^2\text{,}\) then we are in precisely this situation, as long as \(q-p,q+p\) are coprime.

The only difference is that here even if \(p,q\) are coprime, it’s possible that both are odd, so that \(q-p,q+p\) only have the same (even) parity. However (viz. [E.2.16, Lemma 7.7.3]), \(2\) is the only divisor they can share without passing a common divisor on to \(p,q\text{,}\) so that we still have \(q+p=v^2+u^2=2f^2\) and \(q-p=v^2-u^2=2g^2\) where \(f,g\) themselves coprime. Then some quick algebra shows \(v^2=f^2+g^2\) and \(u^2=f^2-g^2\text{,}\) so that the set \(f^2,g^2,f^2+g^2,f^2-g^2\) are all perfect squares, an impossibility.

In Exercise 3.6.17 you will use this to prove the famous first case of Fermat’s Last Theorem: There are no three positive integers \(x,y,z\) such that

\begin{equation*}
x^4+y^4=z^4\text{.}
\end{equation*}

See also Subsection 14.2.2.

See [E.5.9] and nearly any generalist math journal for a lot more information on Pythagorean triples; the search is the reward!