There are so many versions of Alternative proof that $(a^2+b^2)/(ab+1)$ is a square when it's an integer around that probably what I am asking is also a duplicate. Well, in that case, just please mark it as a duplicate.
What I am wondering about is for which pairs $(a,b)$ is $\frac{a^2+b^2}{ab+1}$ a perfect square $\textit{in $\mathbb Q$}$?
Here is very little I have been able to observe experimentally.
The rationals of the form $\sqrt{\frac{a^2+b^2}{ab+1}}$ that occur for $a,b\leqslant500$ are $1,\frac{7}{5},\frac{41}{29},\frac{239}{169},\frac{338}{239},\frac{58}{41},\frac{17}{12},\frac{10}{7},\frac{140}{97},\frac{13}{9},\frac{37}{25},\frac{58}{39},\frac{106}{71},\frac{3}{2},\frac{65}{43},\frac{50}{33},\frac{29}{19},\frac{17}{11},\frac{374}{241},\frac{21}{13},\frac{377}{229},\frac{5}{3},\frac{52}{31},\frac{91}{54},\frac{377}{219}$, $\frac{500}{287},\frac{298}{169},\frac{74}{41},\frac{13}{7},\frac{17}{9},\frac{25}{13},\frac{241}{121},2,\frac{65}{32},\frac{260}{127},\frac{15}{7},\frac{41}{19},\frac{20}{9},\frac{202}{89},\frac{5}{2},\frac{13}{5},\frac{155}{58},\frac{113}{41},3,\frac{25}{8},\frac{73}{19},4,5,6,7$ (some of them appear several times for different pairs $(a,b)$). Seems like not all rationals can be obtained but I am very far from being sure about that.
Let us arrange the above pairs in layers, i. e. ask, for each $d=0,1,2,...$, what is the subset $S_d:=\{a\in\mathbb N\mid \text{$\frac{a^2+(a+d)^2}{a(a+d)+1}$ is a perfect square in $\mathbb Q$}\}$ of $\mathbb N$.
Having looked up to $a=100000$ gives something that looks pretty impenetrable, at least for me: $$ \begin{array}{r|l} d&S_d\\ \hline 0&\{1,7,41,239,1393,8119,47321,...\}\\ 1&\varnothing?\\ 2&\{6,40,238,1392,8118,47320,...\}\\ 3&\varnothing?\\ 4&\varnothing?\\ 5&\varnothing?\\ 6&\{1,2,9,26\}?\\ 7&\{8\}?\\ 8&\varnothing?\\ 9&\varnothing?\\ 10&\varnothing?\\ 11&\{8,32\}?\\ 12..15&\varnothing?\\ 16&\{7\}?\\ 17&\{7\}?\\ 18..21&\varnothing?\\ 22&\{8\}?\\ 23&\{33\}?\\ 24&\{3\}?\\ 25..27&\varnothing?\\ 28&\{20,84\}? \end{array} $$ The sequence $1,7,41,239,...$ for $S_0$ appears in OEIS as A002315 and satisfies $a_n=6a_{n-1}-a_{n-2}$; $S_2$ seems to be $S_0-1$. I have no clue about the rest.
Any takes?