# Solve Diophantine equation with three variables

I am trying to generate all primitive solutions less than a certain limit for the following Diophantine equation. $$x^2−y^2−z^2−xy−yz−zx=0$$ Using brute force, it seems that $$x$$ always takes the form $$a^2+ab+b^2$$ with $$(a,b)=1$$, $$y$$ and $$z$$ take the form $$a^2-ab+b^2$$ with $$(a,b)=1$$.

So far I have been unable to find a concrete parametric solutions. Any help will be much appreciated.

Edit: I was not far from solution. All primitive triples can be generated by $$(a^2+ab+b^2,a^2+ab-b^2,b^2+ab-a^2)$$ with $$a>b$$ and $$(a,b)=1$$.

$$x^2-x(y+z)−y^2−z^2−yz=0\hspace{1cm} /\cdot 4$$

$$4x^2-4x(y+z)−4y^2−4z^2−4yz=0$$

$$\underbrace{4x^2-4x(y+z)+\color{red}{(y+z)^2}}-\color{red}{(y+z)^2}−4y^2−4z^2−4yz=0$$

$$(2x-y-z)^2−5y^2−5z^2−6yz=0\hspace{1cm} /\cdot 5$$

$$5(2x-y-z)^2− \underbrace{ 25y^2−30yz \color{red}{-9z^2}}+\color{red}{9z^2}−25z^2=0$$

$$5(2x-y-z)^2−(5y+3z)^2−16z^2=0$$

So, if $$a=2x-y-z$$ and $$b=5y+3z$$ and $$c=4z$$ then you have to solve this Pell-s equation: $$5a^2=b^2+c^2$$

• Wow. Awesome solution @Aqua Sep 2, 2019 at 8:33

This is the homogeneous equation of a projective conic. The standard recipe for a rational parametrization of such curves is to

1. Find at least one rational point on the curve (by, e.g., using linear coordinate transformations to reduce it to the Legendre form $$A X^2 + BY^2 + C Z^2 =0$$ and using the Hasse local-global principle), then
2. using stereographic projection from that point to produce the parametrization.

In the present case we can see that $$[x : y : z]=[1 : -1 : 1]$$ is a solution; stereographic projection onto $$y=0$$, say, gives $$[x : y : z] = [ a^2-ab+b^2 : b^2 - ab - a^2 : a^2 - ab - b^2 ]\text{.}$$

Edit: it should be noted that parametrizing projective conics is routine enough to be relegated to a computer algebra system. For example, in Magma the input

k := Rationals();
P2<x,y,z> := ProjectiveSpace(k, 2);
f := x^2 - y^2 - z^2 - x*y - x*z - y*z;
C := Conic(P2, f);
P1<t,u> := ProjectiveSpace(k, 1);
Parametrization(C, Curve(P1));


gives

Mapping from: Curve over Rational Field defined by
0 to CrvCon: C
with equations :
t^2 + t*u + u^2
-t^2 + t*u + u^2
-t^2 - 3*t*u - u^2
and inverse
2*x - 2*y
-2*x - 2*z
and alternative inverse equations :
-2*x - 2*z
4*x + 2*y + 2*z


i.e.,

\begin{align} [ x : y : z] &= [ t^2 + tu + u^2 : -t^2 + tu + u^2 : -t^2 - 3tu - u^2 ] \\ [t : u ] &= [ 2x - 2y : -2x - 2z ] \end{align}