Exercise 5.3.1 (First Pythagorean triples)

Find all primitive Pythagorean triples for which 0 < z < 30 .

Answers

Proof. By Theorem 5.5, the positive primitive solutions of x 2 + y 2 = z 2 with y even are

x = r 2 s 2 , y = 2 rs , z = r 2 + s 2 ,

where r , s are arbitrary integers of opposite parity with r > s > 0 and r s = 1 .

If 0 < z < 30 , then 30 > z = r 2 + s 2 > r 2 , thus r 30 = 5 , so

0 < s < r 5 .

We obtain all the possibilities with this Python program:

from math import gcd, floor, sqrt
max_z = 30
max_r = floor(sqrt(max_z))
for r in range(1, max_r + 1):
    for s in range(1, r):
        if gcd(r,s) == 1 and r % 2 != s % 2:
            if r * r + s * s < max_z:
                t = [r * r - s * s, 2 * r * s, r * r + s * s]
                print((r,s), ’=>’, t)

(2, 1) => [3, 4, 5]
(3, 2) => [5, 12, 13]
(4, 1) => [15, 8, 17]
(4, 3) => [7, 24, 25]
(5, 2) => [21, 20, 29]

The positive primitive solutions of x 2 + y 2 = z 2 with y even and 0 < z < 30 are

( 3 , 4 , 5 ) , ( 5 , 12 , 13 ) , ( 15 , 8 , 17 ) , ( 7 , 24 , 25 ) , ( 21 , 20 , 29 ) ,

and all positive primitive solutions are

( 3 , 4 , 5 ) , ( 5 , 12 , 13 ) , ( 15 , 8 , 17 ) , ( 7 , 24 , 25 ) , ( 21 , 20 , 29 ) , ( 4 , 3 , 5 ) , ( 12 , 5 , 13 ) , ( 8 , 15 , 17 ) , ( 24 , 7 , 25 ) , ( 20 , 21 , 29 ) .

(So all primitive Pythagorean triples for which 0 < z < 30 are

( ± 3 , ± 4 , 5 ) , ( ± 5 , ± 12 , 13 ) , ( ± 15 , ± 8 , 17 ) , ( ± 7 , ± 24 , 25 ) , ( ± 21 , ± 20 , 29 ) , ( ± 4 , ± 3 , 5 ) , ( ± 12 , ± 5 , 13 ) , ( ± 8 , ± 15 , 17 ) , ( ± 24 , ± 7 , 25 ) , ( ± 20 , ± 21 , 29 ) . )
User profile picture
2025-04-04 08:28
Comments