A Pythagorean triple consists of three positive integers satisfying . It is primitive when their greatest common divisor is one. Reducing their square numbers modulo shows that at least one leg is divisible by ; reducing modulo shows that both legs cannot be odd.
The Berggren tree is a rooted tree of primitive Pythagorean triples, with three children at every node. Fix the convention odd, even and . Starting from the column vector , multiply by any ofThe first children are , and . These unimodular matrices preserve the quadratic form , integer parity and greatest common divisor. Every primitive Pythagorean triple occurs exactly once. F. J. M. Barning's report gives this matrix-generation theorem with the even leg first.[ref]
An infinite descent argument explains completeness. Except at the root, the unique parent isIts hypotenuse is positive and smaller than , since . The first two unmodified entries cannot both be negative; their signs select the inverse of , or . The odd entry cannot vanish; the even entry vanishes only at . Repeated descent therefore reaches that root. Multiplying all three coordinates by a positive integer supplies every nonprimitive Pythagorean triple.
A Pythagorean triple whose coordinates have greatest common divisor 1. Its two legs have opposite integer parity, and every Pythagorean triple is a unique positive integer multiple of a primitive Pythagorean triple up to the ordering of its legs.
The formulas , , give a Pythagorean triple for integers , because . They give a primitive Pythagorean triple exactly when are coprime and have opposite integer parity. Every primitive Pythagorean triple arises this way after possibly exchanging the legs; scaling gives the nonprimitive triples.
Every primitive Pythagorean triple, after exchanging its legs, has this form with , and opposite parity. Its area is . The factors are pairwise coprime, because are odd. Conversely these conditions give a primitive triple. The parametrization follows by factoring the relatively prime integers and when is the even leg.
