## Pythagorean triples

Pythagorean triples consists of three positive integers *a*, *b*, and *c*, such that *a*^{2} + *b*^{2} = *c*^{2}. These triples are commonly written as (*a*, *b*, *c*), and a typical example is (3, 4, 5); 3^{2} + 4^{2} = 5^{2} or 9 + 16 = 25.

A primitive Pythagorean triple is one in which *a*, *b* and *c* are coprime (gcd(*a*, *b*, *c*) = 1) and for any primitive Pythagorean triple, (*ka*, *kb*, *kc*) for any positive integer *k* is a non-primitive Pythagorean triple.

Euclid’s formula (300 BC) will generate Pythagorean triples given an arbitrary pair of positive integers `m` and `n` with `m` > n > 0. A primitive Pythagorean triple additionally require:

`m`and`n`have opposite parity – i.e. if one is odd, the other must be even.`m`and`n`are coprime – i.e. they have no common integer factors greater than 1.

It’s easy to check algebraically that the sum of the squares of the first two is the same as the square of the last one.

Below is a table of [a, b, c] for `n` between 1 and 9 and `m` between 2 and 10.

The highlighted cells show **primitive** Pythagorean triples (GCD(a, b, c) = 1).

n = | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
---|---|---|---|---|---|---|---|---|---|

m ↓ | |||||||||

2 | [3,4,5] | ||||||||

3 | [8,6,10] | [5,12,13] | |||||||

4 | [15,8,17] | [12,16,20] | [7,24,25] | ||||||

5 | [24,10,26] | [21,20,29] | [16,30,34] | [9,40,41] | |||||

6 | [35,12,37] | [32,24,40] | [27,36,45] | [20,48,52] | [11,60,61] | ||||

7 | [48,14,50] | [45,28,53] | [40,42,58] | [33,56,65] | [24,70,74] | [13,84,85] | |||

8 | [63,16,65] | [60,32,68] | [55,48,73] | [48,64,80] | [39,80,89] | [28,96,100] | [15,112,113] | ||

9 | [80,18,82] | [77,36,85] | [72,54,90] | [65,72,97] | [56,90,106] | [45,108,117] | [32,126,130] | [17,144,145] | |

10 | [99,20,101] | [96,40,104] | [91,60,109] | [84,80,116] | [75,100,125] | [64,120,136] | [51,140,149] | [36,160,164] | [19,180,181] |

#### Afterthoughts

- Euclid of Alexandria is the most prominent mathematician of antiquity best known for his treatise on mathematics The Elements. The long lasting nature of The Elements must make Euclid the leading mathematics teacher of all time. However little is known of Euclid’s life except that he taught at Alexandria in Egypt.

It’s in there as 15,8,17 and 35,12,37, which are the same thing.

Euclid’s formula cannot apparently identify triples where b is odd (e.g.8,15,17 or 12,35,37

Love the table of Pythagorean Triples. First example I’ve seen of triples, using Euclid’s formula, that shows the actual integers for m and n, and the resulting triple.

Great piece if work.

Thanks Robert. It’s good to know it was useful in some way.