Coincidence in Diophantine solution parametrization for Pythagorean triples etc

Consider a triple of nonnegative integers $$(a, b, c)$$ such that $$c^2 = a^2 + b^2$$. This can be viewed as integer triangles with sides $$(a, b, c)$$ such that $$c$$ is the side opposite a $$90°$$ angle. Such triples are well-known as Pythagorean triples, and it is well-known (called Euclid's formula on Wikipedia) that all such primitive (i.e. $$\gcd(a, b, c) = 1$$) triples can be parametrized as:

\begin{align} a &= m^2 - n^2 \cr b &= 2mn \cr c &= m^2 + n^2 \end{align}

I've always found it mildly amusing (and occasionally confusing) that we started trying to find a parametrization for triples where $$c^2$$ was a sum of two squares, and obtained a parametrization where $$c$$ itself is a sum of two squares, i.e. has the same form.

Today I encountered the problem of nonnegative triples $$(a, b, c)$$ such that $$c^2 = a^2 + b^2 + ab$$. This can be viewed as integer triangles with sides $$(a, b, c)$$ such that $$c$$ is the side opposite a $$120°$$ angle. Such triples are called 1-Pythagorean triples on OEIS, Eisenstein triples in this paper, and “Trythagorean” triples in this blog post. Whatever the name, it turns out that all such primitive triples can be parametrized (see this very nice page) as:

\begin{align} a &= n^2 - m^2 \cr b &= m^2 + 2mn \cr c &= m^2 + mn + n^2 \end{align}

where $$m < n$$ such that $$\gcd(m,n)=1$$ and $$m≢n \pmod 3$$.

This is spooky: we looked for triples such that $$c^2$$ was of the form $$a^2 + ab + b^2$$, and it turns out that $$c$$ itself is of a similar form, $$c = m^2 + mn + n^2$$.

Question: Is this just a coincidence? If not, what's going on? What's the most general kind of problem for which this (whatever “this” is) is true?

There's a general method for homogeneous Diophantine equations of degree two, but I haven't yet tried other equations. Also, even when sometimes the form seems different, it is not really, for example, the same page parametrizes solutions to $$c^2 = a^2 + b^2 - ab$$ (corresponding to $$60°$$ angles) as $$c = m^2 + n^2 + mn$$ which would seem to be a counterexample, but replacing either $$m$$ with $$-m$$ or $$n$$ with $$-n$$ gives $$m^2 + n^2 - mn$$ so I'm not sure.

Gauss duplication.

$$A^2 +AB + 41 B^2 = C^2$$ $$A = x^2 - 41 y^2$$ $$B = 2xy + y^2$$ $$C = x^2 + xy + 41 y^2$$

If you have class number bigger than one, more options; we can solve $$A^2 + 6 B^2 = C^2,$$ where $$C = 2x^2 + 3 y^2 \; . \;$$ Or $$A^2 + 5 B^2 = C^2,$$ where $$C = 2 x^2 + 2xy + 3 y^2.$$

• Thanks! The first one is a nice example. Unfortunately, this is a bit like a “zero-knowledge proof” for me: I can tell that you know the answer but I don't seem to have learned anything. :-) Could you explain in more detail, or point to some appropriate resources? – ShreevatsaR Nov 3 '19 at 21:55
• You should be able to find David A. Cox, Primes of the Form $x^2 + n y^2.$ About Dirichlet's description of Gauss composition, there is a typo in the first edition, corrected in the second. In brief, given two primitive binary quadratic forms of the same discriminant, we can multiply the values and represent that product by the composition of the two forms. Your question is when all three forms are the principal form. en.wikipedia.org/wiki/Binary_quadratic_form – Will Jagy Nov 3 '19 at 23:09
• Thanks... I'll try to read up more. From a quick look at Cox's 3.8 what I understand is that if a number $p$ is represented by some primitive binary quadratic form $f$, and the number $q$ by form $g$, then their product $pq$ by the form that is the composition of $f$ and $g$; here in this cases (if I understand correctly) $p=q=c$, and $f = g$, and it so happens that the composition is itself. But that seems to go in one direction; what's not obvious is that, for example every $c$ of the form $a^2 + b^2 + ab$ is the square of a number of the same form (i.e. there's no other way to obtain it). – ShreevatsaR Nov 4 '19 at 5:07
• To put it differently: I think I can believe that if $c$ is always represented by a binary quadratic form then it has to be the same one as for $c^2$ (when the latter cannot be obtained as a composition in any other way), but it's not obvious to me why the generic $c$ has to have that form in the first place. – ShreevatsaR Nov 4 '19 at 18:27
• @ShreevatsaR (I) an exercise I suggested in my answer was $a^2 + 5 b^2 = c^2,$ with $a = 2u^2 + 2uv-2v^2 \; , \;$ $b = 2uv+v^2 \; , \;$ $c = 2u^2 + 2uv+3v^2 \; . \;$ (II) The fact that $a,b,c$ come out as binary forms in the first place goes back to Fricke and Klein (1897). Put briefly, we know all the automorphisms of $y^2 - zx,$ and we find zero vector s of our form with Hessian G by solving $P^T G P = n H,$ where $H$ is the Hessian of $y^2 - zx.$ See math.stackexchange.com/questions/1972120/… – Will Jagy Nov 4 '19 at 19:13

The example I like to show is solving $$2(x^2 + y^2 + z^2) - 113(yz + zx + xy)=0,$$ four "recipes," all made up of binary quadratic forms $$\left( \begin{array}{r} x \\ y \\ z \end{array} \right) = \left( \begin{array}{r} 37 u^2 + 51 uv + 8 v^2 \\ 8 u^2 -35 uv -6 v^2 \\ -6 u^2 + 23 uv + 37 v^2 \end{array} \right)$$

$$\left( \begin{array}{r} x \\ y \\ z \end{array} \right) = \left( \begin{array}{r} 32 u^2 + 61 uv + 18 v^2 \\ 18 u^2 -25 uv -11 v^2 \\ -11 u^2 + 3 uv + 32 v^2 \end{array} \right)$$

$$\left( \begin{array}{r} x \\ y \\ z \end{array} \right) = \left( \begin{array}{r} 38 u^2 + 45 uv + 4 v^2 \\ 4 u^2 -37 uv -3 v^2 \\ -3 u^2 + 31 uv + 38 v^2 \end{array} \right)$$

$$\left( \begin{array}{r} x \\ y \\ z \end{array} \right) = \left( \begin{array}{r} 29 u^2 + 63 uv + 22 v^2 \\ 22 u^2 -19 uv -12 v^2 \\ -12 u^2 -5 uv + 29 v^2 \end{array} \right)$$

For all four recipes, $$x^2 + y^2 + z^2 = 1469 \left( u^2 + uv + v^2 \right)^2$$ giving effective bounds on $$u,v$$ if given upper bound on $$x^2 + y^2 + z^2$$