A primitive Pythagorean triple is a Pythagorean triple (a, b, c) whose three numbers have no common factor greater than 1, so gcd(a, b, c) = 1. Examples are 3-4-5, 5-12-13 and 8-15-17. Every other triple, such as 6-8-10, is a whole-number multiple of exactly one primitive triple.
Primitive triples are the atoms of the subject: understand them and you understand every triple. The proofs below need only remainders, factoring and prime numbers.
Definition and examples
Here gcd means the greatest common divisor, the largest whole number that divides all the numbers in question. A triple is primitive when that number is 1; in other words, you cannot shrink the triangle and keep whole-number sides.
If a triple is not primitive, let g = gcd(a, b, c) and divide through. The result is still a triple, because dividing a2 + b2 = c2 by g2 gives (a over g)2 + (b over g)2 = (c over g)2, and it is primitive, because we removed the largest common factor. So 30-40-50 = 10 × (3-4-5) and 20-48-52 = 4 × (5-12-13).
A useful lemma: checking two numbers is enough
In a Pythagorean triple, any prime that divides two of the numbers also divides the third. Suppose a prime p divides a and c. Then it divides c2 − a2 = b2, and a prime that divides b2 must divide b. The other pairs work the same way. So for a triple,
gcd(a, b, c) = 1 ⇔ gcd(a, b) = 1 ⇔ gcd(a, c) = 1 ⇔ gcd(b, c) = 1That means the numbers of a primitive triple are pairwise coprime: no two of them share a factor.
How to test whether a triple is primitive
- Confirm it is a triple: check a2 + b2 = c2.
- Find gcd(a, b), the greatest common divisor of the two legs. For small numbers, list the factors; for larger ones, use the Euclidean algorithm (divide, keep the remainder, repeat).
- Read the answer. If the gcd is 1, the triple is primitive. If it is g > 1, divide all three numbers by g to get the primitive triple underneath.
Example: is 20-99-101 primitive?
It is a triple, since 400 + 9801 = 10201 = 1012. Now run the Euclidean algorithm on the legs:
99= 4 × 20 + 1920= 1 × 19 + 119= 19 × 1 + 0The last nonzero remainder is 1, so gcd(20, 99) = 1 and 20-99-101 is primitive.
| Triple | gcd(a, b) | Primitive? | Reduces to |
|---|---|---|---|
| 20-99-101 | 1 | yes | — |
| 33-44-55 | 11 | no | 11 × (3, 4, 5) |
| 39-80-89 | 1 | yes | — |
| 24-70-74 | 2 | no | 2 × (12, 35, 37) |
| 28-45-53 | 1 | yes | — |
| 45-108-117 | 9 | no | 9 × (5, 12, 13) |
ShortcutsA triple is certainly not primitive if both legs are even, if the hypotenuse is even, or if the hypotenuse is a multiple of 3 (all proved below). For example, 117 = 9 × 13, so 45-108-117 cannot be primitive, and indeed it is 9 × (5-12-13).
Exactly one leg is even, and the hypotenuse is odd
The key tool is what happens to squares when you divide by 4. An even number is 2k and an odd number is 2k + 1, so
(2k)2= 4k2 (remainder 0)(2k + 1)2= 4k2 + 4k + 1 (remainder 1)Every perfect square leaves remainder 0 or 1 when divided by 4, never 2 or 3. Now take a primitive triple and look at the legs:
- Both even is impossible. Then c2 = a2 + b2 is even, so c is even, and 2 divides all three numbers.
- Both odd is impossible. Then a2 + b2 leaves remainder 1 + 1 = 2, and no square does.
- So one leg is odd and the other even, and c2 = odd + even is odd, which makes c odd.
From here on we follow the usual convention: a is the odd leg and b the even leg, even if a is the longer one. In 8-15-17, for instance, a = 15 and b = 8.
Every primitive triple comes from Euclid's formula
TheoremLet (a, b, c) be a primitive Pythagorean triple with b even. Then there are unique whole numbers m > n > 0, with no common factor and not both odd, such that a = m2 − n2, b = 2mn and c = m2 + n2. Conversely, every such pair m, n gives a primitive triple.
This is the precise sense in which Euclid's formula "generates all primitive triples". The proof uses nothing beyond factoring and the fact that every whole number splits into primes in only one way.
Proof that every primitive triple has this form
- Factor. Rearranging gives b2 = c2 − a2 = (c − a)(c + a). Since a and c are both odd, c − a and c + a are both even. Write u = c + a over 2 and v = c − a over 2, which are positive whole numbers with u > v. Dividing by 4 gives (b over 2)2 = uv, where b over 2 is a whole number because b is even. Notice also that c = u + v and a = u − v.
- The factors are coprime. Any number d dividing both u and v divides u + v = c and u − v = a. But gcd(a, c) = 1 by the lemma, so d = 1.
- Each factor is a square. In the prime factorization of the square uv, every prime appears an even number of times. Because u and v share no prime, each prime of u appears in u alone, still an even number of times, so u is a perfect square; likewise v. Write u = m2 and v = n2 with m > n > 0.
- Read off the formula. Now c = u + v = m2 + n2, a = u − v = m2 − n2, and b over 2 = √uv = mn, so b = 2mn.
- Check the conditions. A common factor of m and n would be a common factor of u and v, so gcd(m, n) = 1. And m, n can't both be odd (or both even), since then a = m2 − n2 would be even. This completes the proof.
Proof of the converse
Take m > n > 0 with no common factor, one even and one odd, and set a = m2 − n2, b = 2mn, c = m2 + n2. It is a triple by algebra. Suppose a prime p divided both a and c. Since c is odd (one odd square plus one even square), p is odd. It divides c + a = 2m2 and c − a = 2n2, so it divides m2 and n2, hence m and n. That contradicts gcd(m, n) = 1. So gcd(a, c) = 1, and by the lemma the triple is primitive.
Why m and n are unique
The proof also tells you how to recover them: m2 = c + a over 2 and n2 = c − a over 2, where a is the odd leg. For 20-21-29 the odd leg is 21, so m2 = 29 + 21 over 2 = 25 and n2 = 29 − 21 over 2 = 4, giving m = 5, n = 2. Check: 2 × 5 × 2 = 20. Different pairs (m, n) therefore always give different primitive triples.
A second, more geometric proof finds all rational points on the circle x2 + y2 = 1 by drawing lines through (−1, 0); it is explained, with an animation, on the Euclid's formula page. A third approach organizes all primitive triples into a family tree; see the tree of primitive Pythagorean triples.
How many primitive triples are there?
Infinitely many. Taking m = n + 1 works for every n ≥ 1, because consecutive numbers share no factor and one of them is even. It produces the endless family (2n + 1, 2n2 + 2n, 2n2 + 2n + 1): 3-4-5, 5-12-13, 7-24-25, 9-40-41 and so on.
Counting them up to a limit shows a striking regularity. The number of primitive triples with hypotenuse at most N is very close to N over 2π, about 0.159 × N:
| Hypotenuse up to N | Primitive triples | N ÷ 2π (rounded to 0.1) |
|---|---|---|
| 100 | 16 | 15.9 |
| 1,000 | 158 | 159.2 |
| 10,000 | 1,593 | 1,591.5 |
| 100,000 | 15,919 | 15,915.5 |
| 1,000,000 | 159,139 | 159,154.9 |
Which numbers are hypotenuses and legs
- A number c is the hypotenuse of a primitive triple exactly when every prime factor of c leaves remainder 1 when divided by 4. If c has k different prime factors, it is the hypotenuse of exactly 2k − 1 primitive triples. So 5 has one (3-4-5); 65 = 5 × 13 has two (16-63-65 and 33-56-65); and 1105 = 5 × 13 × 17 has four (47-1104-1105, 264-1073-1105, 576-943-1105 and 744-817-1105). This rests on Fermat's theorem on sums of two squares, which we use here without proof.
- A number is a leg of a primitive triple exactly when it is odd and at least 3, or a multiple of 4. Numbers like 6, 10 and 14, which are 2 more than a multiple of 4, never are. With k different prime factors, such a number is a leg of exactly 2k − 1 primitive triples: 12 = 2² × 3 is a leg of two, 5-12-13 and 12-35-37.
Both rules were checked by computer for every number up to 3,000 (hypotenuses) and 150 (legs). The list of Pythagorean triples shows them in action.
Divisibility properties, with proofs
Throughout, (a, b, c) is primitive, a is odd, b is even, and m, n are its Euclid parameters.
1. The even leg is a multiple of 4
b = 2mn, and one of m, n is even, so b = 2 × (even) is a multiple of 4.
2. Exactly one leg is a multiple of 3, and the hypotenuse never is
A square leaves remainder 0 or 1 when divided by 3 (because (3k ± 1)2 = 9k2 ± 6k + 1). If neither leg were a multiple of 3, then a2 + b2 would leave remainder 1 + 1 = 2, which no square does. Both legs can't be multiples of 3 in a primitive triple, so exactly one is. If 3 divided c, then a2 + b2 would leave remainder 0, which forces both squares to leave remainder 0, so both legs would be multiples of 3; impossible.
3. Exactly one of the three numbers is a multiple of 5
A square leaves remainder 0, 1 or 4 when divided by 5. If neither leg is a multiple of 5, the two squares leave remainders from {1, 4}, and the possible sums are 1 + 1 = 2, 4 + 4 = 8 (remainder 3) and 1 + 4 = 5 (remainder 0). Only the last can be a square, and then c2, hence c, is a multiple of 5. So at least one number is a multiple of 5, and since they are pairwise coprime, exactly one is.
4. Consequences for products and area
Since 4 divides b and 3 divides a leg, ab is a multiple of 12 and the area 1 over 2ab is a multiple of 6. Adding the factor 5 gives: abc is a multiple of 3 × 4 × 5 = 60.
5. The hypotenuse leaves remainder 1 when divided by 4
c = m2 + n2 with one of m, n odd and the other even, so c leaves remainder 1 + 0 = 1.
6. Sums and differences are squares
From the proof, c + a = 2m2 and c − a = 2n2. Also c + b = m2 + 2mn + n2 = (m + n)2 and c − b = (m − n)2. For 20-21-29: 29 − 20 = 9 = 32, 29 + 20 = 49 = 72, 29 − 21 = 8 = 2 × 22 and 29 + 21 = 50 = 2 × 52.
| Triple | Even leg | ÷ 4 | ÷ 3 | ÷ 5 | c mod 4 | abc ÷ 60 |
|---|---|---|---|---|---|---|
| 3-4-5 | 4 | 4 | 3 | 5 | 1 | 1 |
| 5-12-13 | 12 | 12 | 12 | 5 | 1 | 13 |
| 8-15-17 | 8 | 8 | 15 | 15 | 1 | 34 |
| 7-24-25 | 24 | 24 | 24 | 25 | 1 | 70 |
| 20-21-29 | 20 | 20 | 21 | 20 | 1 | 203 |
| 12-35-37 | 12 | 12 | 12 | 35 | 1 | 259 |
| 9-40-41 | 40 | 40 | 9 | 40 | 1 | 246 |
| 28-45-53 | 28 | 28 | 45 | 45 | 1 | 1,113 |
| 11-60-61 | 60 | 60 | 60 | 60 | 1 | 671 |
| 16-63-65 | 16 | 16 | 63 | 65 | 1 | 1,092 |
| 33-56-65 | 56 | 56 | 33 | 65 | 1 | 2,002 |
| 48-55-73 | 48 | 48 | 48 | 55 | 1 | 3,212 |
| 13-84-85 | 84 | 84 | 84 | 85 | 1 | 1,547 |
| 36-77-85 | 36 | 36 | 36 | 85 | 1 | 3,927 |
| 39-80-89 | 80 | 80 | 39 | 80 | 1 | 4,628 |
| 65-72-97 | 72 | 72 | 72 | 65 | 1 | 7,566 |
Non-primitive triplesMultiplying by k can only add factors, so every triple keeps the "at least one" versions: an even leg divisible by 4, a leg divisible by 3, a number divisible by 5, area a multiple of 6, and abc a multiple of 60. The "exactly one" and "c is odd" statements can fail: 15-20-25 has three multiples of 5, and 6-8-10 has an even hypotenuse. Parity arguments like these are the same kind that prove √2 is irrational, and Fermat combined them with the theorem above in his proof of the case n = 4 of Fermat's Last Theorem.
Frequently asked questions
Is 6-8-10 a primitive Pythagorean triple?
No. All three numbers are even, so their greatest common divisor is 2. Dividing by 2 gives 3-4-5, which is the primitive triple behind it.
How do you know if a Pythagorean triple is primitive?
Find the greatest common divisor of the two legs. If it is 1, the triple is primitive; otherwise divide all three numbers by it. You never need to check the hypotenuse separately, because in a triple any common factor of two numbers is shared by all three.
Can the hypotenuse of a primitive triple be even?
Never. The legs of a primitive triple are one odd and one even, so c2 is odd and so is c. In fact c is always 1 more than a multiple of 4, such as 5, 13, 17, 25 or 29.
How many primitive Pythagorean triples have hypotenuse under 100?
Sixteen: 3-4-5, 5-12-13, 8-15-17, 7-24-25, 20-21-29, 12-35-37, 9-40-41, 28-45-53, 11-60-61, 16-63-65, 33-56-65, 48-55-73, 13-84-85, 36-77-85, 39-80-89 and 65-72-97.
Can both legs of a primitive triple be prime numbers?
No, because the even leg is always a multiple of 4. The odd leg and the hypotenuse can both be prime, though, as in 3-4-5, 5-12-13, 11-60-61 and 19-180-181.
Sources and further reading
- W. Sierpiński, Pythagorean Triangles (1962; Dover reprint, 2003). A whole book of theorems about triples, including the divisibility results above.
- G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers (Oxford University Press). The standard reference for sums of two squares.
- Pythagorean triple, Wikipedia.
- Pythagorean Triple, Wolfram MathWorld.
Keep exploring
- TriplesPythagorean TriplesWhat Pythagorean triples are, the common ones to know (3-4-5, 5-12-13, 8-15-17…), how to generate and recognize them, and the patterns every triple shares.
- TriplesEuclid's Formula for Pythagorean TriplesEuclid's formula a = m² − n², b = 2mn, c = m² + n² explained: two derivations, a table for m ≤ 8, when the triple is primitive, and four other classic generators.
- TriplesThe Tree of Primitive Pythagorean TriplesThe Berggren tree builds every primitive Pythagorean triple exactly once from 3-4-5 using three matrices. See the tree to depth 3, worked examples and the proof.
- TriplesList of Pythagorean TriplesComplete, computer-checked list of Pythagorean triples: all 52 with hypotenuse up to 100 and all 47 primitive triples up to 300, with m, n, perimeter and area.
- TriplesFermat's Last TheoremFermat's Last Theorem says aⁿ + bⁿ = cⁿ has no whole-number solutions for n > 2: Fermat's margin note, his proof for n = 4, Wiles's proof, why squares differ.
- LearnWhy the Square Root of 2 Is IrrationalWhy the square root of 2 is irrational: the classic even-odd proof, Tennenbaum's picture proof, the Hippasus legend, the YBC 7289 tablet and √2's continued fraction.