Tuesday, April 21, 2009

Pythagorean Triples: An Easier Way

Almost done. Promise

There Has to Be an Easier Way

Continued fractions are a pain (to be kind), and my first attempts resulted in errors that were compounded in later steps. (I had 84, 85, 119 at one point. Not quite.)
However, I noticed that the numerators and denominators of the convergents of the continued fraction of follow a pattern

P1 = 1, Q1 = 0, Qn+1 = Pn, Pn+1 = 2 X Pn + Qn

To follow my method, calculate 1 + Q/P as an improper fraction.
As in my prior post, this will give you a triple in the form (a+b)/c, where b = a + 1.

This method was "easier" for me than what Kraitchik (1953) wrote, but it required more iterations to get each Pythagorean Triple.

Kraitchik offers a shortcut, which is essentially:
a = 2PQ and b = P2 - Q2, which yields numbers such that
| a - b | = 1

For example:
a = 2(2)(1) = 4, b = (2)2 - (1)2 = 3, c = 5
a = 2(5)(2) = 20, b = (5)2 - (2)2 = 21, c = 29
a = 2(12)(5) = 120, b = (12)2 - (5)2 = 119, c = 169

The same triples were reached in half the steps. The downside is that these numbers get so big as to be unusable. We didn't use calculators when I was in high school, so it is not surprising that I never saw these:

a = 2(29)(12) = 696, b = (29)2 - (12)2 = 697, c = 985
a = 2(70)(29) = 4060, b = (70)2 - (29)2 = 4059, c = 5741
a = 2(169)(70) = 23,660, b = (169)2 - (70)2 = 23,661, c = 33,461
a = 2(408)(169) = 137,904, b = (408)2 - (169)2 = 137,903, c = 195,025
a = 2(985)(408) = 803,760, b = (985)2 - (408)2 = 803,761, c = 1,136,689
a = 2(2378)(985) = 4,684,660, b = (2378)2 - (985)2 = 4,684,659, c = 6,625,109

Last two notes about patterns:
First, notice that every value for c later shows up as P and Q. Keep expanding the list if you don't believe me. I dare you.
Second, notice that the value of b - a alternates between -1 and +1 for each step. What does that mean? I don't know. I just found it curious.

Kraitchik, Maurice (1953). Mathematical Recreations, Second Revised Edition, Dover Publishing.


Keith said...
This comment has been removed by the author.
Keith said...

Why don't you check out Eric Rowland's "Pythagorean Triples Project" by googling that title.

Also you could view my paper on ordering the primitive triples at




(x, why?) said...

I'll take a look.

Like I said, it's just a journal I keep. A present from a co-ordinator who came into our high school a couple of years ago.

If something strikes me mathematically, I'll look into it. Sometimes I can't let go of it until I have some reason why. And I like to know that I can still reason some things out. I can't imagine how much I've forgotten since college by being first a programmer and then a middle and high school teacher.

(x, why?) said...

By the way, when I started working on the Sqrt(2) triples after reading Kraitchik's book, I did a Google search and found the same sequence that I "discovered" for myself in the On-Line Encyclopedia of Integer Sequences. It was number 129: Pell numbers, also called lambda numbers.


Keith said...

Yes, I know what you mean.

I wish many findings were easier to find in texts and online, so we don't keep rediscovering them. Then again, if I had known about the Pell numbers (w/respect to the triples) I never would have went on to find the rest of the sequences, using a graphing calculator. And I haven't found those sequences anywhere. Eric Rowland's Project was the closest thing I found - that there exist pairs of sequences with Pellian recursion that generate the rest of the primitive triples, and order and sort them.

Keith said...

Links below to see the revised version of my paper on ordering the Pythagorean triples by Pellian sequences (using Pell-type recursion to preserve leg difference):



Keith said...

HEY! How about a contest???

Who can either unearth or craft a proof that no pair of Pythagorean triples of the form {a, b, c} and {2a, d, c} exists?

Without loss of generality, I believe, we can safely assume that the triples are primitive and the doubled leg is the even one, ie a is even.

We could extend this to any or all n such that no pair of Pythagorean triples of the form {a, b, c} and {na, d, c} exists.

Whaddayou think???

(x, why?) said...

I have to be honest with you, I've never really given the matter much thought. (I'm guessing you've given it some.)

I never really noticed different right triangles with the same hypotenuse, at least, not primitive ones.

A quick check online shows there are many, many of them out there, but with numbers so big that they wouldn't be of much use to an Algebra teacher.

Two things that I noticed that I was curios about: first, (33, 56, 65) and (16, 63, 65). The first of these two isn't on my list because it didn't fit into my of my defined "types", and I didn't use any of the formulas available for generating every triple possible.

The second thing I noticed is that every hypotenuse that ended in 5 had multiple triples, except 5, 25, 625, 3125, etc.

See what you did? You made me curious. I wish you had done that at the beginning of my week off and not right before I go back to work!

As for the challenge, I'll give it some thought. Like all things like this, I suppose that the answer is already out there somewhere, so I hope I don't accidentally stumble across it while I'm thinking about it.

If you have a proof or come up with a proof, you can post it, or post a link to it.

Keith said...

No proof yet, and I've been asking/posting around for about two years now.

After I read your comment about the repeated hypotenuses I looked into it and noticed that the hypotenuses involved were composites of 1 mod 4 primes (primes of the form 4n + 1).

Then, coincidentally, this fellow, who insists he has a proof for my contest question that extends to multiplying a leg by any number, sent an email about 'sibling triples' (same hypotenuse). It is apparently known that the number of sibling triples for each hypotenuse depends on the number of 1 mod 4 prime factors in the hypotenuse. If r is that number, then there exist 2^(r - 1) PPTs with the given hypotenuse.

The (contest question) proof is based on showing that you can't transform triples represented via the Fibonacci Box into the desired doubled leg, same hypotenuse triples. At this point, though, I don't buy this as a proof that such triples cannot exist. So, it's still open for proving as far as I'm concerned.

(x, why?) said...

One other thing that we can assume is that the even leg is the smaller of the two as the larger leg will be greater than half of the hypotenuse.

My earlier comment about the fives turned out to be explained easily enough: I didn't look fall enough. The repeated hypotenuses which I noted were all products of other hypotenuses from other triples. Naturally, all the multiples of fives came first, until 13 x 17 came along.

I did work on defining d into a quadratic, but it's been a while. It doesn't look like a perfect square (e.g., x^2 + 2nx + n^2) but I might just not be looking at it correctly.

Unknown said...

Corollaries and conjecture:
If a pair of triples of the form {a,b,c} and {2a,d,c} exist, then it is easy to show that
c – 2a, c -a, c + a and c + 2a are squares. Just look at their forms in Euclid’s algorithm,
given that a must be even (must equal 2mn, c – a = m^2 – 2mn + n^2,
c – 2a = r^2 – 2rs + s^2, etc.)
Let these squares be represented as M^2, N^2, O^2 and P^2. The first and last two
differ by a = N^2 – M^2, and the middle two differ by 2a. So, we can represent them
as M^2, N^2, 3N^2 – 2M^2 and 4N^2 – 3M^2, with M and N odd. It appears from
inspection of tables that when 3N^2 – 2M^2 or 4N^2 – 3M^2 is a square, the other
misses being an odd square by a factor of 8. In other words, either O or P must be irrational, it appears. In still other words, if you take an interval with perfect square
endpoints and advance it by double its length, one of the new endpoints is not a
perfect square; the image of the original interval under the square root function has
integral length, while the image of the new one has irrational length. If this conjecture is proven true, it would suffice in proving that the original triples could not
Also, if we represent O as N +q and P as N + p, then we get that q^2 + 2Nq over
p^2 + 2Np must equal 2/3. There are some inherent constraints: p and q are even
integers, with p bigger, and N must be greater than or equal to 1/2q^2 + Nq + 1.
If that quotient can never be exactly 2/3 for qualifying entries of p, q and N, then no
such original triples exist.

Keith said...

That's ME above