(11 votes, average: 4.64 out of 5)

## Pythagorean triples

Pythagorean triples consists of three positive integers a, b, and c, such that a2 + b2 = c2. These triples are commonly written as (a, b, c), and a typical example is (3, 4, 5); 32 + 42 = 52 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.
$a=m^2-n^2, b=2mn \mbox{ and } c=m^2+n^2$

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.

## Discussion

### 5 Responses to “Generating Pythagorean Triples”

1. What is the relationship between Pythagoras,Plato and Euclid Sir.

Posted by Babu.K | October 26, 2020, 6:23 AM
2. It’s in there as 15,8,17 and 35,12,37, which are the same thing.

Posted by Krystal | August 29, 2020, 12:03 AM
3. Euclid’s formula cannot apparently identify triples where b is odd (e.g.8,15,17 or 12,35,37

Posted by Robert Brown | July 18, 2020, 11:29 PM
4. 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.

Posted by Robert Hock | January 31, 2017, 4:36 PM