Find the positive integers pair $(x, y)$ such that $xy^2 + y + 1 \mid x^2y + x + y$. 
Find the positive integers pair $(x, y)$ such that $xy^2 + y + 1 \mid x^2y + x + y$.

We have that $xy^2 + y + 1 \mid x^2y + x + y \implies xy^2 + y + 1 \mid y(x^2y + x + y) - x(xy^2 + y + 1)$
$\iff xy^2 + y + 1 \mid y^2 - x \implies xy^2 + y + 1 \mid xy^2 + y + 1 - x(y^2 - x)$
$\iff xy^2 + y + 1 \mid x^2 + y + 1 \implies xy^2 + y + 1 \le x^2 + y + 1$
$\iff xy^2 \le x^2 \iff y^2 \le x$. And I don't know what to do next.
This problem is adapted from a recent competition.

We know that $(xy^2+y+1) \mid (x^2y+x+y)$. Let $k \in \mathbb{N}$ s.t. $$(x^2y+x+y)=k(xy^2+y+1)$$
We can  rewrite this expression as a quadratic in $x$:
$$yx^2+(1-ky^2)x+(-ky-k+y)=0$$
Now, we can see that the discriminant is:
$$\Delta = (ky^2-1)^2+4y(ky+k-y)=(ky^2+1)^2+4y(k-y)$$
We can see that the discriminant must be a perfect square. However:
$$(ky^2)^2 \geqslant (ky^2+1)^2+4y(k-y) \implies 4y(y-k) \geqslant 2ky^2+1 \tag{1}$$
$$(ky^2+2)^2 \leqslant (ky^2+1)^2+4y(k-y) \implies 4y(k-y) \geqslant 2ky^2+3 \tag{2}$$
However, for $k \geqslant 2$ and $y \geqslant 2$, we have:
$$2ky^2 \geqslant 4y^2 \tag{3}$$
$$2ky^2 \geqslant 4ky$$
Thus, we have:
$$2ky^2+3 > 2ky^2+1 > 2y^2 \geqslant 4y \cdot \mathrm{max}(k,y) \geqslant 4y|k-y|$$
Thus, we either have $k=1$, $y=1$ or $(ky^2)^2 < \Delta (ky^2+2)^2 \implies \Delta = (ky^2+1)^2 \implies y=k$.
$(i)$ $k=1$
We have: $$x^2y+x+y=xy^2+y+1 \implies x^2y+x=xy^2+1 \implies x \mid 1 \implies x=1$$
Thus, we have:
$$y+1=y^2+1 \implies y=1$$
This gives us the solution $(x,y)=(1,1)$ for $k=1$.
$(ii)$ $y=1$
We have: $$x^2+x+1=x+2 \implies x=1$$
This gives us the same solution as before.
$(iii)$ $k=y$
From our previous quadratic:
$$x=\frac{ky^2-1 \pm \sqrt{\Delta}}{2y}=\frac{(y^3-1) \pm (y^3+1)}{2y}>0 \implies x=y^2$$
This gives us the solution $(x,y)=(t^2,t)$ for any $t \in \mathbb{N}$. This also includes $(x,y)=(1,1)$, which is our other solution.
Thus, the only possible pairs of positive integers $(x,y)$ such that $(xy^2+y+1) \mid (x^2y+x+y)$ are all pairs: $$(x,y)=(t^2,t) \space \forall \space t \in \mathbb{N}$$
