Almost everyone learns the Pythagorean theorem in school. Today, we will discuss something you may or may not have learned about: Pythagorean triples! If you haven’t heard of these, take a look at the following picture of a right triangle:

What’s special about this triangle is that the side lengths are all whole numbers and it’s a right triangle! Together, these are what make this triangle special. Finding triangles with whole-number-length sides is easy, and so is finding right triangles. However, finding right triangles with whole-number-length sides is unique.
A Pythagorean triple is the triplet of whole numbers that represent the three sides lengths of a right triangle with whole number side lengths: (Recall that the hypotenuse is the longest side of the right triangle) Thus, our triangle above is the Pythagorean triple
Question: How do we really know that the above triangle is really a right triangle?
Great question! We all remember the Pythagorean theorem (right?) that states: if a triangle is a right triangle with side lengths and and hypotenuse then As it turns out, the converse1 to the Pythagorean theorem is also correct; that is: if a triangle has side lengths that satisfy then the triangle is a right triangle. Therefore, all we have to do is check whether or not the triangle satisfies the Pythagorean theorem. Checking the above triangle, we indeed have (Check out this article if you want to see a short, visual proof of the Pythagorean theorem).
With the above observation, we could equivalently say that a Pythagorean triple is a triplet of whole numbers that satisfy the Pythagorean theorem:
If your experience was anything like mine, you were simply told to memorize a handful of these triples and then moved on to the next topic. We never learned how we could find our own triples without guessing or trial and error. But that can’t be the only way people discovered these special triangles, since back 3,700 years ago people figured out that is a Pythagorean triple! There is no way someone found this by guessing! There must be some logical method, or maybe a formula, to find at least some triples. (As it turns out, there is a formula to compute all Pythagorean triples!) Our goal for today is to deduce a formula that determines all Pythagorean triples, and then prove that the formula works. Very ambitious! So, let’s get started.
Remark: The way this article is laid out is meant to emulate how we might have discovered the formula ourselves. Of course, this makes it potentially more challenging to understand on your first reading than it would be to simply read a proof of the formula. For this reason, I want to mention at the beginning that there is a formal proof of the formula later on so that if you have any confusion during the discovery process, you know that there is a clearly outlined condensed proof as well.
Pythagorean Triples
Definition (Pythagorean Triple): A triplet of natural numbers,2 , that satisfy the equation, is known as a Pythagorean triple.
Pythagorean Triple iff
Examples of Pythagorean Triples and Setting the Stage
Before we start trying to find all Pythagorean triples, let’s first see a few more examples:
- is a Pythagorean triple since
- is a Pythagorean triple since
- is a Pythagorean triple since
- is a Pythagorean triple since
- is a Pythagorean triple since
But wait… take a look at the first, fourth, and fifth examples. Multiplying the triplet in (i) by 2, we get the triplet in (iv):
Similarly, multiplying the triplet in (i) by 3 yields the triplet in (v), and this might make sense. If is a Pythagorean triple, then so is because we can factor out an from each term in the Pythagorean theorem (because each term in the Pythagorean theorem is being squared).3
This motivates us to focus more on Pythagorean triples where none of the integers share a common factor, such as or We even have a special name for such Pythagorean triples:
Definition (Primitive Triples): Let be a triple of integers. If then we call a primitive triple.
Remark 1: Note that means the greatest common divisor of and is equal to 1. That is, there is no number such that other than 1. Recall that means that divides or equivalently, is a multiple of
Remark 2: In general, in the above manner is different than being pairwise relatively prime or pairwise primitive.4 Pairwise primitive means that and In general, a triple being pairwise primitive is a stronger statement about common factors between the three integers than being primitive is. To highlight the distinction, consider the triple of integers Taking stock of each greatest common divisor, we have
We can see from this example that is a primitive triple; however, is not pairwise primitive. So, primitivity does not imply pairwise primitivity. However, we might see that if is pairwise primitive, then is primitive. In shorthand:
Pairwise PrimitivePrimitive.
As it turns out, for Pythagorean triples, we have both implications. That is, is pairwise primitive if and only if is primitive! How nice!
Proposition 1: Let be a Pythagorean triple. Then, is a primitive triple if and only if is pairwise primitive.
Proof: (Click in the Discovery)
Let be a Pythagorean triple.
Forward: Primitive implies pairwise primitive.
Let be a primitive triple. Since we are trying to prove a statement about the greatest common divisor between pairs of numbers in our triple, let
For We will proceed by contradiction.
Assume for the hope of a contradiction that . By the fundamental theorem of arithmetic, there is some prime that divides Hence and It follows and and thus we conclude that However, so we have just concluded that This can only happen if (To rigorously prove that: see here for Euclid’s lemma or Euler’s Lemma here). Moral of the story is that divides every number in our triple: However, this means which contradicts our assumption that is primitive. Thus, there cannot be any prime numbers that divide This can only happen when
A similar argument can be used to deduce
Backward: Pairwise primitive implies primitive.
Let be pairwise primitive, that is, and It follows that (Why?) Once you figure out why, we have concluded the proof.
Okay, let’s modify our goal for today to: Deduce a formula that determines all primitive Pythagorean triples.
Now that we have some information about and (they share no factors) let’s move on and see what we can deduce about from this information.
Parity Problems
Now that we are after the triple and that share no factors, the next question we might ask is whether or not or can be even. Let’s experiment a little with the equation to see if we can say anything about the parity (even/odd-ness) of and
We have possible ways to have when we are only focusing on the even/odd-ness of and However, we can rule out some of them because they are not possible. I challenge you to fill in the right-most column of the table with a YES/MAYBE or a NO in the rightmost column.
| Is it possible to satisfy ? | |||
|---|---|---|---|
| even | even | even | ? |
| even | even | odd | ? |
| even | odd | even | ? |
| even | odd | odd | ? |
| odd | even | even | ? |
| odd | even | odd | ? |
| odd | odd | even | ? |
| odd | odd | odd | ? |
Seriously, give it a try and fill out as much as you can!
Filled in Table: (Click in the Discovery)
Here’s what I got:
| Is it possible to satisfy ? | |||
|---|---|---|---|
| even | even | even | Yes, but not primitive. |
| even | even | odd | NO! |
| even | odd | even | NO! |
| odd | even | even | NO! |
| odd | odd | odd | NO! |
The way we filled this out was by noting that and together with the facts that
I encourage you to verify these facts if you are unfamiliar with them.
Ignoring the first situation that is not primitive and all the impossible situations, we only have the three green possibilities left:
Since there isn’t really anything different between and in the equation we can consider the first two situations to be equivalent. With this, we have only two distinct situations to focus on:
- ,
However, we claim that we can never have the second situation: leaving only one situation left such as We cannot see why using our table, we need something more…
Going Beyond Parity
Our goal for this section is to show that we can’t have: Let’s see if we can discover why together.
A good tip is to try out some examples, see what happens, and try to spot patterns. In this case, let’s choose two random odd numbers and see what we get when we calculate
| 1 | 1 | 2 |
| 1 | 3 | 10 |
| 5 | 7 | 74 |
| 5 | 9 | 106 |
Notice anything yet? No? Why don’t you take a moment and compute some more examples? I’ll give you a hint: see how many powers of 2 divide
Go on… you got it!
Okay, did you notice that 2 divides only once? In other words, 4 does not divide when and are odd. Let’s see why.
The long way to see why 4 cannot divide is by noting that odd numbers are of the form: for some Thus, and for some Plugging these into gives
Where Note that isn’t a multiple of 4. In fact, is two more than a multiple of 4. We can now see that 4 cannot divide (There is a quicker way to see that see the footnote).5 In summary, we have the lemma:
Lemma 1 (An impossibility): It is impossible for Or,
for all odd and even integers.
Taking the Next Step
So we have seen that any primitive triple that solves must be of the form: i.e., The next step is to start playing around with using these facts.
Playing around with Pythagoras…
Let’s suppose that we have found a solution where and are odd, is even, and is a primitive triple. Remembering that we can factor a difference of squares, let’s move to the other side of the equation and then factor:
Okay, nothing really stands out, but at least it’s a start. We’ve had a lot of luck by considering what factors different terms have in common, so let’s try to take a look at the question: do and have any common factors? Let’s see.
Suppose It follows that and for Adding and subtracting these, we get and In other words (or symbols), and However, we know that since is a primitive Pythagorean triple. Therefore, and and where (Can you prove that?6) Furthermore, since with all being even we can write,
where We now have two relatively prime numbers multiplying together to equal a square number Is there anything we can deduce from these facts? As it turns out, it must be that are themselves square numbers. That is, and for some And since we also have We now have
The reason that and are square numbers can be seen by focusing on the prime divisors of If some prime number then or but cannot divide both because Therefore, all the primes that divide must get partitioned between the factors of More precisely, letting
then, implies and Therefore, every prime shows up in the prime factorizations of and will show up with an even exponent,
Thus,
Of course, this wasn’t a rigorous proof of this fact, so I challenge you to fill in some of the details of the following “proof”.
Lemma 2: Let with . Then, there are natural numbers such that
Moreover,
In other words, and are themselves powers.
Proof: (Click in the Discovery)
Let with . Also, let It follows,
Since and we deduce or using Euclid’s lemma. However, cannot divide both and because . A similar argument can be made regarding all the prime powers . It follows,
and
(Can you fill in the steps to make this fully rigorous?)
Using Lemma 2, we can properly say and for some such that
In summary, we have just determined that where,
We can solve for both and using the equations above for and Doing so yields,
From these, we determine See what you get for before reading on.
Plugging our equations for and back into and then solving for gives ***Or, we could have simply used ***
Wait just a gosh darn minute! We have what we wanted, a way to find Pythagorean triples! All we do is choose some with and then plug those into the following:
How awesome is this? Answer: Very awesome!
Before we find some triples, let’s prove the following theorem we were led to :
Theorem (Primitive Pythagorean Triples): A triple is a primitive pythagorean triple with odd and even if and only if
for some for such that and either or is even (but not both!).
We pretty much went through the proof in our discovery process; however, just in case you found that portion confusing, here is an organized formal proof. Also, we have a condition that was not immediately obvious from our discovery process: either or is even (but not both!). As we will see, this is not hard to prove.
Proof: (Click in the Discovery)
Forward: If is a primitive Pythagorean triple then and for some for such that and either or is even.
Let be a primitive Pythagorean triple. Using Lemma 1, we know that or is even (but not both) and is odd. So, let’s let be even. With some algebra, we deduce
Since both and are odd, and are even and hence and for Furthermore,
By Lemma 2,
for and such that
We can now solve for , and . Doing so gives (part of) our desired results:
All we need to show is that either or is even (not not both!). Since we can’t have both and being even. Also, if and were both odd, then and would both be even, contradicting that be a primitive Pythagorean triple.
Backward: Left for your enjoyment. (You’re welcome)
Hint: Plug in and into the Pythagorean Theorem and show that we get
and to
Let’s Find a Large Pythagorean Triple!
Now that we have a formula that gives us a primitive Pythagorean triple, let’s use it!
First, let’s do a quick, small example. Maybe and . In this case: and We have just found one of the triples we found before! Okay, okay, let’s compute a large one!
Let’s let and . (Note that and is odd and is even) Then,
And as a check,
Do you think you could have found these without our theorem?
That reminds me! Way back in the beginning, we mentioned,
” But [guessing or trial and error] can’t be the only way people discovered these special triangles, since back 3,700 years ago people figured out that is a Pythagorean triple! There is no way someone found this by guessing! “
Now that we have our formula to generate triples, can you determine what values of and give us the triple: Give it a go!
There’s More Fun to be Had!
It’s amazing that we have found a way to generate all Pythagorean triples. But, in the process, we took it for granted that there are integer solutions to in the first place. Something that becomes more striking when we learn about Fermat’s last theorem! One interesting fact is that we can use our results today to show that there are no integer solutions to This is one case of Fermat’s last theorem that Fermat really proved. There is a plan to write an article about his proof using infinite descent in the (hopefully soon) future!
There are many more questions we can ask that are tangential to our work today that are not about Fermat’s last theorem and that don’t require proofs over 100 pages long! For instance, take a look back at our main theorem. We showed that the hypotenuse is a sum of squares, This begs the question, “Which numbers can be hypotenuses?” Equivalently, “Which numbers can be expressed as the sum of two squares?” Or, more mathy with symbols, for what is there an integer solution to After playing around with this problem for a while, you might notice that if you can determine which primes can be expressed as you can then answer the question for all In fact, this question can be answered in far fewer than 100 pages. It can be answered and proved in one line! (See The One Sentence Proof (in multiple sentences) – Numberphile)
The questions are endless! But this article is already long so I will have to leave you to ponder and problem-solve! Remember to have fun!
Be Kind. Be Curious. Be Compassionate. Be Creative.
And Have Fun!
P.S. One final comment. Since knowing and determines we could write our solution as the pair: Hmm… this way of looking at the solution set seems a little… complex… no?7
Footnotes:
- The converse to: if A then B; is the statement: if B then A. ↩︎
- Natural numbers, denoted , are positive whole numbers: ↩︎
- When every term has the same order (exponent), in our case, each term is of order 2, we call such equations homogeneous. ↩︎
- Relatively prime (or coprime) integers are pairs of integers that have ↩︎
- The slick way to prove that is not divisible by 4 is to use modular arithmetic. The proof would be something like this:
Proof Idea: For any we have (why?) Which is not zero mod 4. ↩︎ - Let Our goal is to prove
Suppose, on the contrary, that it follows that and Equivalently, and for some Rearranging these equations, we get
Therefore, is a common divisor of both and with the property that This contradicts that ↩︎ - Complex as in maybe? ↩︎

Leave a comment