Find all integers $m,n$ for which $m^2+n^2$ is a square and $\sqrt{\frac{2m^2+2}{n^2+1}}$ is rational This is a repost of my old question here. The question is as follows: 
Find all integers m and n, such that $m^2 + n^2$ is a square and  $\sqrt{\frac{2(m^2+1)}{n^2+1}}$ is rational. 
I have made no progress on this problem since I last asked it. Tito gave a very nice answer for if $m,n$ were rational numbers, but it would be awesome if some people could provide some insight into this problem and solve it once and for all. It would also be really cool if we replaced that 2 with another number and investigated that as well. 
(For your reference, the original question was 2010 USAJMO problem 6. I tried to bash the question out and somehow I arrived at this problem. I suspect I made a mistake somewhere because the problem is no longer homogeneous.) 

Here is my amateur attempt to your problem.
The number is rational iff there exist integers $\,p, q\in \mathbb N\,$ such that $\displaystyle\,\sqrt{\frac{k\left(m^2+1\right)}{n^2+1}}=\frac{p}{q}.\,$
$\,m^2 + n^2\,$ is square $\iff$ there exist an integer $\,r\in \mathbb N\,$ such that  $\,m^2 + n^2 = r^2\,$
Thus we get a system
$$
\left\lbrace\begin{aligned}
  \frac{p^2}{q^2} &=  \frac{k\left(m^2+1\right)}{n^2+1} \\
  r^2 & = m^2 + n^2 \\
\end{aligned}\right.
\implies
\left\lbrace\begin{aligned}
  p^2 & = k\left(m^2+1\right) \\
  q^2 & = n^2+1 \\
  r^2 & = m^2 + n^2 
\end{aligned}\right.
\implies
\left\lbrace\begin{aligned}
  m^2 & = \frac{p^2}{k} - 1 \\
  n^2 & = q^2 - 1 \\
  r^2 & =  \frac{p^2}{k}  + q^2 - 2 
\end{aligned}\right.
\implies 
%\left\lbrace\begin{aligned}
%  p,q,r \in \mathbb N, \\
%  \frac{p^2}{k}  \in \mathbb N ,\\
%\end{aligned}\right.
\left\lbrace\begin{aligned}
  %\frac{p^2}{k}  
  p^2&/k\in \mathbb N^+ ,\\
  p^2 &\ge k>0 \\
  q^2 & = n^2 + 1
\end{aligned}\right.
$$
so the problem is only solvable for $\,k\in \mathbb Q^+.\,$
Also, $\, r^2  = m^2 + n^2 \implies m^2 = r^2 - n^2,\,$ therefore
$$
\left\lbrace\begin{aligned}
  p^2 & = k\left(m^2+1\right) \\
  q^2 & = n^2+1 \\
  r^2 & = m^2 + n^2 
\end{aligned}\right.
\Rightarrow 
\left\lbrace\begin{aligned}
  p^2 & = k \left( r^2 - n^2 + 1 \right) \\
  q^2 & = n^2+1 \\
  m^2 & = r^2 - n^2 
\end{aligned}\right.
\Rightarrow 
\left\lbrace\begin{aligned}
  p^2 & = k\left(m^2+1\right) \\
  q^2 & = 1 \\
  n^2 & = 0 \\
\end{aligned}\right.
%\Rightarrow 
\implies
\left\lbrace\begin{aligned}
  m & = \pm\sqrt{\frac{p^2}{k}-1} \\
% q & = \pm 1 \\
  n & = 0 \\
  k & \ge 0
\end{aligned}\right.
$$
The problem is only well-defined for $\,k \ge 0.\,$ 
Note that case $\,k=0\,$ is trivial, so we require $\, k \in \mathbb Q^+.\,$
Additionally, $\,r^2  = m^2 + n^2 \ge 0 \,$ is non-trivial iff $\,r^2 >0.\,$ 
If $\,r^2=0\,$ we would get $\,m = n = 0.\,$ 
$$
%m^2= \frac{p^2}{k}-1 \implies
%\frac{p^2}{k}-m^2 = 1 \implies 
\left\lbrace\begin{aligned}
  &p^2  = k\left(m^2+1\right) \\
 % &n^2  = 0 \\
  &\frac{p^2}{k}  + q^2 > 2 
\end{aligned}\right.
\stackrel{q^2 =1}{\implies }
\left\lbrace\begin{aligned}
  p^2 & = k\left(m^2+1\right) \\
  p^2 & > k
\end{aligned}\right.
\implies m^2 >0 \implies m \neq 0
$$
$$
0<k \in \mathbb Q^+ \implies k = \dfrac{a}{b}, \ a,b\in \mathbb N^+
\implies 
%p^2 = \frac{a\left(m^2 + 1 \right)}{b}
m^2 = \frac{b}{a}p^2 - 1\\
\bbox[5pt, border:2pt solid #f10000]{b p^2 - am^2 = a}
$$
In this way we obtained a second order Diophantine equation with $\,a,b\in \mathbb N^+\,$ given and $\,m\,$ can possibly be determined from the equation above by choosing appropriate integer values of $\,p.\,$
Note that if we assume integer $\,k \in \mathbb N^+,\,$ we get Pell-like equation which might be easier to solve.
$$
\bbox[5pt, border:2pt solid #f10000]{m^2 - kp^2 = - 1}
$$
According to WolframAlpha, if one of the solutions of such an equation is known, then the rest can be computed using standard techniques for Pell Equation.

In particular, for $\, k = 2\,$ we get $\, a=2, \ b= 1,\,$ and
$$
\bbox[5pt, border:2pt solid #f10000]{m^2 = 2p^2 - 1}
$$
so that in addition to $\,n=0\,$ we get 
$$
\begin{aligned}
p &= 1 &\implies& &m &= \pm 1, \\
p &= 5 &\implies& &m &= \pm 7, \\
p &= 29 &\implies& &m &= \pm 41, \\
\end{aligned}
\\
\cdots 
$$
