<s>[INST] Does the equation $U^2+V^2=A^2+sB^2$ with $s$ squarefree have a complete integer solution? I’m looking for a complete solution (parameterization or other) to the equation in the title, i.e.,
$$
  U^2+V^2=A^2+sB^2,
$$
where $s$ is squarefree [if necessary]. When $s=1$, the solution is well-known (and easy to derive), so we can assume $s \ne 1$.
Any references would be appreciated.
 [/INST] For the equation.
$$U^2+W^2=A^2+tB^2$$
You can write such a parameterization.
$$U=2ps(z^2+tq^2+x^2-y^2)+2x((p^2-s^2)y+(p^2+s^2)z)$$
$$W=(p^2-s^2)(z^2+tq^2-x^2+y^2)+2y(2psx+(p^2+s^2)z)$$
$$A=(p^2+s^2)(z^2-tq^2+x^2+y^2)+2z(2psx+(p^2-s^2)y)$$
$$B=2q(2psx+(p^2-s^2)y+(p^2+s^2)z)$$
</s>