Pythagorean Triples Recursion I know that all the primitive Pythagorean triples can be generated from the $(3,4,5)$ triangle by using the three linear transformations $T1$, $T2$, $T3$ below:
$T1$ : $(a−2b+2c,2a−b+2c,2a−2b+3c)$
$T2$ : $(a+2b+2c,2a+b+2c,2a+2b+3c)$
$T3$ : $(−a+2b+2c,−2a+b+2c,−2a+2b+3c)$
But how can I derive these formulae? I searched, but could not find anything useful. Any help will be appreciated.
 A: The transforms $T_1$ and $T_3$ amount to changing sign on $x$ or $y$ as compared to transform $T_2$. All three preserve Pythagorean triples (in fact they preserve the value of $x^2+y^2-z^2$ even when the latter is not zero). 
To see they generate, then it is enough to check that the inverse of $T_2,$ when applied to any primitive triple with nonzero $x,y,z,$ keeps the $z$ coordinate positive, and strictly lowers it. Under that inverse, the altered $z$ is
$$z'=3z-2y-2x.$$ Now if the triple is $(x,y,z)=(m^2-n^2,2mn,m^2+n^2)$ then we get under the inverse of $T_2$ that the difference $z-z'$ is  $4n(m-n)>0,$ the latter since $m>n$ in our parametrization of the triples. So the $z$ indeed gets lowered. We also need that it remains positive, and we have in fact $z'=m^2-4mn+5n^2.$ The latter is positive for nonzero $m,n$ (it is $(m-2n)^2+n^2).$)
There is one more thing to check, namely that once a given triple is inverted by $T_2$ it is either already all positive $x,y,z$ or else at most one of $x,y$ has a sign change. This isn't hard to show by again looking at the inverses of the other two matrices.
