How is the Pythagorean triple ternary tree constructed? I don't understand the structure of the ternary tree of Pythagorean triples. I can see that each triple to the left is linked to larger triples on the right but I can see no pattern in how the triples to the right are selected, except that they are larger.
The  wiki article and others show something about three matrices but I don't know enough to understand the processes described. I have a formula that generates all primitives but which includes the occasional non-primitive. All primitives have an odd square for the difference $C-B$ but there are non-primitives like $(27,36,45)$ that share this property so my formula generates this also.
How does the tree determine "children" and avoid such as the non-primitive above? Once that is determined, how can we know that all primitives are generated?
 A: The matrices mean if you have a triple $(a,b,c)$ then you have child triples:
$$\begin{align}v_1(a,b,c)&=(a-2b+2c,2a-b+2c,2a-2b+3c),\\
v_2(a,b,c)&=(a+2b+2c,2a+b+2c,2a+2b+3c),\\
v_{3}(a,b,c)&=(-a+2b+2c,-2a+b+2c,-2a+2b+3c)\end{align}$$
To prove you only get primitives, you need to show that if $a,b$ are relatively prime and not both odd, then each of these three triples has the same property.
To prove every triple with occurs at most once, show that when $c>5,$ $(a,b,c)=v_i(a_1,b_1,c_1)$ and $(a,b,c)=v_j(a_2,b_2,c_2)$ then $i=j, a_1=a_2,b_1=b_2, c_1=c_2.$ This is, again, easier with matrices, but not impossible.
It is easier to prove that with an understanding of matrices, but it is not necessary.
The first pattern I see is that if $p(a,b,c)=(b,a,c)$ then $p(v_1(p(a,b,c)))= v_3(a,b,c),$ and visa versa, $p\circ v_3\circ p=v_1.$
Also $p\circ v_2\circ p=v_2.$
You also have $$v_1(a,b,c)=v_2(a,-b,c)\\
v_3(a,b,c)=v_{2}(-a,b,c)$$

It might be easier to see what is going on with the classical way of representing triples.
If $(a,b,c)=(u^2-v^2,2uv,u^2+v^2)$ with $u>v$ relatively prime and not both odd, then $$v_1(a,b,c)=(3u^2-4uv+v^2,4u^2-2uv,5u^2-4uv+v^2)\\=(u_1^2-v_1^2,2u_1v_1,u_1^2+v_1^2)$$
where $(u_1,v_1)=(2u-v,u).$
So $v_1$ corresponds to $(u,v)\mapsto (2u-v,u).$
Similarly $$v_2(a,b,c)=(u_2^2-v_2^2,2u_2v_2,u_2^2+v_2^2)$$ where $(u_2,v_2)=(2u+v,u).$
Finally $$v_3(a,b,c)= (u_3^2-v_3^2,2u_3v_3,u_3^2+v_3^2)$$
with $(u_3,v_3)=(2v+u,v).$
So these are the $(u,v)$ transformations:
$$v_1:(u,v)\mapsto (2u-v,u)\\v_2:(u,v)\mapsto (2u+v,u)\\v_3:(u,v)\mapsto (2v+u,v)$$
This is much easier than the $(a,b,c)$ version.
Then give relatively prime and not both odd $u>v>0$ with $u>2,$ then:

*

*If $u>3v$ then $(u,v)=v_3(u-2v,v)$ and $u-2v>v>0$ and $u-2v,v$ are relatively prime and both odd.


*If $3v>u>2v$ then $(u,v)=v_2(v,u-2v)$ and $v>u-2v>0$ are relatively prime and not both odd


*If $2v>u$ then $(u,v)=v_1(v,2v-u),$ and $v>2v-u>0$ are relatively prime and not all odd.
Note, we can't have $u=3v$ or $u=2v$ because then the only way that they are relatively prime is when $v=1,$ but then either $u=2,v=1$ violates our assumption that $u>2.$ And the case $u=3,v=1$ they are both odd.
So every $u>v>0$ relatively prime and not both odd, other than $(2,1),$ is the image of exactly one of the $v_1,v_2,v_3.$ Show this means there is one "path" from $(u,v)=(2,1)$ to any such such triple.
