2

I want to find all solutions to the problem of two squares equaling two other squares. $$a^2 + b^2 = c^2 + d^2 \qquad b \le N$$Clearly, without loss of generality, I can assume that $$gcd(a,b,c,d) = 1$$ and $c\le a \le b \le d$. But after that, I'm a bit stuck. I can see an $N^2$ solution doing a meet-in-the-middle algorithm but I'm not sure there isn't a better way to solve this. On a Diophantine equations website it listed this problem as something "which can be done completely" but didn't give a parameterization of HOW to do it completely. Is the meet-in-the-middle the best or is there some better way to go about this?

Thanks for any help!!

amcalde
  • 4,674
  • It is not an exact duplicate but the same answer applies: http://math.stackexchange.com/questions/1254318/combinatorics-integer-sided-triangles-with-integer-median/1254397#1254397 – Jack D'Aurizio Apr 27 '15 at 17:21
  • Maybe to use formulas $a^2+b^2=M^2 \Leftrightarrow a=2nm,,b=n^2-m^2,,M=n^2+m^2$ up to order $a,b$ – Alexey Burdin Apr 27 '15 at 17:23
  • @JackD'Aurizio Should I remove the post? I couldn't find anything similar so I asked. Also, I don't immediately see how the same answer applies but I'm willing to trust you. – amcalde Apr 27 '15 at 17:26
  • @amcalde: the other problem asks for the solutions of $$2a^2+2b^2=c^2+d^2$$ such that $1\leq a\leq b\leq c\leq d$, and my answer shows that the meet-in-the-middle approach is more effective than other techniques, I am just too lazy to write down the same argument twice. – Jack D'Aurizio Apr 27 '15 at 17:32
  • 1
    No worries @JackD'Aurizio, that's exactly what I was asking. I'll just stick with meet-in-the-middle. Thank you – amcalde Apr 27 '15 at 17:45
  • There is in fact a solution of Euler of this problem showing that every solution can be written as $a=xy-zt$ $b=yz+xt$ and $c=yz-xt$ and $d=xy+zt$ – Elaqqad Apr 27 '15 at 18:30
  • @Elaqqad, So with $x,y,z,t$ coprime integers? Any thing else I should know? I'll try it out. – amcalde Apr 27 '15 at 18:36
  • without assuming anything in $a,b,c,d$ other than the equation you will find $x,y,z,t$ this is the general solution. if you assumed that $a,b,c,d$ are coprime you will get some constraints on $x,y,z,t$ but not exactly that they are coprime – Elaqqad Apr 27 '15 at 18:41
  • http://math.stackexchange.com/questions/153603/diophantine-equation-a2b2-c2d2/736164#736164 – individ Apr 28 '15 at 04:29

1 Answers1

2

This is easily solved by rearranging and factoring: \begin{align} a^2-c^2 &= d^2-b^2 \\ (a-c)(a+c) &= (d-b)(d+b). \end{align} If one of the factors is zero, than we have a trivial solution; one of the factors on the other side must also be zero, etc.

Assuming $a \ne \pm c$, we can find $g=\gcd(a-c,d-b)\ge 1$, say $a-c=gu$ and $d-b=gv$ for nonzero integers $u$ and $v$ with $\gcd(u,v)=1$. Now \begin{align} gu(a+c) &= gv(d+b) \\ u(a+c) &= v(d+b). \end{align} Since $u$ and $v$ are coprime, we must have $a+c=kv$ and $d+b=ku$ for some nonzero integer $k$. Back-substituting will give you a parameterization (a.k.a. “complete solution”). From that point, it would be easy to apply the $N$ bound.

Bonus: This technique is equally effective for any equal sums-of-squares equation. See Bradley’s paper for more details and examples.

Kieren MacMillan
  • 7,889
  • 2
  • 28
  • 70