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 .

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 is called a Pythagorean triple and given such a triple, is also a Pythagorean triple for any .

As we want to understand the integer solutions of the Pythagorean equation it makes sense to consider triples 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 . 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 such that , one is even and the other is odd and , then the triple given by , and is a primitive solution of the Pythagorean equation. Moreover, each primitive solution is of this form.

**Proof of Theorem: **Let be such as in our hypothesis along with the triple . It is easy to verify that this triple is indeed Pythagorean by simply computing . Clearly are positive integers so we need to show they are pairwise coprime to deduce the triple is primitive. If then divides both and by the linear property of division. As we assumed that are coprime we must have either or . In the second case, if , we have a contradiction due to say being even and being odd. Bringing this together we have shown is a primitive Pythagorean triple.

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

Using the fact we have a pythagorean triple we deduce the identity . Due to the parity of and we observe and are both integers. We can in fact conclude they are coprime due the coprime conditions of and . Looking at our identity the factors on the right have no common divisors so they must both be squares. In particular we can find such that and . It follows that due to .

Its not hard to notice that , and hence giving us our Pythagorean triple. The last task is to show that are of different parity. We compute ( mod ) showing us is odd and by the way parity changes under addition we know and have different parity. This means we’ve constructed the parametrization for our triple as described in the statement of the theorem.