# What is known about a^2 + b^2 = c^2 + d^2

Could you state or direct me to results regarding the Diophantine equation $a^2+b^2=c^2+d^2$ over integers? Specifically, I am looking for a complete parametrization. In the case that a complete parametrization does not exist, I would be interested in seeing complete parametrizations for special cases.

For example, in the case that any one of the variables is zero, we are led to Pythagorean triples. Taking a variable to be some non-zero constant would be interesting. I'm looking for known results as I am not as familiar with the literature as many MO-ers out there.

-
What qualifies as a "complete" parameterization? This is somewhat unclear (to me, at least) even in the Pythagorean triple case. I know, of course, that $(p^2-q^2,2pq,p^2+q^2)$ is a parameterization for solutions $(a,b,c)$ of $a^2+b^2=c^2$, but is it "complete"? It doesn't include $(4,3,5)$, for example. –  Barry Cipra May 9 '13 at 2:09
$a^2+b^2=c^2+d^2 \Longleftrightarrow a^2-c^2=d^2-b^2 \Longleftrightarrow (a-c)(a+c)=(d-b)(d+b)$. Now the primitive solutions of $rs=tu$ are exactly $(r,s,t,u) = (xx',yy',xy',x'y)$ with $\gcd(x,y)=\gcd(x',y')=1$ (and some positivity condition to avoid duplication with factors of $-1$). If $(a,b,c,d)$ is primitive then $(r,s,t,u)$ is primitive up to a factor of $2$ and satisfies $r\equiv s$ and $t\equiv u \bmod 2$. So just figure out what to do with $x,x',y,y' \bmod 2$ and you're done. –  Noam D. Elkies May 9 '13 at 2:13

MacKay and Mahajan have a short easy-to-read article expanding on Noam's comment. (pdf link)

Edit (5/14/13): There is a whole bunch of random notes on relationships like this one and others that can be found here: https://sites.google.com/site/tpiezas/003

-
But the last puzzle was already solved by Fermat...  ...Which also suggests an alternative approach to the equation $a^2+b^2=c^2+d^2$ starting from the factorization $(a+bi)(a-bi)=(c+di)(c-di)$ in ${\bf Z}[i]$. –  Noam D. Elkies May 9 '13 at 4:18
Using the word "random" to describe the notes may be viewed as somewhat disparaging, as well as inaccurate. A term like "variegated" might be preferred, as I find more resemblance between Piezas's notes and a botanical garden than I do between his notes and some of the backyards I've seen lately. Gerhard "As Lovely As A Trie" Paseman, 2013.05.14 –  Gerhard Paseman May 14 '13 at 16:48

This equation is quite symmetrical so formulas making too much can be written: So for the equation:

$X^2+Y^2=Z^2+R^2$

solution:

$X=a(p^2+s^2)$

$Y=b(p^2+s^2)$

$Z=a(p^2-s^2)+2psb$

$R=2psa+(s^2-p^2)b$

solution:

$X=p^2-2(a-2b)ps+(2a^2-4ab+3b^2)s^2$

$Y=2p^2-4(a-b)ps+(4a^2-6ab+2b^2)s^2$

$Z=2p^2-2(a-2b)ps+2(b^2-a^2)s^2$

$R=p^2-2(3a-2b)ps+(4a^2-8ab+3b^2)s^2$

solution:

$X=p^2+2(a-2b)ps+(10a^2-4ab-5b^2)s^2$

$Y=2p^2+4(a+b)ps+(20a^2-14ab+2b^2)s^2$

$Z=-2p^2+2(a-2b)ps+(22a^2-16ab-2b^2)s^2$

$R=p^2+2(7a-2b)ps+(4a^2+8ab-5b^2)s^2$

solution:

$X=2(a+b)p^2+2(a+b)ps+(5a-4b)s^2$

$Y=2((2a-b)p^2+2(a+b)ps+(5a-b)s^2)$

$Z=2((a+b)p^2+(7a-2b)ps+(a+b)s^2)$

$R=2(b-2a)p^2+2(a+b)ps+(11a-4b)s^2$

solution:

$X=2(b-a)p^2+2(a-b)ps-as^2$

$Y=2((b-2a)p^2+2(a-b)ps+(b-a)s^2)$

$Z=2((b-a)p^2+(3a-2b)ps-(a-b)s^2)$

$R=2(b-2a)p^2+2(a-b)ps+as^2$

number $a,b,p,s$ integers and sets us, and may be of any sign.

-