Pythagorean Triples

When you talk to the average human about mathematics with a very high probability you can expect a discussion about the Pythagorean theorem. If you’re unaware of this theorem not only am I very shocked but part of me wants to tell you’re in the wrong part of the Internet. Jokes aside this post isn’t about the theorem but is instead about looking for solutions of the Pythagorean equation that are integers. For completeness the so-called Pythagorean equation is X^2 + Y^2 = Z^2 .

We are interested in solutions of this equation in the integers and due to the symmetry of the equation it suffices to consider only non-negative integers. A solution (x,y,z) \in \mathbb{Z}^3 is called a Pythagorean triple and given such a triple, (ax,ay,az ) is also a Pythagorean triple for any a \in \mathbb{Z}.

As we want to understand the integer solutions of the Pythagorean equation X^2 + Y^2 = Z^2 it makes sense to consider triples (x,y,x) where the components are pair-wise coprime and non-negative. This follows from the above observations and we call such solutions primitive.

Pythagoras himself constructed an infinite number of Pythagorean triples by using the identity (2n+1)^2 + (2n^2+2n)^2 = (2n^2+2n+1)^2 . It is worth verifying this identity and finding a triple that isn’t in its form.

In fact this problem is very classical, some may say ancient, as in the third century B.C. Euclid solved the problem of finding all such integer solutions.

Theorem: let a,b \in \mathbb{Z}^+ such that \gcd(a,b) = 1, one is even and the other is odd and a > b, then the triple (x,y,z) \in \mathbb{Z}^3 given by x = a^2 - b^2, y = 2ab and z = a^2 + b^2 is a primitive solution of the Pythagorean equation. Moreover, each primitive solution is of this form.

Proof of Theorem: Let a,b \in \mathbb{Z}^+ be such as in our hypothesis along with the triple (x,y,z). It is easy to verify that this triple is indeed Pythagorean by simply computing x^2 +y^2 = (a^2 -b^2)^2 +(2ab)^2 = a^4 +2a^2b^2 +b^4 = (a^2 +b^2) = z^2 . Clearly x,y,z are positive integers so we need to show they are pairwise coprime to deduce the triple is primitive. If d = \gcd(x,y,z) then d divides both x + z = 2a^2 and z - x = 2b^2 by the linear property of division. As we assumed that a,b are coprime we must have either d = 1 or d = 2. In the second case, if d=2 , we have a contradiction due to say a being even and b being odd. Bringing this together we have shown (x,y,z) is a primitive Pythagorean triple.

To show each primitive solution is of the form in our hypothesis we let (x,y,z) be a primitive Pythagorean triple. As they are all pairwise coprime and satisfy x^2 + y^2 = z^2 we can conclude that y is even and x,z are odd. I’m leaving this for you to verify and as a hint you might want to look mod 8 .

Using the fact we have a pythagorean triple we deduce the identity (\frac{y}{2})^2 = \frac{1}{4}(x^2-z^2) = \frac{1}{2}(x-z)\frac{1}{2}(x+z). Due to the parity of x and z we observe \frac{1}{2}(z+x) and \frac{1}{2}(z-x) are both integers. We can in fact conclude they are coprime due the coprime conditions of x,y and z . Looking at our identity the factors on the right have no common divisors so they must both be squares. In particular we can find a,b \in \mathbb{Z}^+ such that a^2 = \frac{1}{2}(z+x) and b^2 = \frac{1}{2}(z-x). It follows that \gcd(a,b) =1 due to \gcd(\frac{1}{2}(z+x),\frac{1}{2}(z-x)) =1 .

Its not hard to notice that a^2 - b^2 = x, 2ab = y and a^2 + b^2 = z hence giving us our Pythagorean triple. The last task is to show that a,b are of different parity. We compute a +b \equiv a^2 +b^2 \equiv 1 ( mod 2 ) showing us a +b is odd and by the way parity changes under addition we know a and b have different parity. This means we’ve constructed the parametrization a,b for our triple (x,y,z) as described in the statement of the theorem.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s