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

### Pythagorean Triples

```
Date: 05/22/99 at 06:04:39
From: Charlie Smith
Subject: The general formula for pythagorean triples

Hi,

I am British and I have been doing some gcse coursework. The project
is called "Beyond Pythagoras". I have already found the formula for
the shortest, middle, and longest sides of both odd and even triples.
I have also found the formulas for the area and perimeter of both the
odds and evens, but I am stuck on trying to get the general formula
for all sides of any triple.
```

```
Date: 05/22/99 at 08:10:07
From: Doctor Jerry
Subject: Re: The general formula for pythagorean triples

Hi Charlie,

The following result may be what you're looking for.  G. L. Hardy was
also British. I don't know about Wright.

Pythagorean triples can be generated using the following theorem,
taken from Hardy and Wright's _The Theory of Numbers_.

The most general solution of the equation

x^2+y^2 = z^2

satisfying the conditions

x > 0, y > 0, z > 0
x and y have no common factors
x is divisible by 2

is

x = 2a*b   y = a^2-b^2   z = a^2+b^2

where a and b are integers, one even and the other odd, with no common
factors, and  a > b > 0. There is a 1-1 correspondence between
different values of a and b and different values of x,y,z.

- Doctor Jerry, The Math Forum
http://mathforum.org/dr.math/
```

```
Date: 05/24/99 at 08:22:16
From: guy joseph
Subject: Pythagorean triples

Please could you send me the general formula for all Pythagorean
triples, and if possible an explanation, some examples and a proof?

```

```
Date: 05/24/99 at 14:32:00
From: Doctor Anthony
Subject: Re: Pythagorean triples

Pythagorean Triplets
--------------------
We wish to satisfy the Diophantine equation

x^2 + y^2 = z^2

If we let  x = a^2 - b^2

y = 2ab

z = a^2 + b^2

Then x^2 = a^4 - 2a^2.b^2 + b^4      y^2 = 4a^2.b^2

x^2 + y^2 =  a^4 + 2a^2.b^2 + b^4

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

=  z^2

Thus choosing any pair (a,b) we generate a Pythagorean triplet.

However, always choose these such that a > b.

Example (2,1) gives  x = 4 - 1 = 3
y = 2x2x1 = 4
z = 4 + 1 = 5

Example (3,2) gives  x = 9 - 4 = 5
y = 2x3x2 = 12
z = 9 + 4 = 13

Example (3,1) gives  x = 9 - 1 = 8
y = 2x3x1 = 6
z = 9 + 1 = 10

- Doctor Anthony, 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