Euclid's formula for Pythagorean triples (source code)

= Euclid's formula for Pythagorean triples
{c}

= Euclid's formula
{c}
{synonym}

= Euclid's parametrization
{c}
{synonym}

The formulas $a=m^2-n^2$, $b=2mn$, $c=m^2+n^2$ give a <Pythagorean triple> for <integers> $m>n>0$, because $(m^2-n^2)^2+(2mn)^2=(m^2+n^2)^2$. They give a <primitive Pythagorean triple> exactly when $m,n$ are <coprime> and have opposite <integer parity>. Every <primitive Pythagorean triple> arises this way after possibly exchanging the legs; scaling gives the nonprimitive triples.