# 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?

• The matrices are used to generate the children. If $v=(a,b,c)^T$ is a node, then its children are $Av, Bv$, and $Cv$, where $A, B,$ and $C$ are the matrices listed on the page. Jul 18, 2021 at 19:04
• @Aaron I do not understand matrices except as representative of a group of equations and how they may be used to "solve" equations by such as adding rows or using Cramer's Rule. So, I do not understand your comment. Jul 18, 2021 at 19:08
• The matrices mean if you have a triple $(a,b,c)$ then you have child triples: $$(a-2b+2c,2a-b+2c,2a-2b+3c),\\ (a+2b+2c,2a+b+2c,2a+2b+3c),\\ (-a+2b+2c,-2a+b+2c,-2a+2b+3c)$$ Jul 18, 2021 at 19:13
• -1 The introduction to the wikipedia page you link explicitly mentions that child triples are obtained from parent triples by matrix multiplication. And yet it seems you haven't bothered to find out what that means before posting your question here. Aug 21, 2021 at 14:59
• I’m voting to close this question because it shows no effort whatsoever. Aug 21, 2021 at 15:00

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:

1. 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.

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

3. 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.

• The first 4 lines explained how the tree is built. I did not understand the rest except the part that triples are generated only once. No proof needed. but that's OK. Now Im just wondering how the likes of $(27,36,45)$ are avoided and how we can know that all primitives are generated. Jul 18, 2021 at 22:36
• You need to show if $(a,b,c)$ is primitive, then the $v_i(a,b,c)$ are primitive. Approach: Assume $v_1$ is not primitive. Then for some prime, $p$ divides each of $a-2b+2c, 2a-b+2c,$ and $2a-2b+3c.$ Deduce that $p$ must divide each of $a,b,c.$ Jul 18, 2021 at 22:46
• Sorry, until you understand matrices, it is going to be too much work to show you how this yields all triples. It is possible to write it out, but it might be pages and pages. But the key is an argument by “decent.” If $(a,b,c)$ is a primitive triple with $a$ even and $c>5,$ then there is a primitive triple $(a’,b’,c’)$ with $a’$ even and $c’<c$ and $(a,b,c)=v_i(a’,b’,c’)$ for some $i=1,2,3.$ Jul 18, 2021 at 22:54
• I got what I really needed the construction of the tree. Thanks Jul 18, 2021 at 23:34