# Find all positive integers $x,y$ such that $\frac{x^2-1}{xy+1}$ is a non-negative integer.

QUESTION: Find all positive integers $x,y$ such that $\frac{x^2-1}{xy+1}$ is a non-negative integer.

ATTEMPT (AND SOME SOLUTIONS): So, for a positive integer $x$, $x^2-1\ge0$. In the case $x^2-1=0$ i.e $x=1$ (since it's a positive integer), we get $\frac{x^2-1}{xy+1}=0$ which is a non-negative integer, regardless of $y$. So, one solution is $(x,y)=(1,k)$ where $k$ is a positive integer. Now, let's say $y=1$. Then $\frac{x^2-1}{xy+1}=\frac{x^2-1}{x+1}=x-1$ which is always a non-negative integer so $(x,y)=(k,1)$ is also a solution. However, I don't know how to find the other or prove that those are the only ones.

Since $xy+1\mid xy+1$ we have $$xy+1\mid (x^2-1)+(xy+1)= x(x+y)$$

Now $\gcd(xy+1,x)=1$ so $$xy+1\mid x+y\implies xy+1\leq x+y$$

So $(x-1)(y-1)\leq 0$ and thus if $x>1$ and $y>1$ we have no solution.

Ergo $x=1$ or $y=1$...

$x^2-1=(x-1)(x+1)$

$\frac{x^2-1}{xy+1}$ can be an integer if:

A: $x+1=xy+1 ⇒ y=1$ then x can get any value greater than 0.

B: $x-1=xy+1 ⇒ x(y-1)=-2 ⇒ x=2, y=0$ are only possible solutions.