Sunday, December 27, 2009

Pythagorean Triples

I got interested in this problem last summer at the Math Circle Institute, held at Notre Dame. I have a bad memory and am having fun reconstructing what we figured out together there.

Introduction to Pythagorean Triples
The Pythagorean Theorem tells us that a right triangle with legs a and b and hypotenuse c will always have the relationship a2+b2 = c2. (Do you know how to prove that?) When all three sides are whole numbers, we have a Pythagorean triple. The most famous of these is 32+42 = 52, often referred to in this context as (3,4,5). The 3-4-5 triangle was used in Egypt to help make perpendicular sides for their magnificent buildings. A loop of rope with 12 equally spaced knots (3+4+5 = 12) was pulled taut at knots 0, 3 and 7 to make a precise right angle.

If the three sides don't all have a factor in common, then they make a primitive Pythagorean triple (PPT). 62+82 = 102 is not a PPT because all three sides have a factor of 2.

Starting to Explore

When I'm making up problems for students, I often want another Pythagorean triple, so I have one more sitting in my brain, 52+122 = 132. Are there others? Are there infinitely many PPT's? How would we find more?

One approach to exploring these involves thinking about parity. (Parity refers to whether a number is odd or even.) I see that both of the PPT's above, (3,4,5) and (5,12,13), are odd+even = odd. Can we have odd+odd = even? What about even+even = even? If we have odd+even = odd, does the odd leg have to be the shorter one?

Do other questions occur to you?

Recommendation: stop reading and start playing as soon as you have a thought about how you might proceed.

I knew there were more PPT's, but couldn't remember any others. I wanted to find a few more, so I could see any obvious patterns. So I made a list of the first 25 perfect squares and looked for pairs that would add to equal another perfect square, or subtract to equal another one. I found (8,15,17) and (7,24,25). Well, that's one question answered: the odd leg does not have to be the shortest side. I see that all 4 hypotenuses are odd. So I want to address the question of whether odd+odd = even is possible.

Question1: Is odd+odd = even possible?
Here's how I start: Suppose we have two odd legs. We can let a = 2n+1 and b=2m+1. Then a2+b2 = ... Can we come to a contradiction? [See the hint at the end for a bit more direction.]

Question2: If a is an odd number, can I find a PPT for it?
I notice that all 3 triples in which the odd leg is the short one include consecutive numbers for the other leg and the hypotenuse. Hmm. If a is the short leg, then b+c = a2 in all 3 of those cases. Is that important? What if I write a2+b2 = c2 as c2-b2 = a2? Oh! A square minus a square can factor. So I'd have (c-b)(c+b) = a2. What does that get me? [I found a way to get a PPT for every odd number. Can you?]

Question3: Must the even side be a multiple of 4?
I wanted more triples, in case it would help me see more patterns. So I set up a spreadsheet with column a holding 1 through 100, row 1 holding 1 through 254 (first time I've ever used all available rows!). Column b and row 2 had the squares of these numbers. The rest of the spreadsheet showed a 0 if the square root of the sum of these squares was not a whole number, and otherwise showed the number. [Here's the formula in cell c3: =IF(INT(SQRT($B3+C$2))=SQRT($B3+C$2),SQRT($B3+C$2),0)]

For most multiples of 4, I found a PPT. And I didn't find any for the other even numbers. So I wanted to know whether the even side had to be a multiple of 4. If the even side is a, then b and c are odd, and c2-b2, with b=2m+1 and c=2n+1, can be explored.

Questions 4 and 5: Multiples of 3, 4 and 5
This reminded me that I had read (whose blog was that on?) that in every PPT, 3 will be a factor of one side, 4 will be a factor of one side, and 5 will be a factor of one side. (As in (5,12,13), one side may contain more than one of these factors.) I realized I'd already proved it for 4. I started trying to prove it for 3.

I mentioned parity earlier. Even numbers can be expressed as a=2m, and odd numbers can be expressed as b=2n+1. Similarly, if we want to think about whether side c will be a multiple of 3, we can look at three cases: c=3m, c=3m+1, or c=3m+2. Using this, I started with the question of whether c would be a multiple of 3. (It wasn't in any of the triples I'd found.) If it is, then neither a nor b can be. (Why?) Once I solved that problem, I wanted to prove that one of the legs would be a multiple of 3. Suppose b is not a multiple of 3 and consider c2-b2. There will be 4 cases, each of b and c can either be 3x+1 or 3x+2. What does this make a?

I tried to think about 5 in this way but got nowhere. I'm writing this blog post in hopes that explaining my thinking will help me get further on some of my dead ends.

I have a few other questions I haven't answered:
  • Given a multiple of 4, how can I come up with a PPT?
  • Can the same number show up in 3 different PPT's?
Let me know if you have fun playing with this. Maybe the directions your thinking takes will be different than mine...

Hint: c2 is a multiple of 4. (Why?) What about a2+b2?


  1. I know that you can generate an infinite number of pythagorean triples using fibonacci numbers. I know of two different ways to do this, but here is a link that shows one method.

    The second method is hinted at at the end of the paragraph. In my lesson on fibonacci numbers, I have my learners use one method to calculate a triple, and then find the two fib. numbers using a second method that will create the same triple.

    It is fairly cool to do, actually.

  2. Hi Sue,

    might be a spoiler....
    did you know this one (picked up from the book 'Number' by Tobias Dantzig):

    For any value of u and v such that 2uv is a perfect square we obtain a Pythagorean triangle.
    x = u + sqrt(2uv)
    y = v + sqrt(2uv)
    z = u + v + sqrt(2uv)

    that answers your question: there are infinitely many!

  3. pick a > b coprime, with one even.

    x= a^2 + b^2

    y = 2ab

    then x^2 + y^2 =
    a^4 - 2a^2b^2 + b^4 + 4a^2b^2 =
    so (x, y, a^2+b^2)
    is a ppt.

    i saw a student present this trick
    at capital u when i'd forgotten it.
    never forgot it since.

    it's worth remarking in this context
    (repeatedly) that since the complex
    norm... magnitude, length, abs...
    is the sum of the squares of the
    real & imaginary parts
    abs(x + i y) = x^2 + y^2
    and the norm is "multiplicative"
    ( abs(zw) = abs(z) abs(w) )
    one sees by brute calculation
    that the *product* of
    is itself a sum-of-two-squares.

    i studied those in another life.

  4. I love that all 3 of these comments describe different ways of finding PPT's.

    @ Calvin: I think I already gave the infinite number question away in the post. It's cool.

    @ Glenn and vlorbik: I love that fibonacci numbers and complex numbers come into this - everything is connected.

    What you're all making clearer to me is that I described a procedure different from the one I saw at the Institute. So I'm coming up with something new (to me). I like that.

    After I finished writing this, I went to Wikipedia. The article on Pythagorean triples made dozens of claims that weren't proven. If you like playing with this and want more to prove than what you can conjecture on your own, it's a treasure.

    Part of what I like about this problem is that one needs very little background material for it.

    I am so grateful to the Kaplans and to the internet for getting me doing math again. It's a joy for me. :^)

  5. pick integer values of u and v, where u > v.

    find the three values
    u^2 + v^2
    u^2 - v^2

    These will be pythagorean triples in some order. Which one is the hypotenuse is trivial.

  6. Hey Sue! Happy new year!

    I loved that problem too this summer. Jesse and I have actually led this problem as a math circle 3 times this fall. (All three times for groups of teachers.)

    The train of thought Bob and Ellen led us on actually proved that all ppt's have the form Vlorbik and Curmudgeon described. I remember you contributing a key insight this summer when we did the problem with the Kaplans.


    We had shown early on that in a ppt, not only do the three a,b,c lack a common factor but each pair (for example a,c) also has no common factor. We had also already shown as a group that c has to be odd and that one of a,b was even. We agreed to call the even one b (some of us were a little sad to give up our attachment to the convention that a was the smallest, but bigger things were afoot...) - then we wrote:

    b^2 = c^2 - a^2
    b^2 = (c+a)(c-a)

    Bob asked us if c+a and c-a had any common factors. We all agreed 2 was a common factor because a and c are both odd so c+a and c-a are both even. Then Bob said, "the next insight - which I have never figured out how to motivate - is that this is their only common factor." (Jesse and I have experimented with trying to get people to come to this on their own by asking questions like "how far apart are c-a and c+a? does this tell you anything about their common factors?" This has been the hardest step for every single group we've done it with.)

    With Bob & Ellen, the proof that a-c and a+c only have 2 as a common factor was done by first dividing out the 2 from both factors of each side:

    (b/2)^2 = [(c+a)/2][(c-a)/2]

    (b is even, and a-c and a+c are both even, so everything is still an integer). Then we noted that the sum of the two factors on the right is c while the difference is a. Thus if (c+a)/2 and (c-a)/2 had a common factor, it would also be a common factor of c and a; but we had decided early on that they don't have any. So neither do (c+a)/2 and (c-a)/2.

    At this point I distinctly remember you, Sue Vanhattum, getting very excited and saying something to the mathematical effect of, "But wait... the left side (b/2)^2 is a square! If you look at its prime factorization, all the factors will come in pairs. But the two factors on the right side, (c+a)/2 and (c-a)/2, don't have any common factors! This means that they can't each contribute one half of a pair of identical factors, because then they would have a common factor. But this means that each of their factorizations is also composed of complete pairs, which means they are both square!"

    Bob put your insight into algebraic language: (c+a)/2 = u^2; (c-a)/2 = v^2.

    The rest was just playing out the consequences:

    a = (c+a)/2 - (c-a)/2 = u^2 - v^2
    c = (c+a)/2 + (c-a)/2 = u^2 + v^2


    (b/2)^2=[(c+a)/2][(c-a)/2] = u^2*v^2


    b/2 = uv, i.e.

    b = 2uv

    and the ppt turned out to be exactly what vlorbik and curmudgeon said.

    (At this point this summer we had shown that all ppts have this form; we didn't show that anything with this form is a ppt. Vlorbik's calculation shows it is a pt for sure. Some slight additional conditions, which Vlorbik mentions, need to be put on u and v to guarantee that u^2-v^2, 2uv, u^2+v^2 is primitive. I had fun convincing myself that these conditions are necessary and sufficient.)

    Btw, if you're interested in a hint in showing that one of the three members is divisible by 5, then here is one:

    Consider u's and v's remainders when divided by 5; then, what are the possible remainders of u^2 and v^2 when divided by 5?

  7. I think I remember the excitement part, but the rest is definitely gone. ;^) I'll have to print out what you wrote so I can think about it properly. And I better print out the rest while I'm at it...

    (My son has a friend over and they're playing chess, so maybe it's the perfect time to do a math problem. But the way they play chess is not quite civilized - I might have to intervene at any moment. I'm not sure how many rules they know yet...)

  8. Hi Sue,

    I have developed a theorem that is based on a matrix of indeces (i,j) where i and j are natural numbers and i is odd and j is even. For every pair of indeces (i,j) where i and j are relatively prime, a unique pythagorean triangle is described. If you are interested further, you can e-mail me at


    Martin Bredenkamp

  9. Peter L. GriffithsJuly 19, 2012 at 7:52 AM

    The best way to identify Pythagorean Triples is to express the equation as (p+q)^2-(p-q)^2, so that the Pythagorean Triple arises when pq has an integer square root.

  10. Why 'best', Peter? (I see how it works, but the way I analyzed it, I didn't use extra variables. I like my way, and so I'm curious about the benefits of other methods.)

  11. Peter L. GriffithsAugust 6, 2012 at 9:35 AM

    I refer to Sue Van Hattum's comment of 19 July 2012. My variables of p and q are not really extra they are a different way of expressing the usual variables of a and b, and can be applied in the following proof of Fermat's Last Theorem. With p, q, x and n all assumed to be positive integers, and x less than or equal to n, each term of the binomial expansion series of (p+q)^n-(p-q)^n contains p^x.q^(n-x), so that if p equals q, then p^n equalling q^n becomes the common factor of all the terms in the binomial expansion series. The consequence is that the other factors in the terms all add up to 2^n, for example 6p^2.q^1 +2q^3 equals 2^3.p^3 equalling 2^3.q^3. This cannot happen without p equalling q except when n equals 2, and there is consequently only one term 2^2.pq, with both p and q unequal but having integer square roots, this is the Pythagorean Triple. However if unequal p and q do not have integer square roots then the power n equalling 2 is treated the same way as n being greater than 2, that is (p+q)^n -(p-q)^n cannot have an integer nth root unless p equals q, that is Fermat's Last Theorem. You have to know the binomial formula to follow this.

  12. If I ever get back to playing with Pythagorean Triples more, this looks like a cool way to play with it:

    But this method produces the answers first, before we know why.

  13. I never did write out my way of doing it. Partly because I wanted people to think it through. But the conventional procedure is everywhere. Hmm... New post?


Math Blog Directory