# Parameterizing a Diophantine Equation of Degree 2

I'm trying to solve a problem I found online and after fiddling around with the variables, I've arrived at the equation: $$x^2+x^2y^2+y^2=4z^2; 0 < x \le y; z \le 10^{10}$$ The problem asks for integral values $$x$$, $$y$$ and $$z$$, but the maximum value for $$z$$ is too large to try and test all possible combinations of $$x$$ and $$y$$.

I've coded something up to test the smaller values of $$x$$ and $$y$$ and, with the help of OEIS, have arrived at these: $$x=2k; y = 8k^2; 1 \le k$$ $$x=8(k+1)^2; y = 2(k+1)(16k^2+32k+15); 0\le k$$ but these don't account for other values like $$(x:112,y:418)$$ and $$(x:418,y:1560)$$.

I've done some Googling too, which led me to Diophantine Equations entry on Wikipedia, but the parameterization guide lost me right after I've generated some non-trivial solutions for the equation.

Is there an equation or a set of equations to generate all possible values? If not, would more information help in getting the parameterizations?

Also, for future Diophantine equations, is there a rule of thumb or something I could attempt first to have the parameterizations?

## 4 Answers

I do have an algorithm that keeps tings in reasonable size. I'm going to use other letters.

You are looking at $$(u^2 + 1)(v^2 + 1)= w^2 + 1$$ Fix any integer $$u \geq 1.$$ Next check all $$-1-u \leq v \leq 1+u$$ for solutions to $$w^2 - (1+u^2) v^2 = u^2$$ From what I can see, there are at most 11 such $$(w,v)$$ pairs. Next, the relevant automorphism matrix is $$\left( \begin{array}{cc} 2 u^2 + 1 & 2 u^3 + 2u \\ 2u & 2 u^2 + 1 \\ \end{array} \right)$$ That is, for each such $$(w,v)$$ pair, you get a new solution from $$(w,v) \mapsto \; \; \; \color{red}{ \left( \; \; \; (2u^2+1) w + ( 2u^3 + 2u) v \; , \; \; 2uw + ( 2 u^2 + 1) v \; \; \; \right)}$$ The reason to begin with some negative $$v$$ is to catch surprises. The predictable small positive solutions are $$(w=u, v=0)$$ and $$(w = u^2-u+1, v=u-1)$$ and $$(w = u^2+u+1, v=u+1)$$ there are occasional surprises, beginning with $$u=8, 12, 18, 21,...$$ Let's see, for a fixed $$u,$$ you take $$|v| \leq 1+u,$$ check for when $$u^2 + (u^2 + 1)v^2$$ is another square, call that $$w^2.$$ Put pairs $$(w,v)$$ and $$(w,-v)$$ into a list ordered by $$v$$

u=203

w^2 - 41210 v^2 = 41209 =  7^2 29^2

Thu Aug 27 18:28:05 PDT 2020

w:  203  v:  0  SEED   KEEP +-
w:  837  v:  4  SEED   KEEP +-
w:  41007  v:  202  SEED   KEEP +-
w:  41413  v:  204  SEED   BACK ONE STEP  41007 ,  -202
w:  2059663  v:  10146  SEED   BACK ONE STEP  837 ,  -4
w:  16731057  v:  82418  SEED   BACK ONE STEP  203 ,  0

back step  :       3   u:  203
Thu Aug 27 18:28:06 PDT 2020

w^2 - 41210 v^2 = 41209 =  7^2 29^2


Alright, by Cayley-Hamilton, the solutions split up into a small number of orbits of Fibonacci type, $$v_{j+2} = (4u^2 + 2)v_{j+1} - v_j$$ When $$u=8,$$ we have

$$v_{j+2} = 258 \; v_{j+1} - v_j$$ $$-128, 0, 128, 33024, 8520064,..$$ $$-30, 2, 546, 140866,..$$ $$-9, 7, 1815, 468263...$$ $$-7, 9, 2329, 600873, ...$$ $$-2, 30, 7742, 1997406,...$$ $$0, 128, 33024, 8520064,..$$ $$2, 546, 140866, 36342882,...$$ $$7, 1815, 468263, 120810039,...$$ $$9, 2329, 600873, 155022905,...$$ As you can see, there is considerable repetition, and the $$v$$ values grow rapidly in each sequence. Writing it this way, the fixed $$u$$ value and a $$v$$ value give $$w = \sqrt{u^2 + (u^2 + 1)v^2}$$ You will find that sticking to one of the $$v$$ sequences causes $$w$$ to obey the same rule,

$$w_{j+2} = (4u^2 + 2)w_{j+1} - w_j$$

About when to stop, as $$v$$ gets large we find $$w \approx uv.$$

BUT WAIT, THERE'S MORE.

The predictable small non-negative solutions to $$w = \sqrt{u^2 + (u^2 + 1)v^2}$$ are $$w=u, v=0,$$ then $$w= u^2 - u+1, v = u-1$$ and $$w = u^2 + u + 1, v = u + 1.$$ One of the surprise additions comes when $$u = 2 t^2,$$ in which case $$w = 2t^3 + t , v = t$$

I'm not sure what you want to do with integrals but perhaps solutions for the individual variables might yield ideas. Given: $$x^2+x^2y^2+y^2=4z^2$$

$$x = \frac{± \sqrt{4 z^2 - y^2}}{\sqrt{y^2 + 1}} \land y^2 + 1\ne0$$ $$y = \frac{± \sqrt{4 z^2 - x^2}}{\sqrt{x^2 + 1}} \land x^2 + 1\ne0$$ $$z =\frac{ ± \sqrt{x^2 (y^2 + 1) + y^2)}}{2}$$ The last equation looks like safest since it involves only sums under the radical and no danger of division by zero. Now, given $$\quad (0:

$$z =\frac{ ± \sqrt{1^2 (2^2 + 1) + 2^2)}}{2}=\frac{\sqrt{3^2}}{2}$$ $$z =\frac{ ± \sqrt{1^2 (12^2 + 1) + 12^2)}}{2}=\frac{\sqrt{17^2}}{2}$$ $$z =\frac{ ± \sqrt{2^2 (3^2 + 1) + 3^2)}}{2}=\frac{\sqrt{7^2}}{2}$$ $$z =\frac{ ± \sqrt{2^2 (8^2 + 1) + 8^2)}}{2}=\frac{\sqrt{18^2}}{2}$$ $$z =\frac{ ± \sqrt{4^2 (32^2 + 1) + 32^2)}}{2}=\frac{\sqrt{132^2}}{2}$$

An interesting note is that whenever $$y=x+1$$ there is a perfect square under the radical. This is just busywork math I'm offering but I hope, as I suggested above, that it may help with your ideas.

Consider the primitive solutions. For a given value of $$x$$, we need to solve the generalized Pell's equation $$4z^2-(x^2+1)y^2=x^2$$.

I don't have a proof yet. But from some results obtained via a python code, values of $$x$$ satisfies following recurrence.

$$x(1)=2,x(2)=8,x(n)=4x(n-1)-x(n-2)$$

There are few known algorithms for solving generalized Pell's equation. I guess it can be simplified further.

First few primitive triples are

(2, 8, 9)
(2, 144, 161)
(2, 2584, 2889)
(2, 46368, 51841)
(8, 30, 121)
(8, 546, 2201)
(8, 7742, 31209)
(30, 112, 1681)
(30, 28928, 434161)
(112, 418, 23409)
(418, 1560, 326041)
(1560, 5822, 4541161)
(5822, 21728, 63250209)
(21728, 81090, 880961761)


EDIT: Unfortunately, this doesn't generate all the solutions. Triple such as $$(144, 9790, 704897)$$ and $$(546, 37120, 10133777)$$ cannot be obtained by above method.

$$x^2+x^2y^2+y^2=4z^2\tag{1}$$

$$x^2(1+y^2)+y^2=(2z)^2$$

Let $$Y=\frac{2z}{y}, X=\frac{x}{y}$$ then we get $$Y^2-(1+y^2)X^2=1\tag{2}$$

We consider equation $$(2)$$ as Pell's equation for fixed $$y$$.
Small solutions are given below.

            (x, y, z)
(8, 2, 9)
(144, 2, 161)
(32, 4, 66)
(72, 6, 219)
(128, 8, 516)
(200, 10, 1005)
(288, 12, 1734)
(392, 14, 2751)
(512, 16, 4104)
(648, 18, 5841)
(800, 20, 8010)
(968, 22, 10659)
(1152, 24, 13836)
(1352, 26, 17589)
(1568, 28, 21966)
(1800, 30, 27015)
(2048, 32, 32784)
(2312, 34, 39321)
(2592, 36, 46674)
(2888, 38, 54891)
(3200, 40, 64020)
(3528, 42, 74109)
(3872, 44, 85206)
(4232, 46, 97359)
(4608, 48, 110616)