I'm reading a paper that says that the solutions to this Diophantine system can be parametrized (system and parametrization below):$$u^2 - 5x^2 = y^2, \quad u^2 - x^2 = v^2.$$They say that every solution is of the form$$u = p^2 + 5q^2, \quad x = 2pq,$$$$u = m^2 + n^2, \quad x = 2mn.$$(The second is just the Pythagorean parametrization.) But they just say this comes from "methods expounded in standard number theory textbooks".
I'm interested in whether the parametrization still holds if we replace $5$ by some other number. But I can't find a reference for the proof.
Any way to prove this/any book you can direct me to?