TITLE: Solutions of $x^3 + (x+4)^2 = y^2$
QUESTION [5 upvotes]: I want to solve the above equation in integers. I'm pretty sure the only solutions are $(x,y) = (0, \pm 4)$ but I'm not sure how to prove it.

REPLY [5 votes]: When $x=0$, $y^2 = 4^2$ and hence $y=\pm 4$. Thus $(x,y) = (0,\pm 4)$ are solutions. We will show there are no other solutions.
Suppose that $x \neq 0$. We have \begin{align}
 x^3 = y^2 - (x+4)^2 = (y+x+4)(y-x-4) 
 \end{align} Let $d$ be the greatest common divisor of $y+x+4$ and $y-x-4$. We claim that $d$ is a power of 2. If $d$ has an odd prime factor $p > 1$, then clearly, $p$ divides $x^3$ and hence $x$. Also since $p$ divides both $y+x+4$ and $y-x-4$, it divides their sum, $2y$ and since $p$ is odd, $p$ divides $y$. But then $p$ must divide 4, a contradiction. 
Thus $d = 2^k$ for some $k \geq 0$.Suppose that $k=0$. That is, $y+x+4$ and $y-x-4$ are coprime. Then, there exists integers $m,n$ such that $y+x+4 = m^3$ and $y-x-4=n^3$. We have $x=mn$ and $2x+8 = m^3-n^3$. Clearly, $m,n$ are both odd and hence $|m-n| \geq 2$. 
Case 1 $x=mn > 0$, $m >  n$
    $$2mn+8 = m^3-n^3 = (m-n)((m-n)^2+3mn) \geq 6mn$$ and hence $mn \leq 2$. Since $m,n$ are both odd integers, it follows that $mn \geq 3$. Thus no solutions in this case.
Case 2 $x = mn >0$, $m < n$
We have $$2mn+8 = (m-n)^3 + 3(m-n)mn \leq -8-6mn $$
    This gives $mn \leq -2$, a contradiction to the assumption $mn > 0$.
Case 3 $x = mn <0$, $m > n$
We have $2mn + 8 = m^3 - n^3 > 0$ and hence $mn > -4$. Since $m,n$ are odd integers, the possibilities are $mn = -1, -3$. Thus $m = 1, n=-1$ or $m=3, n=-3$. Putting $m=1, n=-1$, we get $-1 + 27 = y^2$, and $y $ is not an integer. For $m=3, n=-1$, we have $-27+1 = y^2$ again an impossibility.
Case 4 $x = mn < 0$, $m < n$
Here, $m < 0$ and $n > 0$.
    $$2mn + 8 = m^3 - n^3 < -m^2 - n^2$$ giving $m^2+n^2+2mn = (m+n)^2 < -8$, an impossibility.
Suppose that $d = 2^k$ and $k >0$. Since $2^{2k}$ divides $x^3$, it follows that $k$ must be a multiple of $3$. We need to discuss two cases: $k > 3$ and $k=3$. Suppose that $k > 3$. Then, $2^6 | x$. But $2^6 | (y+x+4) - (y-x-4) = 2x+8$. This implies $2^6$ divides 8, a contradiction. 
Suppose that $k=3$. Then $y+x+4 = 8a, y-x-4 = 8b$ where $a,b$ are coprime.
 We have $x^3 = 64ab$ and hence both $a,b$ must be cubes of integers. Let $a =m^3, b=n^3$. Note that both $m,n$ are odd integers. Also $x=4mn$ and $2x+8 = 8(m^3-n^3)$. Thus $mn+1 = m^3-n^3$ and since $m, n$ are both odd integers, $|m-n| \geq 2$. If $mn > 0$, then $m >n$ and $mn+1 = (m-n)((m-n)^2 + 3mn) \geq 6mn$ and we get $5mn \leq 1$, a contradiction. If $mn < 0$, two cases arise:
$m < 0, \, n > 0$: $2mn + 1 < mn+1 = m^3 - n^3 \leq  -m^2 - n^2$ giving $m^2+n^2+ 2mn \leq -1$, an impossibility. 
$m > 0,\, n < 0$: $mn+1 = m^3 - n^3 > 0$ and $mn > -1$. Since $mn < 0$ and $m, n$ are integers, this is impossible.  
Thus the only solutions of the given equation are $x=0, y=\pm 4$.