<s>[INST] Find $m, n$ such that $\frac{n^2 + 1}{m^2 + 1 }$ is an integer multiple of a perfect square 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
 [/INST] As leshik points out, there are infinitely many solutions to 
$$n^2 - 2m^2 = 1$$
Each of these gives $\frac{n^2 + 1 } { 2(m^2 + 1) } = 1$

I'm not certain if requiring an integer perfect square is possible, but your question states that rational numbers are fine.
Consider the Pell's equation $x^2 - 13 y^2 = -1$. It has a solution $(18, 5)$, hence has infinitely many solution.
Observe that for each solution,
$$\frac{x^2+1} { 2 (5^2 + 1) } = \left( \frac{y}{2} \right) ^2 $$
Hence, we have infinitely many pairs of integers of the form $(x, 5)$ which work.
Since the smallest solution of $x^2- 13 y^2 = 1$ is $(649, 180)$, the next solution is quite large, and is $(x,y) = (23382, 6485)$.

This arose from realizing that we have a solution $(18,5)$. To generalize this approach for any $d$ would require finding a specific solution first, before knowing what $D$ (in Pell's Equation) to use.

</s>