<s>[INST] Relationships between the elements $(a,b,c,d)$ of a solution to $A^2+B^2+4=C^2+D^2$ I have reduced a certain equation (in positive integers) to the equation
$$A^2 + B^2 + 4 = C^2 + D^2. \quad(\star)$$
Assume the positive integers $(a,b,c,d)$ are any solution to $(\star)$. Are there any algebraic restrictions on [i.e., relationships between] the elements which are well-known or easy to prove? I'm thinking of things like Pythagorean means, or other relative size or congruence restrictions.
Thank you,
Kieren.
 [/INST] A subset of integer solutions to,
$$A^2+B^2+4 = C^2+D^2\tag{1}$$
can be reduced to solving the Pell equation $x^2-ny^2 = 1$ for any non-square $n$ (where $n=5$ will involve the Fibonacci numbers). Consider the more general,
$$x_1^2+x_2^2+x_3^2 = y_1^2+y_2^2+y_3^2\tag{2}$$
The complete solution is,
$$(a+b)^2+(c+d)^2+(e+f)^2 = (a-b)^2+(c-d)^2+(e-f)^2\tag{3}$$
where,
$$ab+cd+ef = 0\tag{4}$$
It is easy to make the last term of $(3)$ vanish. Let $e=f=t$. Thus,
$$(a+b)^2+(c+d)^2+(2t)^2 = (a-b)^2+(c-d)^2\tag{5}$$
However, if you set $a,b,c = x+y,\, -x+y,\, y^2$, then condition $(4)$ becomes,
$$x^2-(d+1)y^2 = t^2\tag{6}$$
If you set $t = 1$, then any Pell equation will give integer solutions to $(1)$.  For a nice example, let $d = 4$ so one has to solve,
$$x^2-5y^2 = 1$$
The solution is $x_n = \tfrac{1}{2}F_{6n}+F_{6n-1}$ (A023039) and $y_n = \tfrac{1}{2}F_{6n}$ (A060645), where $F_n$ are the Fibonacci numbers. After some tweaking so that all terms won't be even, a Fibonacci identity which satisfies $(1)$ is then,
$$(F_{6n+3})^2+( \tfrac{1}{4}F_{6n+3}^2+4)^2+4 = (F_{6n+2}+F_{6n+4})^2+(\tfrac{1}{4}F_{6n+3}^2-4)^2\tag{7}$$
where $n=1$ is,
$$34^2+293^2+4 = 76^2 +285^2$$
and so on.
</s>