I'm trying to find $n,m \in \mathbb{N}$ such that $\sqrt{ \frac{n^2+1}{2(m^2+1)}}$ is rational.
I see that if $a,b$ are relatively prime $\sqrt{ \frac{a}{b}}$ is rational if and only if $a,b$ are perfect squares. $n^2+1$ can be a perfect square only if n = 0 and $2(m^2+1)$ is a square only when m = 1. For any other solution, we must have that WLOG $a = b\cdot r^2$ for some integer $r$. In other words $\frac{n^2+1}{m^2+1} = 2 \cdot r^2$
How could I go about solving that - or, what seems more likely, showing that there are no solutions? Is there a more general way to show $\frac{n^2+1}{m^2+1} = d \cdot r^2$ can have solutions only for specific $d$.
Thank you