Section 3.4 Pythagorean Triples
Subsection 3.4.1 Definition
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:Question 3.4.1.
When are all three sides of a right triangle integers?
Definition 3.4.2.
We call a triple of integers
xxxxxxxxxx
def _(z=(2,[1..100])):
f(x,y)=x^2+y^2-z^2
max = z
p = implicit_plot(f,(x,-1,max),(y,-1,max),plot_points = 200)
lattice_pts = [[i,j] for i in [0..max] for j in [0..max]]
plot_lattice_pts = points(lattice_pts,rgbcolor=(0,0,0),pointsize=2)
curve_pts = [coords for coords in lattice_pts if f(coords[0],coords[1])==0]
if len(curve_pts)==0:
show(p+plot_lattice_pts, figsize = [5,5], aspect_ratio=1)
else:
plot_curve_pts = points(curve_pts, rgbcolor = (0,0,1),pointsize=20)
show(p+plot_lattice_pts+plot_curve_pts, figsize = [5,5], aspect_ratio=1)
Subsection 3.4.2 Characterizing Pythagorean triples
Subsubsection 3.4.2.1 Preliminaries
First, it turns out we really only need to worry about the case whenDefinition 3.4.3.
A Pythagorean triple with
Proposition 3.4.4.
Any Pythagorean triple with two numbers sharing a factor can be reduced to a primitive triple.
Proof.
If \(x=x'a\) and \(y=y'a\text{,}\) for instance, then
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.)
Subsubsection 3.4.2.2 An intricate argument
We have now reduced our investigation to the following case: we assume thatSubsubsection 3.4.2.3 The punch line
Now we can put everything together. We begin with a useful definition.Definition 3.4.5.
We say two integers
Theorem 3.4.6. Characterization of primitive Pythagorean triples.
For a primitive triple
Further, since
Algorithm 3.4.7.
We can find all primitive Pythagorean triples by finding coprime integers
xxxxxxxxxx
n=10
Generators=[(p,q) for p in range(1,n) for q in range(p+1,n) if (gcd(p,q)==1) and not (mod(p,2)==mod(q,2))]
for pairs in Generators:
x = pairs[1]^2-pairs[0]^2; y = 2*pairs[0]*pairs[1]; z = pairs[0]^2+pairs[1]^2
print('%s squared plus %s squared is %s squared - %s'%(x,y,z,x^2+y^2==z^2))
Remark 3.4.8.
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
Subsection 3.4.3 Areas of Pythagorean triangles
Subsubsection 3.4.3.1 Which 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 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 becausexxxxxxxxxx
n=10
Generators=[(p,q) for p in range(1,n) for q in range(p+1,n) if (gcd(p,q)==1) and not (mod(p,2)==mod(q,2))]
for pairs in Generators:
x = pairs[1]^2-pairs[0]^2; y = 2*pairs[0]*pairs[1]; z = pairs[0]^2+pairs[1]^2
print('The primitive triple %s gives a triangle of area %s'%((x,y,z),x*y/2))
Proposition 3.4.9.
In a primitive Pythagorean triple given by the formula in Theorem 3.4.6, the area of the corresponding triangle is
must all be relatively prime to each other.
Proof.
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{.}\)
Subsubsection 3.4.3.2 Which areas are square?
But we can ask another question, which led Fermat (see Historical remark 13.0.4) to some of his initial investigations into this theory.Question 3.4.10.
When is the area of a Pythagorean triple triangle a perfect square?
xxxxxxxxxx
def _(n=20):
Generators=[(p,q) for p in range(1,n) for q in range(p+1,n) if (gcd(p,q)==1) and not (mod(p,2)==mod(q,2))]
list = []
for pairs in Generators:
x = pairs[1]^2-pairs[0]^2; y = 2*pairs[0]*pairs[1]; z = pairs[0]^2+pairs[1]^2
if is_square(x*y/2):
pretty_print(html('The primitive triple $%s,%s,%s$ gives a triangle of square area $%s$'%(x,y,z,x*y/2)))
list.append((x,y,z))
if not list:
pretty_print(html(r"No triangles of square area up to $p,q\leq %s$!"%(n,)))
Proposition 3.4.11.
If a primitive Pythagorean triangle with sides
Proof.
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{.}\) 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}\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.
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.
Corollary 3.4.12.
No Pythagorean triangles can have area a perfect square.
Proof.
If so, we can use the previous proposition infinitely often and violate Axiom 1.2.1, a contradiction.
Corollary 3.4.13.
No difference of nonzero perfect fourth powers can be a perfect square. That is,
cannot be solved in positive integers.
Proof.
In the proof of the proposition, 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\text{;}\) that is what we started with, after all. So, if \(p=u^2\) and \(q=v^2\) we have that
is impossible.