# If $x-y = 5y^2 - 4x^2$, prove that $x-y$ is perfect square

Firstly, merry christmas!

I've got stuck at a problem.

If x, y are nonzero natural numbers with $x>y$ such that $$x-y = 5y^2 - 4x^2,$$ prove that $x - y$ is perfect square.

What I've thought so far: $$x - y = 4y^2 - 4x^2 + y^2$$ $$x - y = 4(y-x)(y+x) + y^2$$ $$x - y + 4(x-y)(x+y) = y^2$$ $$(x-y)(4x+4y+1) = y^2$$ So $4x+4y+1$ is a divisor of $y^2$.

I also take into consideration that $y^2$ modulo $4$ is $0$ or $1$ (I don't know if this can help.)

So how do I prove that $4x+4y+1$ is a perfect square (this would involve $x-y$ - a perfect square)? While taking examples, I couldn't find any perfect square with a divisor that is $M_4 + 1$ and is not perfect square.

If there are any mistakes or another way, please tell me.

Some help would be apreciated. Thanks!

• Can you show that $\gcd (x-y, 4x+4y+1) = 1$? And can you see how that shows that $x-y$ and $4x+4y+1$ are both perfect squares? – Daniel Fischer Dec 26 '15 at 13:22
• The problem seems to have error $5y^2-4x^2$ will always be negative for all $x>y$ maybe complex roots – Archis Welankar Dec 26 '15 at 13:25
• @ArchisWelankar $5\cdot 9^2 - 4\cdot 10^2 > 0$. – Daniel Fischer Dec 26 '15 at 13:27
• My computer found positive integer solutions when $(x,y)=(38,34)$ and $(12276,10980)$, and no others for $x \leq 100000$. They seem rare. – Rebecca J. Stones Dec 26 '15 at 14:18
• @RebeccaJ.Stones: There's actually an infinite number of them as it involves solving the Pell equation $p^2-20q^2=1$. The next pair is, $x,y = 3952874,3535558$ and $x-y=646^2$. – Tito Piezas III Dec 26 '15 at 14:39

Generalization. Let $a,b$ be integers. If there exists consecutive integers $c,d$ such that $a-b=a^2c-b^2d$, then $|a-b|$ is a perfect square.

Proof. If $c=d+1$, we have $a-b=a^2(d+1)-b^2d=(a-b)(a+b)d+a^2$, so $$a^2=(a-b)(1-d(a+b))$$ Now let $g=\text{gcd}(a-b,1-d(a+b))$. We have $g^2|a^2$, so $g|a$. Now we have $g|b$, and we have $g|1$, so $g=1$.

Since $a-b$ and $1-d(a+b)$ are coprime and their multiple is a perfect square, we are done.

The case $c+1=d$ is handled similarly. $\blacksquare$.

Let $z=x-y$. Then $(x-5z)^2=z(20z+1)$ and so $z(20z+1)$ is a perfect square. Since $\gcd(z,20z+1)=1$ both $z$ and $20z+1$ must be perfect squares.

• This is essentially sequence A207832 in the Online Encyclopedia of Integer Sequences, oeis.org/A207832. That is the sequence of $t$s such that $20t^2 + 1$ is a perfect square. In the notation used here, $z = t^2$. The entries grow like $C\times \gamma^n$ with $\gamma \approx 18$, explaining why these numbers are rare. – Hans Engler Dec 26 '15 at 14:53
• @HansEngler as pointed out in the comments above there is a closed form for all possible pairs. This follows from the explicit solutions to the equation $p^2-20q^2=1$. WolframAlpha has no problems with such an equation. ;-) – WimC Dec 26 '15 at 14:56

Solve,

$$x - y=5y^2 - 4x^2\tag1$$

hence,

$$x = \frac{-1\pm\sqrt{1+16y+80y^2}}{8}$$

Let,

$$1+16y+80y^2 = \big(\tfrac{2p}{q}y-1\big)^2$$

Expand and factor to get,

$$y = \frac{pq+4q^2}{p^2-20q^2}$$

with the relevant $x$ as,

$$x = \frac{pq+5q^2}{p^2-20q^2}$$

and $x,y$ will be integers if $p,q$ satisfy the Pell equation,

$$p^2-20q^2 = 1$$

One can then see that $x>y$ and,

$$x-y = \frac{q^2}{p^2-20q^2}=q^2$$

The first few $p,q$ are,

$$9, 2 \\161, 36 \\ 2889, 646$$

and these yield $x,y$,

$$38, 34 \\ 12276, 10980 \\ 3952874, 3535558$$

and so on, consistent with the numerical search made in the comments.