Finding value of 1 variable in a 3-variable $2^{nd}$ degree equation The question is: If $a,b,\space (a^2+b^2)/(ab-1)=q$ are positive integers, then prove that $q=5$. Also prove that for $q=5$ there are infinitely many solutions in $\mathbf N$ for $a$ and $b$. I simplified the equation as follows:-$$\frac {a^2+b^2}{ab-1}=q\\\begin{align}\\&=>\frac {2a^2+2b^2}{ab-1}=2q\\&=>\frac{a^2+b^2+2ab+a^2+b^2-2ab}{ab-1}=2q\\&=>(a+b)^2+(a-b)^2=2q(ab-1)\\&=>2(a+b)^2+2(a-b)^2=q(4ab-4)\\&=>2(a+b)^2+2(a-b)^2=q((a+b)^2-(a-b)^2-4)\end{align}$$Substituting $a+b=X$ and $a-b=Y$, we get $$2X^2+2Y^2=q(X^2-Y^2-4)\\\begin{align}&=>(q-2)X^2=(q+2)Y^2+4q\end{align}$$Now using the quadratic residues modulo $5$, I know that $X^2,Y^2\equiv0, \pm1(mod\space 5)$. But using this directly doesn't give the answer. So what to do after this? An answer without the use of co-ordinate geometry would be greatly appreciated as it seems there is a very good resemblance of the equation to a pair of hyperbolas which are symmetric with respect to the line $y=x$ but I don't understand co-ordinate geometry very well. 

For such equations:   
$$\frac{x^2+y^2}{xy-1}=-t^2$$    
Using the solutions of the Pell equation.  $$p^2-(t^4-4)s^2=1$$    
You can write the solution.    
$$x=-4tps$$  $$y=t(p^2+2t^2ps+(t^4-4)s^2)$$  
It all comes down to the Pell equation - as I said.  Considering specifically the equation:  
$$\frac{x^2+y^2}{xy-1}=5$$  
Decisions are determined such consistency.  Where the next value is determined using the previous one.  
$$p_2=55p_1+252s_1$$  $$s_2=12p_1+55s_1$$  
You start with numbers.  $(p_1;s_1) - (55 ; 12)$  
Using these numbers, the solution can be written according to a formula. 
$$y=p^2+2ps+21s^2$$  $$x=3p^2+26ps+63s^2$$  
If you use an initial $(p_1 ; s_1) - (1 ; 1)$
Then the solutions are and are determined by formula.
$$y=s$$
$$x=\frac{p+5s}{2}$$
As the sequence it is possible to write endlessly. Then the solutions of the equation, too, can be infinite.
