# Solving a Diophantine equation of the form $x^2 = ay^2 + byz + cz^2$ with the constants $a, b, c$ given and $x,y,z$ positive integers

Is there any procedure for determining if an infinite amount of solutions exist for an equation of the type $x^2 = ay^2 + byz + cz^2$ for arbitrary integer constants $a, b, c$ and variables $x, y, z \in \mathbb{Z_+}$? If not, does knowing at least one non-trivial solution of the equation help determine if an infinite amount of solutions exist?

Example (if it helps): let $x^2 = 202 y^2+14yz+9z^2$. Here one solution is $y=z=1$ and $x=15$, do there exist infinitely many other solutions?

• Multiply your solution by any integer, and you'll get another solution. – Ivan Neretin Nov 5 '15 at 0:23
• @IvanNeretin: Thanks, this appears to be true, but why? – Sid Nov 5 '15 at 0:29
• Let $f(y,z) = 202y^2 + 14yz + 9z^2$. For any $p > q > 0$, we have $$(135p^2+96pq+135q^2)^2 = f(9(p^2-q^2),9p^2+90pq+23q^2)$$ This generate infinitely many solutions to the equation $x^2 = f(y,z)$. This is generated by your particular solution $(x,y,z) = (15,1,1)$ by looking at rational solutions of equations of the form $1 = f(\frac{1}{15} + t,\frac{1}{15} + st)$ with rational $s$ and then solve for $t$. – achille hui Nov 5 '15 at 1:39
• @Sid: For your example (and others), yes, we can show there are not only infinitely many rational solutions, but there infinitely many positive integer ones. See answer below. – Tito Piezas III Nov 5 '15 at 2:03

TLDR; If there exists one nonzero solution, then there exist infinitely many solutions, paramatrized by $\Bbb{Z}^2$. Popular candidates to test are triplets $(0,y,z)$ where $y\mid c$ and $z\mid a$, though such solutions need not exist.

Every integral solution to your equation with $x\neq0$ yields a rational solution to $$aY^2+bYZ+cZ^2=1,$$ by setting $Y:=\tfrac yx$ and $Z:=\tfrac zx$. Conversely, every rational solution to this equation yields an integral solution to your equation by multiplying out the denominators. This also shows that multiplying an integral solution through by an integer yields another integral solution.

Given a nonzero rational solution $(Y_0,Z_0)$ to your equation, also $$(aY_0+bZ_0,-aZ_0),$$ is a rational solution, and moreover for every $k\in\Bbb{Z}$ also $$\left((aY_0+bZ_0)k^2+2cZ_0k-cY_0,-aZ_0k^2+2cY_0k+bY_0+cZ_0\right),$$ is a rational solution. These are in fact all rational solutions. This then in turn yields all integral solutions, except those with $x=0$. For these we have $$Y=\frac{-b\pm\sqrt{b^2-4ac}}{2a}Z,$$ so such solutions exist if and only if $\frac{-b\pm\sqrt{b^2-4ac}}{2a}$ are rational, i.e. if and only if $ax^2+bx+c$ has a rational root, which is easy to test.

• I deleted first answer and placed a different thing, nice parametrization as binary quadratic forms. This is guaranteed to be available if there are any solutions at all, and does not depend on the shape of the indefinite ternary quadratic form. Observation used goes back, at least, to Fricke and Klein (1897) book. example math.stackexchange.com/questions/1166332/… – Will Jagy Nov 5 '15 at 17:46

Given,

$$ay^2 + by z + c z^2 = x^2\tag1$$

for the particular case when $z = 1$, and $a$ is not a square, then YES, given an initial positive integer solution, one can find an infinite more positive ones by solving a Pell equation. For your example,

$$202y^2 + 14y z + 9 z^2 = x^2\tag2$$

the solution is,

$$x = 15 + 418 p q + 6060 q^2$$

$$y = 1 + 30 p q + 418 q^2$$

$$z = 1$$

and $p,q$ solve,

$$p^2-202q^2 = 1$$

This is just a special case of a more general solution.

• in case of interest: a nice two-variable parametrization as a new answer, dropped the other one. The theorem is that, if there are any solutions for an indefinite ternary quadratic form, there is a family parametrized by binary forms in the same two variables. I was not sure i could get all the coefficients non-negative, though, but that worked out this time. – Will Jagy Nov 5 '15 at 2:55
• Oh, and a finite number of such parametrizations gives all solutions, although we need to allow negative variables. – Will Jagy Nov 5 '15 at 3:01

Alright, if $$x = 87 u^2 + 116uv + 59 v^2,$$ also $$y = uv + 4 v^2,$$ and $$z = 29 u^2 + 34 u v + 3 v^2,$$ THEN $$x^2 = 202 y^2 + 14 y z + 9 z^2.$$

This comes from a method in Fricke and Klein (1897) which is not widely known. By choosing $u,v$ positive you can get all three $x,y,z$ positive. It is also not so simple to find this sort of recipe. I wrote a program, here was the command:

 ./homothety_indef -1 202 9 14 0 0    0  7076 0 0 -7076 0   119


the output lines I used:

 87    116     59 transposed       87      0     29
0      6      4 transposed      116      6     34
29     34      3 transposed       59      4      3

? x = 87 * u^2 + 116 * u * v + 59 * v^2
%21 = 87*u^2 + 116*v*u + 59*v^2
? y = 6 * u * v + 4 * v^2
%22 = 6*v*u + 4*v^2
? z = 29 * u^2 + 34 * u * v + 3 * v^2
%23 = 29*u^2 + 34*v*u + 3*v^2
?
? 202 * y^2 + 14 * y * z + 9 * z^2
%24 = 7569*u^4 + 20184*v*u^3 + 23722*v^2*u^2 + 13688*v^3*u + 3481*v^4
? x^2
%25 = 7569*u^4 + 20184*v*u^3 + 23722*v^2*u^2 + 13688*v^3*u + 3481*v^4
? 202 * y^2 + 14 * y * z + 9 * z^2 - x^2
%26 = 0
?


The problem is solved definitely. Why is the question constantly recurs to me is not clear. Consider two options to solve this problem. The first option is to directly solve the equation without knowing whether there are solutions.

$$aX^2+bXY+cY^2=jZ^2$$

Solutions can be written if even a single root. $\sqrt{j(a+b+c)}$ , $\sqrt{b^2 + 4a(j-c)}$ , $\sqrt{b^2+4c(j-a)}$
Then the solution can be written.

$$X=(2j(b+2c)^2-(b^2+4c(j-a))(j\pm\sqrt{j(a+b+c)}))s^2+$$

$$+2(b+2c)(\sqrt{j(a+b+c)}\mp{j})sp+(j\mp \sqrt{j(a+b+c)})p^2$$

$$Y=(2j(2j-b-2a)(b+2c)-(b^2+4c(j-a))(j\pm\sqrt{j(a+b+c)}))s^2+$$

$$+2((2j-2a-b)\sqrt{j(a+b+c)}\mp{j(b+2c)})sp+(j\mp\sqrt{j(a+b+c)})p^2$$

$$Z=(2j(b+2c)^2-(b^2+4c(j-a))(a+b+c\pm\sqrt{j(a+b+c)}))s^2+$$

$$+2(b+2c) ( \sqrt{j(a+b+c)} \mp{j})sp + ( a + b + c \mp \sqrt{j(a+b+c)})p^2$$

In the case when the root $\sqrt{b^2+4c(j-a)}$ whole. Solutions have the form.

$$X=((2j-b-2c)(8ac+2b(2j-b))-(b^2+4a(j-c))(b+2c\mp\sqrt{b^2+4c(j-a)}))s^2+$$

$$+2(4ac+b(2j-b)\pm{(2j-b-2c)}\sqrt{b^2+4c(j-a)})sp+(b+2c\pm\sqrt{b^2+4c(j-a)})p^2$$

$$Y=((b+2a)(8ac+2b(2j-b))-(b^2+4a(j-c))(2j-b-2a\mp\sqrt{b^2+4c(j-a)}))s^2+$$

$$+2(4ac+b(2j-b)\pm{(b+2a)}\sqrt{b^2+4c(j-a)})sp+(2j-b-2a\pm\sqrt{b^2+4c(j-a)})p^2$$

$$Z=((b+2a)(8ac+2b(2j-b))-(b^2+4a(j-c))(b+2c\mp\sqrt{b^2+4c(j-a)}))s^2+$$

$$+2(4ac+b(2j-b)\pm {(b+2a)}\sqrt{b^2+4c(j-a)})sp+(b+2c\pm\sqrt{b^2+4c(j-a)})p^2$$

In the case when the root $\sqrt{b^2+4a(j-c)}$ whole. Solutions have the form.

$$X=(2j^2(b+2a)-j(a+b+c)(2j-2c-b\pm\sqrt{b^2+4a(j-c)}))p^2+$$

$$+2j(\sqrt{b^2+4a(j-c)}\mp{(b+2a)})ps+(2j-2c-b\mp\sqrt{b^2+4a(j-c)})s^2$$

$$Y=(2j^2(b+2a)-j(a+b+c)(b+2a\pm\sqrt{b^2+4a(j-c)}))p^2+$$

$$+2j(\sqrt{b^2+4a(j-c)}\mp{(b+2a)})ps+(b+2a\mp\sqrt{b^2+4a(j-c)})s^2$$

$$Z=j(a+b+c)(b+2a\mp\sqrt{b^2+4a(j-c)})p^2+$$

$$+2((a+b+c)\sqrt{b^2+4a(j-c)}\mp{j(b+2a)})ps+ (b+2a\mp\sqrt{b^2+4a(j-c)})s^2$$

Since these formulas are written in general terms, require a certain specificity calculations.If, after a permutation of the coefficients, no root is not an integer. You need to check whether there is an equivalent quadratic form in which, at least one root of a whole. Is usually sufficient to make the substitution $X\longrightarrow{X+kY}$ or more $Y\longrightarrow{Y+kX}$ In fact, this reduces to determining the existence of solutions in certain Pell's equation. Of course with such an idea can solve more complex equations. If I will not disturb anybody, slowly formula will draw. number $p,s$ integers and set us. I understand that these formulas do not like. And when they draw - or try to ignore or delete. Formulas but there are no bad or good. They either are or they are not.

In equation $$aX^2+bY^2+cZ^2=qXY+dXZ+tYZ$$

$a,b,c,q,d,t -$ integer coefficients which specify the conditions of the problem. For a more compact notation, we introduce a replacement.

$$k=(q+t)^2-4b(a+c-d)$$ $$j=(d+t)^2-4c(a+b-q)$$ $$n=t(2a-t-d-q)+(2b-q)(2c-d)$$
Then the formula in the general form is:

$$X=(2n(2c-d-t)+j(q+t-2b\pm\sqrt{k}))p^2+$$

$$+2((d+t-2c)\sqrt{k}\mp{n})ps+(2b-q-t\pm\sqrt{k})s^2$$

$$Y=(2n(2c-d-t)+j(2(a+c-d)-q-t\pm\sqrt{k}))p^2+$$

$$+2((d+t-2c)\sqrt{k}\mp{ n })ps+(q+t+2(d-a-c)\pm\sqrt{k})s^2$$

$$Z=(j(q+t-2b\pm\sqrt{k})-2n(2(a+b-q)-d-t))p^2+$$

$$+2((2(a+b-q)-d-t)\sqrt{k}\mp{n})ps+(2b-q-t\pm\sqrt{k})s^2$$

And more.

$$X=(2n(q+t-2b)+k(2c-d-t\pm\sqrt{j}))p^2+$$

$$+2((2b-q-t)\sqrt{j}\mp{n})ps+(d+t-2c\pm\sqrt{j})s^2$$

$$Y=(2n(2(a+c-d)-q-t)+k(2c-d-t\pm\sqrt{j}))p^2+$$

$$+2((q+t+2(d-a-c))\sqrt{j}\mp{n})ps+(d+t-2c\pm\sqrt{j})s^2$$

$$Z=(2n(q+t-2b)+k(d+t+2(q-a-b)\pm\sqrt{j}))p^2+$$

$$+2((2b-q-t)\sqrt{j}\mp{n})ps+(2(a+b-q)-d-t\pm\sqrt{j})s^2$$

$p,s -$ are integers and are given us. Since formulas are written in general terms, in the case where neither the root is not an integer, it is necessary to check whether there is such an equivalent quadratic form in which at least one root of a whole. If not, then the solution in integers of the equation have not.

• Can you generalize this to higher exponents like x^8 etc? – agra94 Feb 4 at 5:16

The second option is if you know one any decision.

We need to write generally speaking the more General equation:

$$aX^2+bXY+cY^2=jZ^2$$

If we know what any one solution: $(x,y,z)$ - then you can write a formula for the solutions of this equation.

$$X=jxt^2-cxk^2+2(cyk-jzt)s+(by+ax)s^2$$

$$Y=jyt^2-2jztk+(cy+bx)k^2+2axks-ays^2$$

$$Z=jzt^2-(bx+2cy)kt+czk^2+(bzk-(2ax+by)t)s+azs^2$$

$k,t,s$ - any integer asked us.

I think one should first algebraically manipulate it into a form involving a linear equation in whole squares only:

\begin{align} X ^2 &= a \cdot Y^2 + b \cdot YZ + c \cdot Z^2 \\ \to \\ \vdots \\ \to \\ a \cdot \Big[2X\Big]^2+(b^2-4ac)\cdot \Big[Z\Big]^2 &=\Big[2a \cdot Y+b \cdot Z\Big]^2 \\ \end{align}

Then use the time-honored methods of sterographic projection. This is an example.

For the equation $$x^2 = 202 y^2+14yz+9z^2$$, $$a=202$$, $$b=14$$, $$c=9$$, gives us in the whole-square equation:

$$808x^2-7076z^2=(404y+14z)^2$$ Reduces to $$1769z^2+(202y+7z)^2=202x^2$$

Though it looks daunting, you can find all solutions with the one already found by the OP

Equation Shown below has parametrization for $(a,b,c,d)=(6,-7,1,54)$

$dx^2=ay^2 + by z + c z^2$

$x=27k^2-20k-7$

$y=135k^2-54k-1$

$z=81k^2+54k-55$

For $k=0$ , we get $(x,y,z)=(7,1,55)$

• It is useless to explain. The problem is formulated not so. And how much can you write numbers? It is necessary to solve the problem in the indeterminate coefficients. – individ Jul 15 '17 at 5:41