Drexel dragonThe Math ForumDonate to the Math Forum

Ask Dr. Math - Questions and Answers from our Archives
_____________________________________________
Associated Topics || Dr. Math Home || Search Dr. Math
_____________________________________________

Pythagorean Triples


Date: 11/18/97 at 09:36:19
From: John
Subject: Pythagorean Triples

Could you explain how pythagorean triples work, are calculated, etc.?


Date: 11/18/97 at 13:51:39
From: Doctor Rob
Subject: Re: Pythagorean Triples

Sure.

We start with the Pythagorean equation  a^2 + b^2 = c^2.  We want only
integer values for a, b, and c.

First we observe that solutions with negative or zero values of a, b, 
or c are excluded by geometrical considerations.

Next we observe that if any pair of the three numbers a, b, and c have 
a common factor, then all three will share it.  

Let d = GCD(a,b,c). Then a = d*A, b = d*B, c = d*C, and then 
d^2*A^2 + d^2*B^2 = d^2*C^2, so A^2 + B^2 = C^2.  Furthermore 
GCD(A,B,C) = GCD(a,b,c)/d = 1.  

Triples with GCD(a,b,c) = 1 are called "primitive," and we will 
restrict our attention to them, remembering that we can always 
multiply a primitive solution by any positive integer d to get more 
solutions.

Now a and b cannot both be even, by the previous paragraph. Neither 
can they both be odd, because then their squares would leave remainder 
of 1 when divided by 4, so the sum of their squares would leave 
remainder of 2 when divided by 4. This would imply that c is even, 
so c^2 is divisible by 4. This is a contradiction.  c^2 cannot leave 
remainders of both 0 and 2 when divided by 4. Thus not both of a and b 
are odd. Let us assume that it is b which is even.  (If not, swap a 
and b in the following argument.) Then c must also be odd.

Then

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

Now let the greatest common divisor of (c-a)/2 and (c+a)/2 be g.  
Then g divides their sum and their difference, so g divides both c 
and a. Of course the greatest common divisor of c and a is 1, so 
g = 1. This tells us that (c-a)/2 and (c+a)/2 are two integers with 
no common factor whose product is a square. The only way that this 
can happen is if both are themselves squares. Set (c+a)/2 = r^2 and 
(c-a)/2 = s^2 for some positive integers r and s. Then GCD(r,s) = 1, 
by the first part of this paragraph, r > s > 0, and one is even and 
one is odd, since c = r^2 + s^2 and c is odd.  Then a = r^2 - s^2, 
and b = 2*r*s.

Conversely, if r and s are any two integers with 
GCD(r,s) = 1, r > s > 0, and of opposity parity, then 
a = r^2 - s^2, b = 2*r*s, and c = r^2 + s^2 are a primitive solution 
of the Pythagorean equation, GCD(a,b) = 1, and b is even.

This shows that every primitive Pythagorean triple with b even has the 
form

   a = r^2 - s^2,
   b = 2*r*s,
   c = r^2 + s^2,

for some pair of integers r and s of opposite parity with GCD(r,s) = 1
and r > s > 0.  Thus every Pythagorean triple with b even has the form

   a = (r^2 - s^2)*d,
   b = 2*r*s*d,
   c = (r^2 + s^2)*d,

where r and s are as above and d is any positive integer.

Examples:

   r = 2, s = 1, (a,b,c) = (3,4,5).
   r = 3, s = 2, (a,b,c) = (5,12,13).
   r = 4, s = 1, (a,b,c) = (15,8,17).
   r = 4, s = 3, (a,b,c) = (7,24,25).
   r = 5, s = 2, (a,b,c) = (21,20,29).
   r = 5, s = 4, (a,b,c) = (9,40,41).
   r = 99, s = 62, (a,b,c) = (5957,12276,13645).

If you need more help understanding this, write again.

-Doctor Rob,  The Math Forum
 Check out our web site!  http://mathforum.org/dr.math/   


Here's a suggestion from one of our readers:

Leonard Campbell
usic309@unlvm.unl.edu

I like your pages. This is not a question but something I didn't find on 
your pages. When I was a senior in high school (in 72) I gave a paper on 
Pythagorean Triples. I had worked out the formula myself and it matches 
the formula you have on your pages. (I was only interested in relatively 
prime triples).

The formula was:

  x = 2ab

  y = a^2 - b^2

  z = a^2 + b^2

where a > b, a and b are not both odd, and a and b are relatively prime. 

One observation I had was that one of the three numbers in the triple was
always a multiple of 4, one a multiple of 3, and one a multiple of 5. (At
the time I never proved it). It is easy enough to prove, though, and here 
is the proof: 
_____

  x = 2ab is divisible by 4.

a and b can be either both even, or one even and the other odd. (If they
are both odd it would contradict one of our original assumptions.) In any
case, one of them must be even. Say that a is even. Then a = 2n for some
integer n, and
   
  x = 2ab = 2(2n)b = 4nb is divisible by 4.

The same holds true if b is even.
_____

One number is always divisible by 3.

Any integer n can be written in the form:

  n = p(mod3)

Saying that n = p(mod3) means that the remainder you get when you 
divide n by 3 is p.  For example, 8 = 2(mod3) because when you divide 8 
by 3, you get a remainder of 2.

Every integer is either 0, 1, or 2 (mod3).  

If n = 0, n^2 = 0(mod3) * 0(mod3) = 0(mod3)
If n = 1, n^2 = 1(mod3) * 1(mod3) = 1(mod3)
If n = 2, n^2 = 2(mod3) * 2(mod3) = 1(mod3)

So every integer squared is either 0 or 1 (mod3).

If any of x, y, or z equals 0(mod3), we are done, for then they will be 
divisible by 3. Assume that none of them do. We know that:

  x^2 + y^2 = z^2

and since x and y are equal to 1(mod3) or 2(mod3),
  
  z^2 = 1(mod3) + 1(mod3) = 2(mod3)

But this means that z must be divisible by 3. Therefore one of the three 
must be divisible by 3.
_____

One number is a multiple of 5

Again the same type of argument holds. Consider what happens when we 
square integers in mod5.  Say that m = q(mod5).  Then

If q = 0, m^2 = 0(mod5)
If q = 1, m^2 = 1(mod5)
If q = 2, m^2 = 4(mod5)
If q = 3, m^2 = 4(mod5)
If q = 4, m^2 = 1(mod5)

So every integer is either 0, 1, or 4 (mod5).

Again consider our numbers x, y, and z. If any of them are divisible by 
5, then we are done. Assume that none of them is divisible by 5. The 
equation x^2 + y^2 = z^2 tells us that z^2 is either 0 (1+4), 2 (1+1), or 
3 (4+4) (mod5).  Since an integer squared can never be 2 or 3 (mod5) z^2 
must be 0(mod5), meaning that z is divisible by 5.

This contradicts our original assumption, so one of the three numbers must 
be divisible by 5. 
_____

I hope this is a helpful addition to your pages.
- Leonard Campbell
    
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

[Privacy Policy] [Terms of Use]

_____________________________________
Math Forum Home || Math Library || Quick Reference || Math Forum Search
_____________________________________

Ask Dr. MathTM
© 1994-2013 The Math Forum
http://mathforum.org/dr.math/