The solutions to $x^2+5=y^2$. Consider the equation $$x^2+5=y^2.\tag{1}$$


*

*If $x,y\in\mathbb{Z}$, what are solutions to (1)?

*If $x,y\in\mathbb{Q}$, what are solutions to (1)?
Note: $\mathbb{Z}$ is the set of all integers and $\mathbb{Q}$ is the set of all rational numbers.

My attempt: For problem 1, I run the following Mathematica program:
Solve[x^2 + 5 == y^2, {x, y}, Integers]
The output is
{{x -> -2, y -> -3}, {x -> -2, y -> 3}, {x -> 2, y -> -3}, {x -> 2, 
  y -> 3}}
I do not know if there is any other solutions. If the above result is correct, I would like to know why there is no other solutions.

For problem 2, I run the following Mathematica program:
Solve[(x/a)^2 + 5 == (y/b)^2 && a != 0 && b != 0 && GCD[x, a] == 1 && 
  GCD[y, b] == 1, {a, b, x, y}, Integers]
The output is the same as the input, it means that Mathematica cannot solve this equation.

Any comments and answers are welcome. Thank you very much.
 A: For solutions over $\Bbb Z$ see comments by others.
Finding solutions over $\Bbb Q$ is equivalent to solving
$$x^2+5z^2=y^2$$
over $\Bbb Z$, with $x,y,z$ coprime.  Without loss of (much) generality assume that $x,y,z$ are positive.  Two points first:


*

*$x,z$ cannot both be even as then $y$ is even, contradicting coprimality;

*$x,z$ cannot both be odd as then $y^2\equiv2\pmod4$ which is impossible.


Thus one of $x,z$ is even , the other odd, so $y$ is odd.  We have
$$5z^2=(y-x)(y+x)\ .$$
First consider the case $x$ odd, $z$ even.  Then $y-x$ and $y+x$ are both even and
$$5\Bigl(\frac{z}{2}\Bigr)^2=\frac{y-x}{2}\frac{y+x}{2}\ .$$
The two factors on the RHS are coprime, so one of them is a square and the other is $5$ times a square.  So there are two possibilities:


*

*$(y+x)/2=5a^2$, $(y-x)/2=b^2$, so $x=5a^2-b^2$, $y=5a^2+b^2$, $z=2ab$.

*$(y-x)/2=5a^2$, $(y+x)/2=b^2$, so $x=b^2-5a^2$, $y=5a^2+b^2$, $z=2ab$.


In both of these $a,b$ must be coprime; and one is even, one odd (since $x$ is odd).  This gives positive rational solutions of the original equation as
$$\left|\frac{5a^2-b^2}{2ab}\right|\ ,\quad \frac{5a^2+b^2}{2ab}\ .$$
Similarly in the case $x$ even, $z$ odd, $y-x$ and $y+x$ are coprime; similar working leads in fact to the same formulae but with with $a,b$ both odd.  So the complete solution is as above, with $a,b$ having no common factor.  (And of course if you do allow them to have a common factor you get repetitions of the same solutions.)
A: If $x$ and $y$ are to be rational, then the factorization $(y-x)(y+x)=5$ implies $y-x=r$ and $y+x=5/r$, where $r$ can be any (nonzero) rational number, in which case we find
$$x={5-r^2\over2r}\quad\text{and}\quad y={5+r^2\over2r}$$
If $x$ and $y$ are to be integers, then the factorization requires that $r\in\{\pm1,\pm5\}$, so the only solutions are $(x,y)=(\pm2,\pm3)$.
A: Rewrite the equation as $y^2-x^2=5$, which gives $(y+x)(y-x)=5$.  
For the set $\mathbb Q$ you can replace the equation as $(y+x)(y-x)=5z^2$, and solve that for integers.  Then $\frac xz$ and $\frac yz$ are the required solutions.
Suppose we put $5z^2=720$, then we can represent this as, say, two numbers $8*90$, and $z=12$.  This leads to $y=49, x=41, z=12$.  We then have $4 \frac 1{12}$ and $3 \frac 5{12}$.
In base 12, this gives $4.1^2 = 14.81$, and $3.5^2 = E.81$, which have the required difference of 5.
That is, $(41/12)^2 + 5 = (49/12)^2$.
And this gives a proof that there are necessarily an infinite number of answers in $\mathbb Q$.
A: For a general case: $x^2+5y^2=z^2$ and $\gcd(x,y）=1$, there are 2 cases:

*

*$x$ is odd and $y$ is even:
then $x=\pm(r^2+5s^2),~y=2rs,~z=r^2+5s^2$


*$x$ is even and $y$ is odd:
then $x=\pm(2r^2+2rs-2s^2),~y=2rs+s^2,~z=2r^2+2rs+3s^2$
A: Why do you need computer/software  help for this small problem?  You are looking for two squares differing by 5. Expand $(x+1)^2$. See how much it differs from $x^2$. This would give you an idea about the difference about consecutive squares. 
