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

### Pythagorean Triples

```
Date: 07/10/97 at 19:04:43
From: Jason Osborne
Subject: Pythagorean triples

Can you tell me why (3,4,5), (20,21,29), (119,120,169), and
(696,697,985) are Pythagorean triples?

I noticed the following pattern: (5^2+4)/1 = 29, (29^2+4)/5 = 169,
(169^2+4)/29 = 985 and so on.  Why does this occur?
```

```
Date: 07/11/97 at 15:33:26
From: Doctor Rob
Subject: Re: Pythagorean triples

Good question! Obviously you have made an interesting observation
here. And yes, I can explain why this happens, but my explanation is
somewhat complicated.

For some relatively prime integers u and v of opposite parity (i.e.,
one odd, one even), primitive (that is, with no common GCD)
Pythagorean triples (a,b,c) satisfy the relations:

a = 2*u*v
b = u^2 - v^2
c = u^2 + v^2

The triples you are looking at have |a - b| = 1. When we substitute in
this last equation, we find that for some integer n:

u^2 - 2*u*v - v^2 = (-1)^n

If we complete the square on u, we get:

(u - v)^2 - 2*v^2 = (-1)^n

Letting w = u - v, this becomes:

w^2 - 2*v^2 = (-1)^n

This equation is called Pell's Equation, for no very good reason (but
that's a different story). Its solutions are known, and here are the
first few:

(w,v) = (1,0), (1,1), (3,2), (7,5), (17,12), (41,29), (99,70), ...

(Of course if (w,v) works, so will (w,-v), (-w,v), and (-w,-v).)

Where n = 0, 1, 2, 3, 4, 5, 6, ..., respectively, the general formula
is:

w(n) = [(1 + Sqrt[2])^n + (1 - Sqrt[2])^n]/2
v(n) = [(1 + Sqrt[2])^n - (1 - Sqrt[2])^n]/(2*Sqrt[2])

Now it may appear miraculous that all the square roots of 2 simply
drop out when we expand these expressions, and that the denominators
do divide evenly into the numerators, and when all is said and done,
the values of w(n) and v(n) are integers. Miracle or not, it happens!

We let r = 1 + Sqrt[2] and s = 1 - Sqrt[2], and note that r + s = 2,
r - s = 2*Sqrt[2], and r*s = -1.  Then:

w(n) = (r^n + s^n)/(r + s)
v(n) = (r^n - s^n)/(r - s)

Given this solution, it is easy to see that both w(n) and v(n) satisfy
the same recursion:

w(n) = 2*w(n-1) + w(n-2)
v(n) = 2*v(n-1) + v(n-2)

Recall that u(n) = v(n) + w(n), so it, too, satisfies the same
recursion:

u(n) = 2*u(n-1) + u(n-2)

(You can verify these by substituting the expressions in terms of r
and s and simplifying using the relations between r and s noted in the
last paragraph). Furthermore, they also satisfy the mixed recursions:

w(n) = w(n-1) + 2*v(n-1)
v(n) = w(n-1) + v(n-1)

And so:

u(n) = 2*u(n-1) + v(n-1)
v(n) = u(n-1)

(Again, you can verify this using the r-and-s-form above). Don't
forget that w(n)^2 - 2*v(n)^2 = (-1)^n.

Now for each n >= 0, we have:

a(n) = 2*u(n)*v(n)
b(n) = u(n)^2 - v(n)^2
c(n) = u(n)^2 + v(n)^2

This gives the following sets of triples (which are the ones you
started with):

(a,b,c) = (0,1,1), (4,3,5), (20,21,29), (120,119,169), (696,697,985)

That's a good sign! So far, everything we have done should be correct.

Now you observed that c(n) = [c(n-1)^2 + 4]/c(n-2). To prove this, we
will express everything in sight in terms of v(n-1) and u(n-1), then
in terms of u(n) and v(n), then in terms of v(n) and w(n), and finally
replace v(n)^2 with [w(n)^2 - (-1)^n]/2 wherever we can.  We start
with:

[c(n-1)^2 + 4]/c(n-2)
= [(u(n-1)^2 + v(n-1)^2)^2 + 4]/[u(n-2)^2 + v(n-2)^2]
= [u(n-1)^4 + 2*u(n-1)^2*v(n-1)^2 + v(n-1)^4 + 4]/
[u(n-1)^2 - 4*u(n-1)*v(n-1) + 5*v(n-1)^2]
= [u(n)^4 - 8*u(n)^3*v(n) + 26*u(n)^2*v(n)^2 - 40*u(n)*v(n)^3 +
25*v(n)^4 + 4]/[5*u(n)^2 - 24*u(n)*v(n) + 29*v(n)^2]
= [5 + 4*(-1)^n*v(n)*w(n) - 6*(-1)^n*w(n)^2 - 8*v(n)*w(n)^3 +
6*w(n)^4]/[-5*(-1)^n - 14*v(n)*w(n) + 10*w(n)^2]
= -(-1)^n + 2*v(n)*w(n) + 2*w(n)^2
= u(n)^2 + v(n)^2
= c(n)

You can check the next-to-next-to-last equality by cross-multiplying,
then setting v(n)^2 = [w(n)^2 - (-1)^n]/2.

So your conjecture is true: it is a theorem!  There may be a shorter,
easier proof, but I don't know it.

-Doctor Rob,  The Math Forum
Check out our web site!  http://mathforum.org/dr.math/
```
Associated Topics:
College 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