The equation can be rewritten as: $$ F(a,b) = a^2+b^2 - q(ab-1) = 0 $$ If we now interpret $\,(a,b)\,$ as real valued coordinates, then pictures can be made for the curve $\,F(a,b) = 0$ . Where $\color{green}{green}$ means $\,F(a,b)<0\,$ and $\color{red}{red}$ means $\,F(a,b)>0\,$ . Two cases are distinguished: $\,q > 0\,$ and $\,q < 0$ ; nowhere it has been said that the integers are positive.
Pictures of $\,F(a,b)=0\,$ for the case $\,q > 0$ , to be precise $\,q=3$ , $q=5$ , $q=19$ :
The case $\,q=0\,$ is trivial: it follows that $\,x=y=0$ .
The case $\,q=1\,$ implies that there is no curve $\,F(a,b)=0$ :
$\,a^2+b^2-ab+1=(a-b)^2/2+(a^2+b^2)/2+1 > 0\,$ .
The case $\,q=2\,$ implies that there is no curve $\,F(a,b)=0$ :
$\,a^2+b^2-2ab+2=(a-b)^2+2 > 0\,$ .
The case $\,q=3\,$ is the first interesting case for $\,q > 0$ .
All curves for $\,q \ge 3\,$ are hyperbolas, because they have the form
of a conic section equation and the discriminant - similar to the one in
$\,Ax^2+Bxy+Cy^2+Dx+Ey+F=0\,$ is : $\,B^2-4AC = q^2-4 > 0$ .
Pictures of $\,F(a,b)=0\,$ for the case $\,q < 0$ , to be precise $\,q=-1$ , $q=-2$ , $q=-10$ :
The case $\,q=-1\,$ implies that the curve $\,F(a,b)=0\,$ is an ellipse :
$\,a^2+b^2+ab-1=0\,$ , namely a conic section with discriminant $= -3$ .
The case $\,q=-2\,$ implies that $\,F(a,b)=0\,$ is a degenenerate conic section:
$\,a^2+b^2+2ab-2=0$ $\Longrightarrow\;$ $a+b = \pm\sqrt{2}$ , i.e.
two parallel straight lines.
The hyperbolas are back in town with $\,q < -2$ .
About the integer solutions. Educated guess from the pictures:
$q=5 \;\Longrightarrow \;(a,b) = (2,1) \vee (1,2) \vee (-2,-1) \vee (-1,-2)$ .
$q=5 \;\Longrightarrow \;(a,b) = (3,1) \vee (1,3) \vee (-3,-1) \vee (-1,-3)$ .
$q=-1 \; \Longrightarrow \; (a,b) = (0,1) \vee (1,0) \vee (-1,0) \vee (0,-1)$ .
Update. The following Pascal program snippet indeed shows that there are at least many solutions $\,(a,b)\,$ for $\,q=5$ :
program infinity;Output $\,a\;b$ , apart from the last (= overflow) record:
Uses SysUtils;
function g(a,b : integer) : integer; const q : integer = 5; begin g := sqr(a)+sqr(b)-q*(a*b-1); end;
function stop(x,y : integer) : boolean; begin stop := (Length(IntToStr(x)) > 9) or (Length(IntToStr(y)) > 9); end;
procedure crawler; var x,y,f : integer; begin x := 1; y := 1; while true do begin y := y + 1; f := g(x,y); if f = 0 then Writeln(x,' ',y); while f > 0 do begin x := x + 1; f := g(x,y); if f = 0 then Writeln(x,' ',y); end; if (f = 0) and stop(x,y) then Break; end; end;
begin crawler; end.
1 2 1 3 2 9 3 14 9 43 14 67 43 206 67 321 206 987 321 1538 987 4729 1538 7369 4729 22658 7369 35307 22658 108561 35307 169166 108561 520147 169166 810523 520147 2492174 810523 3883449 2492174 11940723 3883449 18606722 11940723 57211441 18606722 89150161 57211441 274116482 89150161 427144083There is a lucid structure observed in the above sequence.