Diophantine Equations – Solving a^2 + b^2 = c^2 + d^2

diophantine equationselementary-number-theorysums-of-squares

I was reasonably certain I've seen this before, but I was wondering how to solve the Diophantine equation

$$a^2+b^2=c^2+d^2$$

I tried a web search and found nothing on this one. I'm trying to avoid another library trip to a less than local library (maybe I should have taken better notes on that chapter…).

I'm not quite sure how to handle this one. The only thing I can figure out with this equation, if I remember correctly, is that the sum on either side may only contain prime factors of 2 or odd primes congruent to 1 mod 4. And if I don't want a and b equal to c and d, the sum can't be prime as I believe a prime congruent to 1 mod 4 can be represented as the sum of 2 squares in exactly one way. But that doesn't give me any insight into actually solving this problem.

Best Answer

Essentially you ask for a parametrization of the quadric $V(a^2+b^2=c^2+d^2)$. There is a general geometric method how to do that, which you can find here. On page 13, this example is discussed: Solutions of $a^2+b^2=c^2+d^2$ are parametrized by

$(a,b,c,d) = (p r + q s , q r - p s , p r - q s , p s + q r),$

where $p,q,r,s$ are arbitrary. But one can also derive this via complex numbers (similar to the complex numbers solution of Pythagorean triples): Let $u = p + qi$, $v = r + si \in \mathbb{C}$. Then we have

$$|u \overline{v}| = |u| |\overline{v}| = |u| |v| = |u v|.$$

Square both sides, and compute the norms of the products explicitly. This gives you

$$(p r + q s)^2 + (q r - p s)^2 = (p r - q s)^2 + (p s + q r)^2.$$