Let $w<x$ be integers with $x^2-w^2$ beeing a square. Which condition they must satisfy for a $y$ to exist with $y^2-x^2$, $y^2-w^2$ being squares?

216 Views Asked by At

Let $(w,x)$ be two integers with $x^2-w^2$ beeing a perfect square. One simple example is $(w,x)=(4,5)$, since $5^2-4^2=9=\square_1=3^2$.

In this case we cannot find a third integer $y$ which satisfies that the differences $y^2-x^2=\square_2$ and $y^2-w^2=\square_3$ are again perfect squares.

A working example would be $(w,x)=(264,520)$ or $(w,x)=(264,561)$, since in both cases an integer $y=1105$ satisfies $y^2-x^2$ and $y^2-w^2$ beeing squares.

My question: Does there exist a condition on $w,x$ that I may use to quickly check, whether such a third integer $y$ exist? It is quite sufficient (and very helpful) for me if this condition predicts/implies that for given $w,x$ there can be no such $y$.

It would be great, if we could determine this $y$ directly at the same time (although I guess it is almost impossible to obtain $y$ directly without bruteforce).

What I investigated so far: I searched in various approaches to extract such a condition. For example I found in the paper entitled "Cycles" by R. C. Lyness a condition that produces cycles. For example I could generate:

[[697.   153.   185.   104.   672.   680.  ]
 [697.   705.3  680.   187.2  153.   107.87]
 [697.   491.4  107.87 479.42 705.3  852.81]
 [697.   842.78 852.81 130.43 491.4  473.78]
 [697.   672.   473.78 822.22 842.78 185.  ]
 [697.   153.   185.   104.   672.   680.  ]]

But it seems not to give me a condition that enables me to check whether for two given integers $w<x$ such a third integer $y$ exist. My code for producing Lyness Cycles is given below:

def get_6tuple(tp:list[float]) -> list[float]:
    w = tp[0]
    x = tp[1]
    y = tp[2]
    return [y,w,x,sqrt(x**2-w**2),sqrt(y**2-x**2),sqrt(y**2-w**2)]

def rotate_np(tuple:np.ndarray) -> np.ndarray:
    p = tuple[0]
    v = tuple[4]
    w = tuple[5]
    return [p, np.float(p*w/v), w, np.float(tuple[2]*w/v), tuple[1], np.float(p*tuple[3]/v)]

def generate_cycle_np(triple:np.ndarray) -> np.ndarray:
    res = np.empty((6,6), dtype=np.float)
    tuple = np.array(get_6tuple(triple), dtype=np.float)
    for i in range (0,6):
        res[i]=tuple
        tuple = rotate_np(tuple)
    return res

print(np.array_str(generate_cycle_np([153, 185, 697]), precision=2, suppress_small=True))
4

There are 4 best solutions below

1
On BEST ANSWER

For there to be two solutions, the variable $\space y\space$ must have two distinct prime factors of the form $\space 4x+1, x\in\mathbb{N}.\quad$ There will be $\space 2^{f-1}\space$ primitive solutions (those with no common divisors) where $\space f\space $ is the number of such factors. For example, $\space 65=5\times13\space$ so there are $\space 2^{2-1}=2\space $ such solutions. There "can" be $\space 3\space$ solutions but one of those will be imprimitive like your $\space 264,520 \space$ where there are non-primitive solutions for each: $\space(264,448,520)=8\times (33,56,65)\space $ and $\space(520,576,776)=8\times (65,72,97).\qquad $

To "know" there will be $\space 3\space$ solutions we must also "know" there will be $\space 4\space$ solutions. For example, $\space 1105=5\times13\times 17\space$ so there are $\space 2^{3-1}=4\space$ solutions. Note: Wolfram Alpha can find these factors as fast as you can type them here. Wolfram Alpha can also provide a list of primes in a defined range and any product and/or power of these where $\space p=4x+1\space$ is a valid $\space y$-value for your purposes.

To find these solutions, we begin with Euclid's formula for generating triples $\space(A,B,C)\space$ where $\space A^2+B^2=C^2.\quad$ Note: ($y=C\space$ in your case.) $$ A=m^2-k^2,\quad B=2mk,\quad C=m^2+k^2$$ If we solve the $\space C$-function for $\space k\space$ and test a defined range of $\space m$-values, those that yield integers are for valid $\space (m,k)\space$ solutions in the formula.

$$C=m^2+k^2\implies k=\sqrt{C-m^2}\\ \qquad\text{for}\qquad \bigg\lfloor\frac{ 1+\sqrt{2C-1}}{2}\bigg\rfloor \le m \le \big\lfloor\sqrt{C-1}\big\rfloor$$ The lower limit ensures $m>k$ and the upper limit ensures $k\in\mathbb{N}$. $$C=1105\implies \bigg\lfloor\frac{ 1+\sqrt{2210-1}}{2}\bigg\rfloor=24 \le m \le \big\lfloor\sqrt{1105-1}\big\rfloor=33\quad \\ \text{and we find} \quad m\in\{24,31,32,33\}\Rightarrow k\in\{23,12,9,4\}\\$$ $$f(24,23)=(47,1104,1105)\quad f(31,12)=(817,744,1105)\\ f(32,9)=(943,576,1105)\quad f(33,4)=(1073,264,1105)\quad $$

5
On

I can easily show you that a finite search is enough.

Notice that for positive integers $b>a$, we have $b^2-a^2\geq (a+1)^2-a^2 =2a+1$.

Moreover, $b^2-a^2 \geq b^2-(b-1)^2 =2b-1$.

So if you give me $x$ and want me to determine whether there exist $t>s$ such that $t^2-x^2=s^2$, which is equivalent to $t^2 -s^2 =x^2$, I know that $s$ cannot be bigger than $\frac{x^2 -1}{2}$ and that $t$ cannot be bigger than $\frac{x^2 +1}{2}$. $\blacksquare$

I will leave you to figure out whether there are more efficient algorithms for your purpose.

$\\$

One suggestion:

Suppose you give me $x,w$ and you need me to find $y$ such that $x^2 +a^2 =w^2 +b^2 =y^2 $.

All Pythagorean triples are of the form $(t^2-s^2, 2st, t^2+s^2)$.

The idea would then be to solve $x=t^2-s^2$ or $x=2st$, and then do the same for $w$. This gives you every relevant Pythagorean triple.

Both possibilities $x=2st$ and $x=t^2-s^2=(t-s)(t+s)$ involve nothing more than factorising $x$.

Maybe to make the algorithm even more efficient, you can eliminate some cases based on $\mod{4}$ or something like that.

9
On

Edit, too big for a comment.

The triples found where $\space x^2-y^2, y^2-x^2, y^2-w^2\space$ are all squares depends on the software used to search. In one version, I generated sets of two values and, if their square difference was a square, I tested to see if both values were part of a triple with the same $\space y$-value. We have seen those results.

In another test, I found that $\space x-y=1\space$ in all cases, e.g.

\begin{align*} d^2=x^2-y^2\space &\qquad\qquad(w,x,y)\\ d=27720\space&(384199200,384199201,543339720)\\ d=92672\space&(4294049816,4294049817,6072703488)\\ d=185600\space&(17223654596,17223654597,24357925924)\\ d=188160\space &(17702074940,17702074941,25034514463)\\ d=198144\space &(19630499812,19630499813,27761719071)\\ \end{align*}

Finally, I used a formula I developed in $\space 2009 \space$ which generates only the subset of triples where $\space GCD(A,B,C)\space$ is an odd square. This includes all primitives and some imprimitives that are $\space 9, 25, 49, 81, \cdots$ multiples of primitives. \begin{align*} A&=&(2n-1)^2+ & 2(2n-1)k \\ B&=& & 2(2n-1)k+ 2k^2 \\ C&=&(2n-1)^2+ & 2(2n-1)k+ 2k^2 \\ \end{align*}

Here is a sample of the sets within the subset that it produces.

$$\begin{array}{c|c|c|c|c|c|} Set_n & k=1 & k=2 & k=3 & k=4 & k=5\\ \hline Set_1 & 3,4,5 & 5,12,13& 7,24,25& 9,40,41& 11,60,61\\ \hline Set_2 & 15,8,17 & 21,20,29 &27,36,45 &33,56,65&39,80,89\\ \hline Set_3& 35,12,37& 45,28,53& 55,48,73&65,72,97& 75,100,125 \\ \hline Set_{4} &63,16,65 &77,36,85 &91,60,109 &105,88,137&119,120,169\\ \hline \end{array}$$

In a new program, I looped values of $\space(n,k)\space$ and tested those to see if $\space\sqrt{\mid B^2-A^2\mid}\space$ was an integer. This automatically makes $\space C^2-B^2=A^2\space\text{and}\space C^2-A^2=B^2.\quad$ Here is a sample of what it finds with user direction $\space 5\space$ sets and $\space 2\space$ triples per set.

\begin{align*} d^2=\mid x^2-y^2\mid \,&\quad F(n,k)=(w,x,y)\\ d=94930419\, & F(1,6889)=(13779,94930420,94930421)\\ d=94957979\, & F(1,6890)=(13781,94957980,94957981)\\ d=948954599\, & F(2,21781)=(130695,948954608,948954617)\\ d=950610791\, & F(2,21800)=(130809,950610800,950610809)\\ d=2148466763\, & F(3,32773)=(327755,2148466788,2148466813)\\ d=2148728975\, & F(3,32775)=(327775,2148729000,2148729025)\\ d=4295254539\, & F(4,46339)=(648795,4295254588,4295254637)\\ d=4295439911\, & F(4,46340)=(648809,4295439960,4295440009)\\ d=6098386239\, & F(5,55215)=(993951,6098386320,6098386401)\\ d=6101478923\, & F(5,55229)=(994203,6101479004,6101479085)\\ \end{align*}

Here is the code that yielded these data.

110 rem Find w,x,y diff perfect squares
120 print "Enter lowest Set number  "; : input l0
130 print "Enter highest Set number "; : input n9
140 print "Number of Triples per Set  "; : input c9
150 k9 = 10000000
160 print "d^2=\mid x^2-y^2\mid \,&\quad F(n,k)=(w,x,y)\\"
170 for n1 = l0 to n9
180      c1 = 0
190   for k1 = 1 to k9
200     w1 = (2*n1-1)^2+2*(2*n1-1)*k1
210     x1 = 2*(2*n1-1)*k1+2*k1^2
220     d1 = sqr(abs(w1^2-x1^2))
230     if d1 = int(d1)
240       y1 = (2*n1-1)^2+2*(2*n1-1)*k1+2*k1^2
250       print "d=" str$(d1)"\, & ";
260       print "F(" str$(n1)"," str$(k1)")=";
270       print "(" str$(w1)"," str$(x1)"," str$(y1)")\\"
280       c1 = c1+1
290       if c1 = c9
300         k1 = k9
310       endif
320     endif
330   next k1
340 next n1
2
On

Euler has given solution, as re-produced in

Tito Piezas web site. His web site is:

"Collection of algebraic identities".

$y^2-w^2=q^2$

$x^2-w^2=r^2$

$x^2-y^2=p^2$

$(x,y,z)=(434657,420968,150568)$

$(p,q,r)=(108225,393120,407745)$