Section3.4Pythagorean Triples
There are a lot of other interesting questions that one can ask about pure integers, and equations they might satisfy. 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 today.
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,
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, 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.1Characterizing Pythagorean Triples
It seems quite random for which \(z\) we get a Pythagorean triple even 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.
If \(x=x'a\) and \(y=y'a\), for instance, then \[x^2+y^2=(x')^2a^2+(y')^2a^2=z^2\] which means that \(a^2|z^2\), and hence that \(a|z\) as well. (One can prove the last statement with the gcd and Bezout as well, but I trust you believe it for now. See below in Appendix 3.7.1.)
So let's call Pythagorean triples where \(gcd(x,y,z)=1\) primitive triples, and consider just this case.
- By the above, \(x\) and \(y\) can't both be even.
- I claim they can't both be odd, either.
If they were, we would have \(x=2k+1\) and \(y=2\ell+1\) for some integers \(k,\ell\), and then \[(2k+1)^2+(2\ell+1)^2=4\left(k^2+\ell^2+k+\ell\right)+2\; ;\] and we saw a day or two ago that a perfect square (\(z^2\)) can't have remainder two when divided by four.
- So we assume that \(x\) is odd and \(y\) is even, without loss of generality (which means \(z\) is odd).
Subsubsection3.4.1.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 \[y^2=z^2-x^2\; .\]
- The right-hand side factors as \[z^2-x^2=(z-x)(z+x)\, .\] 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.
- Now we'll try to find out more about these mysterious factors \(m=\frac{z-x}{2}\) and \(n=\frac{z+x}{2}\).
- 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 \[gcd\left(\frac{z-x}{2},\frac{z+x}{2}\right)=gcd(m,n)=1\]
- Recall that \(y\) is even; letting \(y=2j\), we see that \(y^2=4mn\) yields \(j^2=mn\), but with \(m\) and \(n\) are relatively prime!
- Now we're almost done, but need a fact about squares and division.
If coprime integers make a square when multiplied, then they are each a perfect square.
This is also probably intuitive for many of you, but a proof using only gcds is below in Appendix 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.1.2The punch line
Now we can put it all together. \[z-x=2p^2,\; z+x=2q^2,\; \text{ and }y=2pq\, . \] That is, \[z=p^2+q^2,\; x=q^2-p^2,\; \text{ and }y=2pq\; .\] Since \(x\) is odd, we now find another fact as well -- that \(p\) and \(q\) cannot both be odd or both even (they have opposite parity).
So we can find all primitive Pythagorean triples by finding coprime integers \(p\) and \(q\) which have opposite parity, and then using this formula! And we get all Pythagorean triples by multiplying.
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...
Subsection3.4.2Areas of Pythagorean Triangles
Subsubsection3.4.2.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 \[pq(q^2-p^2)=pq(q+p)(q-p)\, .\] So can the area be odd?
To find out more about what areas are possible, we show briefly that all four of the factors above are relatively prime to each other in pairs, at least in a primitive triple.
- \(p\) and \(q\) are.
- \(p\) and \(p+q\) must be, since any factor they share is shared by \((p+q)-p=q\), but \(gcd(p,q)=1\).
- 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, it must be odd, and must be a factor of their sum and difference \(2q\) and \(2p\). Since the putative factor is odd, it is coprime to \(2\), and so we can use one of our corollaries to say that it is a factor of \(p\) and \(q\) as well, which is impossible.
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 article 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.2.2Which areas are square?
But we can ask another question, which led Fermat to some of his initial investigations into this theory. 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 \[pq(q^2-p^2)=pq(q+p)(q-p)\, .\] (Indeed, above we show that all four of those quantities are relatively prime.)
So if the area is also a perfect square, then (recall above) since they are coprime, they themselves are all perfect squares!
Now we will do something very clever. Something the Greeks used occasionally; something Fermat used for many of his proofs. We are going to take that (hypothetical) triangle, and produce a triangle with strictly smaller sides 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 property won't allow that. So the original triangle was impossible to begin with.
So let's make that smaller triangle!
- We know that \(q+p\) and \(q-p\) are (odd) squares - say \(u^2\) and \(v^2\). That means that we can write \(u\) and \(v\) as \(\frac{u+v}{2}+\frac{u-v}{2}\) and \(\frac{u+v}{2}-\frac{u-v}{2}\) (which are integers since \(u\) and \(v\) are odd). Letting \(a=\frac{u+v}{2}\) and \(b=\frac{u-v}{2}\), we have that \(q+p=(a+b)^2\) and \(q-p=(a-b)^2\).
- Then a little algebra shows that \(q=a^2+b^2\) and \(p=2ab\). 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}\), another perfect square.
- But \(c<z\). This is because \(z=q^2+p^2=\left(c^2\right)^2+p^2=c^4+p^2\); unless \(p=0\), \(c\) is strictly less than \(z\) - but \(p=0\) doesn't give a triangle, much less a Pythagorean one! So we have our strictly smaller triangle satisfying the same properties, which leads to an infinite descent, as Fermat called it.
And there is a bonus to all this. In the proof, we really showed that there is no pair \(p\) and \(q\) of (coprime) squares such that \(q^2-p^2\) is also a perfect square \(t^2\); that is what we started with, after all. So, if \(p=u^2\) and \(q=v^2\) (forget our previous use of \(u\) and \(v\)), we have that \[v^4-u^4=t^2\] is impossible. In your homework, you will use this to prove the famous first case of "Fermat's last theorem": \[x^4+y^4=z^4\] is not possible for any three positive integers \(x,y,z\).