derivation of Pythagorean triples

For finding all positive solutions of the Diophantine equationMathworldPlanetmath

x2+y2=z2 (1)

we first can determine such triples  x,y,z  which are coprimeMathworldPlanetmath.  When these are then multiplied by all positive integers, one obtains all positive solutions.

Let  (x,y,z)  be a solution of the mentioned kind.  Then the numbers are pairwise coprime, since by (1), a common divisorMathworldPlanetmathPlanetmath of two of them is also a common divisor of the third.  Especially, x and y cannot both be even.  Neither can they both be odd, since because the square of any odd numberMathworldPlanetmathPlanetmath is  1(mod4), the equation (1) would imply an impossible congruenceMathworldPlanetmathPlanetmathPlanetmath2z2(mod4).  Accordingly, one of the numbers, e.g. x, is even and the other, y, odd.

Write (1) to the form

x2=(z+y)(z-y). (2)

Now, both factors ( on the right hand side are even, whence one may denote

z+y=: 2u,z-y=: 2v (3)


z=u+v,y=u-v, (4)

and thus (2) reads

x2= 4uv. (5)

Because z and y are coprime and  z>y>0,  one can infer from (4) and (3) that also u and v must be coprime and  u>v>0.  Therefore, it follows from (5) that


where m and n are coprime and  m>n>0.  Thus, (5) and (4) yield

x= 2mn,y=m2-n2,z=m2+n2. (6)

Here, one of m and n is odd and the other even, since y is odd.

By substituting the expressions (6) to the equation (1), one sees that it is satisfied by arbitrary values of m and n.  If m and n have all the properties stated above, then x,y,z are positive integers and, as one may deduce from two first of the equations (6), the numbers x and y and thus all three numbers are coprime.

Thus one has proved the

TheoremMathworldPlanetmath.  All coprime positive solutions  x,y,z,  and only them, are gotten when one substitutes for m and n to the formulae (6) all possible coprime value pairs, from which always one is odd and the other even and  m>n.


  • 1 K. Väisälä: Lukuteorian ja korkeamman algebran alkeet.  Tiedekirjasto No. 17. Kustannusosakeyhtiö Otava, Helsinki (1950).
Title derivation of Pythagorean triples
Canonical name DerivationOfPythagoreanTriples
Date of creation 2013-03-22 18:34:40
Last modified on 2013-03-22 18:34:40
Owner pahio (2872)
Last modified by pahio (2872)
Numerical id 8
Author pahio (2872)
Entry type Derivation
Classification msc 11D09
Classification msc 11A05
Related topic LinearFormulasForPythagoreanTriples
Related topic ContraharmonicMeansAndPythagoreanHypotenuses