Pythagorean Triples, a2 + b2 = c2
Bill Richardson

This note is an examination of some different ways of generating Pythagorean triples.

The standard method used for obtaining primitive Pythagorean triples is to use the generating equations,

a = r2 - s2, b = 2rs , c = r2 + s 2       (1)
where 0 < s < r , (r, s) = 1 with r and s of opposite parity.

Below are some primitive Pythagorean triples generated by the above equations.

 s = 1 a b c r = 2 3 4 5 r = 4 15 8 17 r = 6 35 12 37 r = 8 63 16 65 r = 10 99 20 101 r = 12 143 24 145 r = 14 195 28 197 r = 16 255 32 257 s = 2 a b c r = 3 5 12 13 r = 5 21 20 29 r = 7 45 28 53 r = 9 77 36 85 r = 11 117 44 125 r = 13 165 52 173 r = 15 221 60 229 r = 17 285 68 293

From these few calculations we can observe some interesting patterns. For example, all the triples for which s = 1 we have that a and c are consecutive odd integers. Furthermore, the triples [3    4    5] and [5    12    13] have b and c as consecutive integers. And, finally, [3     4    5] and [21    20    29] have a and b as consecutive integers. Can we determine conditions that will allow us to generate only those types of triples we wish?

Conditions for a and c to be consecutive odd integers:
In formulas (1), if s = 1, then r must be an even integer of the form r = 2n . We then have

a = 4n2 - 1, b = 4n, c = 4n2 + 1 , n = 1, 2, 3, 4,...       (2)

Or, we could write a and c as functions of b if we let b be an integer of the form b = 4n . Then

b = 4n , a = bn - 1 , and c = bn + 1, n = 1, 2, 3, 4, ...

Conditions for b and c to be consecutive integers:
If b, c are to be consecutive integers, we have from (1) that r2 + s2 = 2rs + 1 . Thus, r2 + s2 - 2rs + 1 and (r + s)2 =1 . Since 0 < s < r, r - s = 1 , or r = s + 1 . When we put these values of r in (1), we have

a = 2s + 1, b = 2s(s + 1), and c = 2s(s + 1) + 1, s = 1,2,3,4,...       (3)

This result can also be written as

a = 2n + 1, b = (a + 1)n, and c = (a + 1)n + 1, n = 1,2,3,4,...       (4)

Conditions for a and b to be consecutive integers:
This is a tougher problem. We do not get nice things happening, as in the previous cases. However, if we try to see if we can express the relationship between these triples as a recurrence relation, we see that the best chance is if there is a matrix

 a11 a12 a13 a21 a22 a23 a31 a32 a33

such that

 3 4 5 20 21 29 119 120 169
*
 a11 a12 a13 a21 a22 a23 a31 a32 a33
=
 20 21 29 . 119 120 169 696 697 985
The solution to this matrix equation yields the matrix
 2 1 2 . 1 2 2 2 2 3

Thus,

[ 3     4     5] *
 2 1 2 1 2 2 2 2 3
=[ 20     21     29]
and
[20    21    29] *
 2 1 2 1 2 2 2 2 3
=[119     120     169]

We therefore have a generator for the triples with a and b consecutive integers.

[ an      bn      cn ] = [ an-1     bn-1     cn-1 ] *
 2 1 2 1 2 2 2 2 3
 where a0 = 3, b0 = 4, c0 = 5. (5)
A natural question to ask now is, "Are there matrix forms for the previous two cases?" As it turns out there are. For a and c consecutive odd integers we need to solve the following
 3 4 5 15 8 17 35 12 37
*
 a11 a12 a13 a21 a22 a23 a31 a32 a33
=
 15 8 17 . 35 12 37 63 16 65
The solution to this matrix equation yields the matrix
 -1 -2 -2 . 2 1 2 2 2 3
so that our matrix solution would be
[ an      bn      cn ] = [ an-1      bn-1      cn-1 ] *
 -1 -2 -2 2 1 2 2 2 3
 where a0 = 3, b0 = 4, c0 = 5. (6)
For the case where b and c are consecutive integers, we need to solve the equation
 3 4 5 5 12 13 7 24 25
*
 a11 a12 a13 a21 a22 a23 a31 a32 a33
=
 5 12 13 . 7 24 25 9 40 41
The solution to this matrix equation yields the matrix
 1 2 2 . -2 -1 -2 2 2 3
so that our matrix solution would be
[ an      bn      cn ] = [ an-1      bn-1      cn-1 ] *
 1 2 2 -2 -1 -2 2 2 3
 where a0 = 3, b0 = 4, c0 = 5. (7)

We can't help but notice the similarity in these matrices. In fact, in the case where a and b are consecutive integers, we used the triples where b = a + 1 . If we let a and b be consecutive integers in the order they appear when generated by equations (1), we would get the matrix equation

 3 4 5 21 20 29 119 120 169
*
 a11 a12 a13 a21 a22 a23 a31 a32 a33
=
 21 20 29 . 119 120 169 697 696 985
The solution to this matrix equation yields the matrix
 1 2 2 . 2 1 2 2 2 3

From this we see that all the matrices are the same except for making the elements in row one or two negative for the cases a and c consecutive odd integers or b and c consecutive integers, respectively.

Wait! There's More.

The matrices we found do more than we might have thought. The matrix we found to generate Pythagorean triples in which a and c are consecutive odd integers

 -1 -2 -2 2 1 2 2 2 3
actually does more. It, in fact, will preserve the difference c - a , regardless of what it is. If one were to multiply any Pythagorean triple, [ a    b     c ] with this matrix, we would get the triple
[ -a + 2b + 2c     -2a + b +2c    -2a + 2b + 3c ]
and the difference between the first term and the last term is
(-2a + 2b + 3c) - (-a + 2b + 2c) = c - a.
So the difference is preserved. It should be noted that you will not get the next triple in line after [ a    b     c ], but you will get one for which c - a is the same.

The same is true for the other two cases. The matrix

 1 2 2 -2 -1 -2 2 2 3
will preserve the c - b . For if we multiply a triple [ a    b     c ] by this matrix we will get for the difference between the last term and the middle term
(2a - 2b + 3c) - (2a - b + 2c) = c - b.

Finally, the matrix

 2 1 2 1 2 2 2 2 3
will preserve the difference b - a . For, if we multiply a triple [ a    b     c ] by this matrix we will get for the difference between the second term and the first term
(a + 2b + 2c) - (2a + b + 2c) = b - a.

A Final Note. We can use the matrix representations to get the following generators for the special Pythagorean triples.

For the case c = a + 2 , that is, a and c consecutive odd integers, we have

 an = an-1 + 2bn-1 + 4 bn = bn-1 + 4 cn = an-1 + 2bn-1 + 6 = an + 2
where [ an-1    bn-1    cn-1 ] is a Pythagorean triple with cn-1 = an-1 + 2 .

For the case c = b + 1 , that is, b and c consecutive integers, we have

 an = an-1 + 2 bn = 2an-1 bn-1 + 2 cn = 2an-1 + bn-1 + 3 = bn + 1
where [ an-1    bn-1    cn-1 ] is a Pythagorean triple with cn-1 = bn-1 + 1 .

Finally, for the case b = a + 1 , that is, a and b consecutive integers, we have

 an = 3an-1 + 2cn-1 + 1 bn = 3an-1 + 2cn-1 + 2 = an + 1 cn = 4an-1 + 3cn-1 + 2
where [ an-1    bn-1    cn-1 ] is a Pythagorean triple with bn-1 = an-1 + 1 .

Back to the Pythagorean page.