Associated Topics || Dr. Math Home || Search Dr. Math

### Generating Pythagorean Triples

```
Date: 03/17/2001 at 10:57:37
From: Samantha
Subject: Pythagorean Triplets

Dear Dr. Math,

I am doing a math extra credit project and I need to figure out the
sixteen primitive Pythagorean triples. I have found 3,4,5; 5,12,13;
8,15,17; 7,24,25; 20,21,29; 9,40,41; 12,35,37; 11,60,61; 28,45,53;
33,56,65; 16,63,65; .

The second part of the question is to figure out how many Pythagorean
triples there are such that the numbers of the triple lie between
1 and 100.

Sam
```

```
Date: 03/17/2001 at 11:42:20
From: Doctor Paul
Subject: Re: Pythagorean Triplets

Let's talk about how to generate primitive Pythagorean triples.

a   3   5   7   9  11  13
b   4  12  24  40  60   ?
c   5  13  25  41  61   ?

Do you see a pattern?  The first row is just the odd numbers: 3,5,7,9,
etc...

Is there a relation between the second row and the third row?  Looks
like the third row is just the second row plus one.

If there is a way to generate the number 'b' when given 'a', we will
be done because once we know 'b' we can get 'c' just by adding one.

Perhaps it will help if we add another row:

a^2  9  25  49  81  121  169
a    3   5   7   9   11   13
b    4  12  24  40   60    ?
c    5  13  25  41   61    ?

Now do you see a relation between 'a' and 'b'?

It looks as if a^2 = 2b+1 or, solving for b,

b = (a^2 - 1)/2

So if a = 13, b = (169 - 1)/2 = 168/2 = 84.  It follows then that
c = 84+1 = 85.

So the claim is that 13,84,85 is a primitive Pythagorean triple.  This
is in fact the case.

Using the same method, we get 15,112,113 and we can go on forever.

Why does this work?

We want to show that a^2 + b^2 = c^2

Just make the substitution:
b = (a^2 - 1)/2 and
c = b + 1 = ((a^2 - 1)/2) + 1

Multiply everything out and you'll see that the two sides are equal.

So that works when a is odd.  What about when a is even?

The triples aren't going to all be primitive in this case, but let's
look at them anyway for pattern analysis.

a   4   6   8  10  12  14
b   3   8  15  24  35   ?
c   5  10  17  26  37   ?

Again we ask the question - given a value for 'a', can we generate 'b'
and 'c'?  Well it looks like if we know what the value of 'b' is, we
can add two to it to get 'c'.  Let's again add the a^2 row to help us
out:

a^2  16  36  64  100  144
a     4   6   8   10   12   14
b     3   8  15   24   35    ?
c     5  10  17   26   37    ?

Do you see that a^2 = 2(b+c)  ?

Substitute c = b+2 to obtain a^2 = 2(2b+2).  Solving for b yields:

b = (a^2 - 4)/4

So given a = 14, b = (196-4)/4 = 192/4 = 48 and c = 48 + 2 = 50.

A similar procedure shows that 16,63,65 and 18,80,82 are also
Pythagorean triples.

It appears to be the case that whenever 'a' is a multiple of four, the
triple is primitive. When it isn't, the triple is not primitive. Can
you figure out why this is the case?

Again, we wonder why this works.

You can show that a^2 + b^2 = c^2 by making the substitution:

b = (a^2 - 4)/4 and c = b + 2 = b = ((a^2 - 4)/4) + 2

and simplifying the terms.

This should help you generate all of the Pythagorean triples you need

- Doctor Paul, The Math Forum
http://mathforum.org/dr.math/
```
Associated Topics:
High School Number Theory

Search the Dr. Math Library:

 Find items containing (put spaces between keywords):   Click only once for faster results: [ Choose "whole words" when searching for a word like age.] all keywords, in any order at least one, that exact phrase parts of words whole words

Submit your own question to Dr. Math
Math Forum Home || Math Library || Quick Reference || Math Forum Search