# Number of x such that $m-x^2$ and $n-x^2$ are both squares

For given integers $m$,$n$, what bounds are known on the number of positive integers $x$ such that $m-x^2$ and $n-x^2$ are both perfect squares? In particular, is the number of such $x$ bounded above by a constant independent of $m,n$?

A search for $m,n \le 5000$ gives three pairs for which there are 4 such x: (1370,2210),(2210,3050), and (3485,3965).

-
The number of $x$ will almost certainly not be bounded by a constant independent of $m,n$. Here's why. The equations you're trying to solve are two quadrics; the intersection of two quadrics is a genus 1 curve and you have a lot of genus 1 curves to choose from. Find $m_0$ and $n_0$ such that this genus 1 curve is an elliptic curve of positive rank. Then you have infinitely many rational $x$ such that $m_0-x^2$ and $n_0-x^2$ are perfect rational squares. The denominators will be growing -- but now choose $m=m_0D^2$ and $n=n_0D^2$ for some large $D$ to get as many solutions as you want. – Kevin Buzzard Apr 25 '12 at 6:50
That's a comment not an answer, because you now need to find the appropriate $m_0$ and $n_0$. It wouldn't surprise me if you'd already found them in your computer search but I don't have time to check -- it's the school run. More interesting would be restricting to the case $m$ and $n$ coprime. Then things get much thorny. Here's a related question: mathoverflow.net/questions/50661/… which remains unanswered at this point and is probably open... – Kevin Buzzard Apr 25 '12 at 6:53
Are you saying that for fixed $m_0,n_0$ the set of $(x,y,z)$ with $m_0=x^2+y^2$ and $n_0=x^2+z^2$ is an elliptic curve? Tell me more. – Aaron Meyerowitz Apr 27 '12 at 16:56
Aaron -- the generic intersection of two quadrics in projective 3-space is a genus 1 curve. This is a standard cohomological calculation -- but if you want to see an explicit low-level argument then the birational transformation that does the job is in, for example, Cassels' little blue book on elliptic curves. – Kevin Buzzard Apr 28 '12 at 9:40

In comments Aaron asked about an example of Kevin's construction with $10$ points.

In Kevin's comment the rational points come from the group law on the elliptic curve and $D$ is the lcm of the denominators.

Here is magma online code and example with $10$ points -- as Kevin wrote this way you get as many solutions as you want.

Starting with the OP's $m,n=1370,2210$ got a Weierstrass model of EC.

Found $4$ generators with mwrank (could have used some of OP's points instead of finding generators).

Multiples of the $4$ generators gave additional solutions to the OP and here is the result:

D= 12390849713183581790836556709545874255316431121037842112055747871712302486846209203045
m= 210340424562141262047595910887493791274649532004925386992592745031243269297527125123770927661074947583428727448136984975928253274592074678864394207689104340429534031062674250
n= 339308276118490648996486834351358597603631726810865040331116763882516514706229887973382299365675645371808385153564041457519299077991594919919935181746657366678299422371175250
x1= 12390849713183581790836556709545874255316431121037842112055747871712302486846209203045
x2= 284989543403222381189240804319555107872277915783870368577282201049382957197462811670035
x3= 458461439387792526260952598253197347446707951478400158146062671253355192013309740512665
x4= 359334641682323871934260144576830353404176502510097421249616688279656772118540066888305
x5= 37114042644837641401487345470535116987974416718966693064558863256140865315458375412615
x6= 61662771334048589214986191564717597484363845941296621783693700780051335795784841331249
x7= 136028531722798363505361591190162668220641503334832494123018223476468013307956416186455
x8= 244444823900679257002213529250900630227602064446780336065278693335401699985373414615885
x9= 301450648169146711879386180421262383173184752443718928831863273736903739700469518290993
x10= 437274569420552490793563721414855158314534791058269868589191046763361083229670113418305


Magma online code

m:=1370;
n:=2210;
aa<x,y,z>:=AffineSpace(Rationals(),3);
C:=Curve(aa,[m-x^2-y^2,n-x^2-z^2]);
P:=C!([1,37,47]);
pc:=ProjectiveClosure(C);
E,m1:=EllipticCurve(pc,pc!(P));
m2:=Inverse(m1);
aInvariants(E);
Ep:=E!([-323231734744697104/27633477663066497041,585299700649024 /27633477663066497041]);
m2(Ep);
m2(2*Ep);

-
Thanks for doing the dirty work joro! So this is a proof that there is no bound independent of $m,n$. – Kevin Buzzard Apr 28 '12 at 9:42

(revised) I suspected that there is no bound, but now I am not as sure . In an example $m,n$ with many such $x$ it will have to be the case that $m$ can be written in many ways as a sum of two squares (and the same for $n$.) Also, $m^2-n^2$ will have to be expressed in many ways as a difference of $2$ squares. We know that the number of ways to do these three things can be derived from the prime factorizations of $m,n$ and $n-m$. So this tells us where to look for possible examples. The number of positive solutions of $m=x^2+y^2$ is $2^{k-1}$ when $m$ is a product of $k$ distinct primes all congruent to $1\mod{4}$ (This gives $2^k$ possible $x$. Also, the general formula is not much harder). Consider the $126$ products of $5$ out of the $9$ primes $5, 13, 17, 29, 37, 41, 53, 61, 73.$ It turns out that $m=2401165, n=4254445$ allow for 7 such $x.$

Going out to $101$ and using products of $4$ primes one finds that there are $5$ choices of $x$ in the case of the relatively prime integers $m=1662965=5\cdot37\cdot89\cdot101$ and $n=3068117=13\cdot53\cdot61\cdot73.$ Note that $n-m=2^5\cdot3^2\cdot7\cdot17\cdot41$ which allows $48$ ways to have $n-m=y^2-z^2.$

Here is why I wonder if we can be confident of getting even larger numbers: The points $(x,y)$ with $x^2+y^2=m$ are the points of $\mathbb{Z}^2$ which are on the circle of radius $m$ (and are in the first quadrant.) So we are looking for two circle of integer radii $m \lt n$, centered at the origin, and having a large number of pairs lattice points one on the larger circle and the other vertically below and on the smaller circle. To have a large number of lattice points on the circle of radius $m$ will require $m$ to have many factors and hence be large. As $m$ grows the number of lattice points can grow but the circumference grows more rapidly leading to a sparser distributin of points. $m=13\cdot17\cdot29$ allows for $8$ possible $x$ values along a quarter circle of circumference $m\pi/2 \approx 10067.$ Now $m=5\cdot13\cdot17\cdot29$ would allow for twice as many points, but along a quarter circle with $5$ times the circumference (and this is the most favorable example.)

-
The first comment explains how to "get as many solutions as you want". Doesn't your last revision contradict it? – joro Apr 27 '12 at 15:01
The first comment tells you how to get as any solutions as you want for $m=s^2+t^2$ and for $n=u^2+v^2$ but not how to get lots of solutions of $m=x^2+t^2$ and $n=x^2+v^2$. Still using that I looked at $m_1 \cdots m_{126}$ each with $32$ possible values for $x$ and did find one pair with $7$ shared $x$ values . In my first version I suggested that there was no limit how high you could go. Later I was less sure. I didn't figure out Kevin's comment yet. – Aaron Meyerowitz Apr 27 '12 at 16:48
I meant Kevin's comment. $m_0=x^2+y^2$ and $n_0=x^2+z^2$ for fixed $m_0,n_0$ is genus 1 curve. One can check in a CAS like sage or magma. If it has a rational point it is birationally equivalent to a Weierstrass model of elliptic curve. The first equation is genus 0 and it can parametrized over $\mathbb{Q}$ or $\bar{\mathbb{Q}}$. Plugging the parametrization for $x$ gives quartic = square which is only 1 equation and a quartic model of an EC. If the EC has a point of infinite order using the group law one can find many rational points. To make the points integral, scale by $D$... – joro Apr 28 '12 at 5:40
...which is the lcm of the denominators. This changes $m_0,n_0$ though – joro Apr 28 '12 at 5:42
That may well be. I can believe that there may be an example with as many as $10$ common $x$ values, but I'd like to see one. I found $7$ very easily. Looking at most of the $2^{15}$ products of some or all of $2, 5, 13, 17, 29, 37, 41, 53, 61, 73, 89, 97, 101, 109, 113$ turned up a few more cases of $7$ but never $8$ or more. – Aaron Meyerowitz Apr 28 '12 at 7:31