<s>[INST] Determine all prime numbers $p,q,r$ such that : $p^{2}+1=r^{2}+q^{2}$ Problem : 
find all prime numbers such that : 

$$p^{2}+1=q^{2}+r^{2}$$

My attempt : 
equation equivalent : 
$p^{2}-q^{2}=r^{2}-1$ 
so : 
$(p+q)(p-q)=(r+1)(r-1)$ 
now : 
$r=2$ we find : $p+q=2$ or $p-q=1$ $×$
$r=3$ we find : $p+q=3,2$ or $p-q=2,3$ $×$ 
$r=5$ we find : $p+q=10,2,4,5,20$ or $p-q=2,20,10,5,4,$
so I have many case how I find it ? 
see : 
$13^{2}+1=7^{2}+11^{2}$ 
$17^{2}+1=11^{2}+13^{2}$ 
$23^{2}+1=13^{2}+19^{2}$ 
$31^{2}+1=11^{2}+29^{2}$ 
I need generalized this solution ? 
I think ? 
$(5x+13)^{2}+1=(3x+7)^{2}+(4x+11)^{2}$ 
I think we have infinity prime numbers
but how I prove it ? and how I find this case ??
 [/INST] COMMENT.- One way could be to consider the general solution of the equation  $x^ 2 + y^ 2 = z^ 2 + w^ 2$ that gives a parameterization with four independent  coprime parameters with which one could look for prime values  for $r$ and $q$. For example by making $at-bs = 1$ and $as + bt = p$, try to see if primes $r$ and $q$ are obtained with appropriate values of the parameters $a, b, t, r$. But this march is very laborious.
A curious fact is that for the (type Pell-Fermat) equation $p^2+1=2q^2$  (trying with $r=q$) all the infinitely many  integer solutions given by Wolfram does not appear the solution $(p,q)=(7,5)$ but it appears, for example $(p,q)=(41,29)$. Again this way is very laborious to find primes as solutions.
Anyway, it seems in fact as the O.P. suggests that there are an infinite number of solutions of which we give a few here.
$$7^2+1=5^2+5^2\\41^2+1=29^2+29^2\\13^2+1=7^2+11^2\\17^2+1=11^2+13^2\\23^2+1=13^2+19^2\\37^2+1=23^2+29^2\\47^2+1=29^2+37^2\\53^2+1=31^2+43^2$$
</s>