<s>[INST] If $\frac{x^2+y^2+x+y-1}{xy-1}$ is an integer for positive integers $x$ and $y$, then its value is $7$. I saw this on quora
and haven't been able to solve it.
If $\dfrac{x^2+y^2+x+y-1}{xy-1}$
is an integer for positive integers
$x$ and $y$,
then its value is $7$.
If
$y=1$ this is
$\dfrac{x^2+x+1}{x-1}
= x+2+\dfrac{3}{x-1}$
which is an integer only when
$x=2$ or $x=4$ and has value $7$.
Looking at the values from 2 to 20
for $x$ and $y$,
this is an integer only for
$x=2, y=12$ (and $x=12, y=2$).
This value is 7.
So it looks like this might be correct,
and I don't know how to show it.
 [/INST] This can be shown using Vieta Jumping. Consider the polynomial
$$P(x,y)=x^2+y^2+x+y-1-kxy+k$$
We will show that for $x,y,k\in\mathbb{N}$, $P(x,y)=0$ implies $k=7$.
$1)$ If $(x,y)$ is a solution, then $(y,x)$ is a solution
$2)$ If $y=1$ then clearly $k=7$.
$3)$ $k\geq 3$. At $k=1$ solving for $x$ in $P(x,y)=0$ gives a discriminant of
$$\Delta = -3y^2-6y+1$$
At $k=2$ we get a discriminant of
$$\Delta = -8y-3$$
$4)$ $(x,x)$ cannot be a solution.
$$k=1\Rightarrow x\in\{-2,0\}$$
$$k=2\Rightarrow x=-\frac{1}{2}$$
For $k\geq 3$ we have the discriminant of $P(x,x)$
$$\Delta=k^2-(3k-3)$$
The difference between $k^2$ and $(k-1)^2$ is
$$k^2-(k-1)^2=2k-1<3k-3$$
The difference between $k^2$ and $(k-2)^2$ is
$$k^2-(k-2)^2=4k-4>3k-3$$
Thus, $\sqrt{\Delta}\not\in \mathbb{Q}$.
$5)$ Suppose we have a solution $(x,y)$ with $x> y>1$. Then
$$x\in\left\{\frac{ky-1\pm\sqrt{(k y-1)^2-4 \left(k+y^2+y-1\right)}}{2}\right\}$$
Since $x\in\mathbb{N}$ and both solutions are positive, we know that both are also natural numbers. Now, can $x$ be the lesser solution? Note that
$$\frac{ky-1-\sqrt{(k y-1)^2-4 \left(k+y^2+y-1\right)}}{2}<\frac{ky-1-\sqrt{(k y-1-2y)^2}}{2}=y$$
Here, this inequality follows since
$$0<1 - k - 2 y - 2 y^2 + k y^2$$
holds for all $(y,k)\in \{2,3,...\}\times \{3,4,...\}$ except for $(2,3)$. We need only consider these pairs from points $2)$ and $3)$ above. We can ignore the final pair though since this gives the polynomial
$$x^2-5x+8$$
with complex solutions. For all other acceptable $(y,k)$ though we have
$$0<1 - k - 2 y - 2 y^2 + k y^2$$
$$=(k y-1)^2-4 \left(k+y^2+y-1\right)-(k y-1-2 y)^2$$
Thus, $x$ is the greater solution and from our original solution $(x,y)$ where $x>y$ we can get a new solution $(z,y)$ where $y>z$.

Let us rehash what we have showed: if we have a solution $(x_0,y_0)$ with $x_0>y_0>0$, then we can make a new solution $(x_1,y_1)$ with $0<x_1<y_1=y_0$. Since the solutions are symmetric, this gives us another solution $(x_2,y_2)$ with $x_2>y_2>0$. Since all of these solutions $(x_n,y_n)$ are natural numbers, this sequence must continue until it hits some minimum. But this minimum can only be $1$ since otherwise we can always find a smaller solution, implying that $k=7$ from the beginning.

EDIT: Since people are interested, this process can be run in reverse to generate all of an infinite number of solutions. Consider the sequences defined
$$a_1=1$$
$$a_2=2$$
$$a_n=\frac{\sqrt{45 a_{n-1}^2-18 a_{n-1}-23}+7 a_{n-1}-1}{2}$$
and
$$b_1=1$$
$$b_2=4$$
$$b_n=\frac{\sqrt{45 b_{n-1}^2-18 b_{n-1}-23}+7 b_{n-1}-1}{2}$$
Then all solutions are of the form $(a_n,a_{n-1})$ or $(b_n,b_{n-1})$ (up to symmetry) and it is easy to generate an infinite amount of them.
</s>