# Determine all pairs of perfect powers $2^m$, $3^n$ such that their difference is a perfect square.

Determine all pairs of perfect powers $$2^m$$, $$3^n$$ such that their difference is a perfect square.

I found these pairs work by mod 3 and mode 4:

Case 1, $$2^m \ge 3^n$$, $$(0,0), (2,1), (1,0)$$

Case 2, $$2^m \le 3^n$$, $$(0,0), (1,1), (1,3), (3, 2), (5, 4)$$

How to prove there's no others?

I also found this post: Pairs forming perfect square. There's good discussions. Do we have any complete solution?

You can solve the problem in three cases:

Case 1: $$m\ge2$$ and $$2^m>3^n$$.

Here, looking modulos $$3$$ and $$4$$ demands that $$m$$ is even and $$n$$ is odd. The problem then reduces to the form $$(2^{m/2})^2=x^2+3(3^{(n-1)/2})^2\,~\,~\,~\,~ (1)$$ for some integer $$x$$; thus we are looking at solutions to the Diophantine equation $$z^2=x^2+3y^2\,.$$ Checking modulo $$8$$ shows that the only possibility for both $$x,y$$ to be odd is when $$z^2\equiv 4\mod 8$$, which thus demands that the only solutions to Eq (1) must be $$(m,n)=(2,1)\,.$$

Case 2: $$m\ge2$$ and $$2^m<3^n$$.

Here also, looking modulos $$3$$ and $$4$$ rather demands that $$m$$ is odd and $$n$$ is even. Now, the problem reduces to the form $$(3^{n/2})^2=x^2+2(2^{(m-1)/2})^2\,~\,~\,~\,~ (2)$$ for some integer $$x$$; thus, this time, we are looking at solutions to the Diophantine equation $$z^2=x^2+2y^2\,.$$ The general solution to this equation (in the manner similar to deriving Pythagorean Triples) is given by $$z=a^2+2b^2\,,~\,~\,~\,x=a^2-2b^2\,,~\,~\,~\,~y=2ab$$ for some integers $$a,b$$. Comparing to Eq (2) forces $$a=\pm 1$$ and $$b=\pm 2^{(m-3)/2}$$, which implies that $$3^{n/2}=z=(\pm 1)^2+2(\pm 2^{(m-3)/2})^2= 1+2^{m-2}$$——that is, $$3^{n/2}-2^{m-2}=1$$——which has the only solutions $$(m,n)\in\{(3,2),(5,4)\}$$ thanks Catalan-Mihailescu’s Theorem.

Case: $$m\in\{0,1\}$$.

For $$n=0$$, we have the obvious solutions $$(m,n)\in\{0,0),(1,0)\}\,.$$ Hence suppose $$n\ge 1$$. Here, we have $$3^n-2^m=y^2$$ for some integer $$y$$, which can be rewritten as $$y^2=3^{e_n}\left(3^{(n-e_n)/3)}\right)^3-2^m\,,$$ where $$e_n\in\{0,1,2\}$$ and $$n\equiv e_n\mod 3$$,. Multiplying through by $$3^{2e_n}$$, we see that we are actually looking at integer solutions to the Mordell elliptic curve $$y^2=x^3-2^m\cdot 3^{2e_n}\,,$$ and a solution to your problem corresponds to $$x=3^{(n+2e_n)/3}$$. Mordell (1920) proved that there are only finitely many integral solutions to such elliptic curves (you can find the integer solutions listed here https://web.archive.org/web/20110618033146/http://tnt.math.se.tmu.ac.jp/simath/MORDELL/MORDELL-); in particular, for $$m=1$$ and $$e_n=0$$, it is a theorem or Fermat that the only integral solutions to the elliptic are $$(x,y)\in\{3,\pm 5\}$$, which thus gives the only solution to your problem as $$(m,n)=(1,3)\,.$$ When $$m=e_n=0$$, the only integral solution is $$(x,y)=(1,0)$$, which doesn’t correspond to a solution to your problem. For $$e_n=1$$, using the linked address above, the only integral solutions are no solutions for $$m=0$$ but $$(x,y)=(3,\pm 3)$$ for $$m=1$$, which forces the only solution to your problem in this case $$(m,n)=(1,1)\,.$$ Finally, for $$e_n=2$$, there are no integral solutions to the elliptic curve for $$m=1$$, but for $$m=0$$, the only solution is $$(x,y)=(13,46)$$, which does not correspond to a solution to your problem.

• Thanks, Jack. A few points in your solution are new to me, including the Mordell elliptic curve. Also, I was stuck at proving solutions to $3^{𝑛/2}−2^{𝑚−2}=1$, which is explainable by Catalan-Mihailescu’s Theorem. Nov 8, 2020 at 15:19
• My pleasure. Perhaps it may be helpful to remark that one does not need the full strength of the Catalan-Mihilescu’s theorem (the very special and earlier case due to Gersonides is all that is required here (as also emphasized in the answer by player3236 below); see the accepted answer here math.stackexchange.com/questions/579701/solve-equation-12x-3y for a proof). Nov 8, 2020 at 16:23

This is a partial solution concerning $$m\ne 1$$.

First we consider the cases $$m\ge 2$$.

For case 1 ($$2^m \ge 3^n$$), write $$2^m = 3^n + k^2$$.

Taking modulo $$3$$, we have $$(-1)^m \equiv k^2 \pmod 3$$. This gives $$m$$ is even.

Write $$m = 2s$$, then $$3^n = 2^m-k^2 = (2^s-k)(2^s+k)$$, and both $$2^s \pm k$$ are powers of $$3$$.

Summing them up, however, gives $$2^{s+1}$$ which is not a multiple of $$3$$. Hence $$2^s-k = 1$$.

$$2^s+k = 2^{s+1}-1$$ is a power of $$3$$. [This gives $$s=1, m=2, n=1$$.]

For case 2 ($$2^m \le 3^n$$), write $$3^n = 2^m + k^2$$.

Taking modulo $$4$$, we have $$(-1)^n\equiv k^2 \pmod 4$$. This gives $$n$$ is even.

Write $$n=2t$$, then $$2^m = 3^n-k^2 = (3^t-k)(3^t+k)$$, and both $$3^t \pm k$$ are powers of $$2$$.

If we write $$3^t-k = 2^x, 3^t+k =2^y$$, we have $$2^x+2^y = 2^x(1+2^{y-x})$$.

Summing them up, however, gives $$2 \times 3^t$$. Since $$3^t$$ is odd, we must have $$2^x=2$$ and $$1+2^{y-1} = 3^t$$.

[This equation has $$2$$ solutions: $$y=2, t=1$$ and $$y=4, t=2$$.]

Both cases above end with solving an equation of the form $$1+a^b= c^d$$, which by Catalan's Conjecture/Mihăilescu's theorem only has the solution $$a=2,b=3,c=3,d=2$$, for integers $$a,b,c,d >1$$. However there are elementary proofs for this special case $$a,c \in \{2,3\}$$, which I choose to omit (unless requested)

For the case $$m=0$$, write $$3^n = 1+k^2$$. By modulo $$3$$, no solutions exist for $$n \ge 1$$. This forces $$n=0$$.

For the case $$m=1$$, write $$3^n = 2+k^2$$. By modulo $$3$$ we have $$k^2 \equiv 1\pmod 3$$, and by modulo $$4$$ we have $$(-1)^n \equiv 2+k^2$$, forcing $$n$$ to be odd and $$k^2\equiv 1 \pmod 4$$. $$k$$ must be an odd number not divisible by $$3$$, but as of right now I am not sure how to proceed.

• Thank you. Catalan's Conjecture was exactly what I didn't know. Nov 8, 2020 at 15:21