## Solving the diophantine equation x^3=y^2+2

This will be a post illustrating how unique factorization in the ring $\mathbb{Z}[\sqrt{-2}]=\{a+b\sqrt{-2}: a, b\in\mathbb{Z}\}$ helps us solve the diophantine equation $x^3=y^2+2$. We first start by proving

Lemma: The ring $\mathbb{Z}[\sqrt{-2}]$ is a UFD.

Proof. Define $N(a+b\sqrt{-2})=a^2+2b^2$. The identity

$(a^2+2b^2)(c^2+2d^2)=(ac-2bd)^2+2(ad+bc)^2$

proves that

$N(a+b\sqrt{-2})N(c+d\sqrt{-2})=N((a+b\sqrt{-2})(c+d\sqrt{-2}))$

So $N$ is a multiplicative function. We claim that $N$ is a Euclidean norm on $\mathbb{Z}[\sqrt{-2}]$. Let $\alpha, \beta\in \mathbb{Z}[\sqrt{-2}]$ with $\beta\neq 0$. We need to show that there exist elements $q, r\in \mathbb{Z}[\sqrt{-2}]$ such that $\alpha=q\beta + r$ where $N(r). Now $\alpha/\beta\in\mathbb{Q}[\sqrt{-2}]$, so we can write $\alpha/\beta=x+y\sqrt{-2}$ where $x, y\in\mathbb{Q}$. Let $m, n$ be the closest integers to $x$ and $y$, respectively. Let $q=m+n\sqrt{-2}\in\mathbb{Z}[\sqrt{-2}]$. Since $|x-m|\leq 1/2$ and $|y-n|\leq 1/2$, it follows that

$N(\alpha/\beta - q)= N((x-m)+(y-n)\sqrt{-2})=(x-m)^2+2(y-n)^2\leq \dfrac{3}{4}$

Set $r=\alpha-q\beta \in\mathbb{Z}[\sqrt{-2}]$. Then $\alpha=q\beta+r$ and

$\displaystyle N(r)=N(\alpha-q\beta)=N\left(\frac{\alpha}{\beta}-q\right) \cdot N(\beta) \leq \frac{3}{4} N(\beta)

as desired.

Let’s turn our attention in solving the equation $x^3=y^2+2$ in integers $x$ and $y$. Suppose $x, y\in\mathbb{Z}$ satisfy $x^3=y^2+2$. First, $x$ cannot be even because then $y^2+2\equiv (\text{mod } 4)$ which is impossible. So $x$ must be odd, and as a result $y$ is also odd. Now we have the factorization $x^3=(y+\sqrt{-2})(y-\sqrt{-2})$ in $\mathbb{Z}[\sqrt{-2}]$. We first show that $y+\sqrt{-2}$ and $y-\sqrt{-2}$ are relatively prime. Suppose $\gamma\in\mathbb{Z}[\sqrt{-2}]$ divides both $y+\sqrt{-2}$ and $y-\sqrt{-2}$. Then $\gamma$ divides their difference $2\sqrt{-2}=-(\sqrt{-2})^3$. If $\gamma$ is not a unit, then $\sqrt{-2}$ would divide $\gamma$. This is because $\sqrt{-2}$ is prime: indeed, if $\sqrt{-2}=\alpha\beta$, then from $N(\sqrt{-2})=2$, we see that $N(\alpha)=1$ or $N(\beta)=1$; so either $\alpha$ or $\beta$ is a unit; i.e $\sqrt{-2}$ is irreducible and hence prime because we are in a UFD. But if $\sqrt{-2}$ divides $\gamma$, then $\sqrt{-2}$ divides $y+\sqrt{-2}$ and so $\sqrt{-2}$ divides $y$. But this means $y=\sqrt{-2}(k+r\sqrt{-2})=-2r + k\sqrt{-2}$, i.e. $k=0$ and $y=-2r$. But then $y$ would be even, contradiction. We conclude that $\gamma$ is a unit.

So $y+\sqrt{-2}$ and $y-\sqrt{-2}$ are relatively prime. So if $p$ is any prime that divides $x$, then $p^3$ divides $x^3 = (y+\sqrt{-2})(y-\sqrt{-2})$. So $p^3$ divides either $y+\sqrt{-2}$ or $y-\sqrt{-2}$. Hence, $y+\sqrt{-2}$ must be of the form $u h^3$ for some $h\in\mathbb{Z}[\sqrt{-2}]$ where $u$ is a unit. Since the only units in $\mathbb{Z}[\sqrt{-2}]$ are $\pm 1$ (units correspond to $N(u)=1$) which are already cubes, we can absorb them into $h^3$ term. So write $h=a+b\sqrt{-2}$ for some $a, b\in\mathbb{Z}$. Then we get

$y+\sqrt{-2} = (a+b\sqrt{-2})^3 = a^3-6ab^2+(3a^2b-2b^3)\sqrt{-2}$

As a result, $y=a(a^2-6b^2)$ and $1=b(3a^2-2b^2)$. We deduce that $b=\pm 1$. This gives $3a^2-2=\pm 1$. Clearly $3a^2-2=-1$ doesn’t give any solution in integers; so $3a^2-2=1$ and consequently, $a=\pm 1$. So $y=a(a^2-6b^2)=\pm 5$. Now $x^{3}=y^2+2$ gives $x=3$. Therefore, $(x, y)=(3, \pm 5)$ are the only solutions in integers.