# Characterising all integer solutions of $m_1^2 + m_2^2 + m_3^2 - m_1 m_2 - m_2 m_3 - m_3 m_1 = n^2$

Let us say that polynomial $P(x)$ is "friendly" if it is an integer constant, or if it has all distinct integer roots and its derivative is friendly.

While fooling around with "friendly" polynomials I found it would be useful to characterize all integer solutions to

$$m_1^2 + m_2^2 + m_3^2 - m_1 m_2 - m_2 m_3 - m_3 m_1 = n^2$$

There are people out there who are better in number theory problems of this sort than I am, so I am asking for help.

What I have tried: I have tried the equation in various small-integer moduli, to see if one of them would provide a constraint on the forms of the $m_i$ and $n$. But I got no real progress there.

HINT:

The equation is equivalent to $$(m_1 -m_3)^2 + (m_2 - m_3)^2 - (m_1 - m_3)(m_2 - m_3) = n^2$$

Substitute and get the equivalent equation $$a^2 + b^2 - a b = n^2$$

It it simpler ( and more or less equivalent) to search for rational solutions of the equation $$x^2 + y^2 -x y = 1$$

We have a particular solution $(x,y) = (-1,-1)$. To get a general solution in rationals, use the substitution $y+1 = t(x+1)$, plug into the equation and solve for $x$, $y$ in terms of $t$. We get $$x = \frac{2 t - t^2}{t^2 -t + 1} \\ y = \frac{2 t-1}{t^2 -t+ 1}$$

This gives all the rational solutions of the equation. From here we conclude that the primitive solutions of the equation $a^2 - a b + b^2 = n^2$ must be of form $$a = 2 p q - p^2\\ b= 2 p q - q^2 \\ n= p^2 - p q + q^2$$ where $p$, $q$ relatively prime integers.

• In this case, yes. One of the easiest examples where stereographic projection does not show all primitive integer solutions is $x^2 + 6 y^2 = z^2.$ For this example, you need to add just one extra parametrization of the same general type as your $(a,b,n)$ above. – Will Jagy Sep 14 '17 at 19:47
• First $x = 6 p^2 - q^2,$ $y = 2pq,$ $z = 6 p^2 + q^2$ comes from projection. But then we need $x = 3 p^2 - 2 q^2,$ $y = 2 p q,$ $z = 3 p^2 + 2 q^2$ – Will Jagy Sep 14 '17 at 19:51
• @Will Jagy: Thank you for the input. Are you saying the above parametrization misses some solution? I haven't check carefully the details, so it's possible. – Orest Bucicovschi Sep 14 '17 at 19:53
• @Will Jagy: That is a good point. I more or less brushed over the "passing between rational and integer solution" step, one day I have to pay some close attention to it. – Orest Bucicovschi Sep 14 '17 at 19:54
• @Will Jagy: that is very interesting, will try it. – Orest Bucicovschi Sep 14 '17 at 20:03

$$x^2-xy-xz+y^2-zy+z^2=v^2$$

Solution we write.

$$x=a^2-ak+k^2-s^2$$

$$y=a(a+k)+s(2k-s)$$

$$z=a(2a+2s-k)$$

$$v=a^2-ak+k^2+(2a-k)s+s^2$$