All pythagorean triples can be generated from $(3,4,5)^T$ and $(5,4,3)^T$ by the matrices: \\[ A = \left(\begin{array}{ccc} -1 & 2 & 2 \\\\ -2 & 1 & 2 \\\\-2 & 2 & 3 \end{array} \right) \hspace{0.25in} B = \left(\begin{array}{ccc} 1 & 2 & 2 \\\\ 2 & 1 & 2 \\\\2 & 2 & 3 \end{array} \right) \hspace{0.25in} C = \left(\begin{array}{ccc} 1 & -2 & 2 \\\\ 2 & -1 & 2 \\\\2 & -2 & 3 \end{array} \right) \\] Giving pythagorean triples the structure of a ternary tree. I remember seeing there being 5 generators for the equation $x^2 + xy + y^2 = z^2$. Does anyone have the reference?