1

In the diophantine equation: $ a^2+b^2=c^2+d^2 $, I know that the solutions are parametrized by $ (a,b,c,d)=(pr+qs, qr-ps,pr-qs,ps+qr) $ where $p,q,r,s \in {Z}$ are arbitrary. I have been having a hard time solving $(p,q,r,s)$ meaning writing them as a combination of the integers $a,b,c,d$).Can you please help me find the solution?

1 Answers1

2

To start I'd suggest removing any common factor of all of $a,b,c,d$ and then at the end you can multiply each of $p,q,r,s$ by that removed factor.

From your setup $(a,b,c,d)=(pr+qs, qr-ps,pr-qs,ps+qr)$ follows $$pr=(a+c)/2 \\ qs=(a-c)/2 \\ qr=(d+b)/2 \\ ps=(d-b)/2 \tag{1}$$ First we see we must have $a,c$ either both even or both odd, and the same for $b,d$. This you can simply arrange to do because you may switch $a,b$ in the equation $a^2+b^2=c^2+d^2$, or similarly switch $c,d$.

Now note that from looking at say $pr$ and $qr$ we know that $r$ is a common factor of the two right sides from (1). I don't know if this always works, but it seems one choice is to make $r$ equal to the gcd of those two right sides. Then once $r$ is decided on, the other values $p,q,s$ can be found from equations $(1)$.

If you notice that for example the right sides of equations for $pr,qr$ happen to be coprime, then you know that it must be $r=\pm 1$ (no need to try both signs, since the negative only leads to each of $p,q,r,s$ getting their signs changed).

Here's an example where there weren't any such coprime right sides. Consider $$7^2+22^2=23^2+2^2.$$ We get $pr=15,\ qs=-8,\ qr=12,\ ps=-10.$ From this we only know $r$ is a divisor of $3$, $s$ is a divisor of $2$, $p$ is a divisor of $5$, and $q$ is a divisor of $4$. That technically leaves a lot of combinations to try, most going nowhere. But starting with for example $r$ being a divisor of $3$ and deciding to take it as actually equal to $3$ (i.e. $\gcd(15,12)$ ) we calculate then $p=5,\ q=4,\ s=-2$ and this choice of $p,q,r,s$ indeed leads back to $(a,b,c,d)=(7,22,23,2).$

ADDED: One can get to the parametrization by use of the "fraction fact" that if $r,s$ are positive integers and the fraction $r/s$ is in reduced form $p/q$ with $\gcd(p,q)=1$ and $p,q$ positive, then there is a unique positive integer $k$ such that $r=kp,\ s=kq.$

So looking at equations $(1)$ we note we've already assumed that $a,c$ are equal mod $2$ as are $b,d$. We may switch sides if necessary and assume also $a>c,d>b$ so that, if we write $w,x,y,z$ for the four right sides in $(1)$ in that order, we have $wx=yz$ following from $a^2+b^2=c^2+d^2,$ and each of $w,x,y,z$ is positive.

Now from $w/y=z/x=p/q$ with $p,q$ positive and coprime, we can apply the fraction fact to define $w=rp,y=rq,z=sp,x=sq.$ Then we have $$ a=w+x=pr+qs,\\ b=y-z=qr-ps,\\ c=w-x=pr-qs,\\ d=z+y=ps+qr.$$ This matches the required form. Note that if originally each of $a,b,c,d$ is odd we may switch some terms and get conceivably different parameter values to get the same solution. In other words the parametrization may not be unique.

coffeemath
  • 29,884
  • 2
  • 31
  • 52
  • Thanks for your input. I have used that approach.How do you write the gcd? Because whenever I match equation 1 and 3 and/or 2 and 4, that is when I hit the brick wall. With actual numbers, it's eloquent. But for me, with the variables, that's where my challenge remains. Thank you. –  Sep 29 '13 at 20:39
  • Once the thing is all factored, one has (in the variable case where no specific values are known) an equation of the form $wx=yz=k$ whose general solution in integers involves taking $k$ and allotting some of its factors to $w$ and some to $z$ etc. This process doesn't allow one to get the individual values of the split off factors. There may be a way to simply use the symbolic version $\gcd(u,v)$ and get something general looking, but it would likely be quite a mess of algebra. Maybe look at how the parametrization is derived. – coffeemath Sep 29 '13 at 20:56
  • Ok. Thank you for so much. I am going to try this. It's been so far a very frustrating endeavor. –  Sep 29 '13 at 21:06
  • @Andy -- I found a way to get the parametrization using reduced form of fractions, and have added it to the answer. Please have a look and I'd like to know if it gives what you want. But there isn't going to be a set of "formulas" for $p,q,r,s$ which are just algebraic expressions in terms of $a,b,c,d$ since one has to use something that comes from the equation $a^2+b^2=c^2+d^2$, which doesn't hold for all $a,b,c,d.$ – coffeemath Sep 30 '13 at 12:13
  • Thanks Coffeemath. I am going to work at it and let you know about my progress.It's alleviating having your feedback. I really appreciate it. By the way, I forgot to mention that it's the Fibonacci identity. As a result, we have the triple equivalence:$$(p^2+q^2)(r^2+s^2)=(pr+qs)^2+(qr-ps)^2=(pr-qs)^2+(ps+qr)^2$$ –  Sep 30 '13 at 15:54