# Integer solutions of an exponential equation

How can I solve this equation?

$$7^{x} +2=y^{2}$$

$$x$$ and $$y$$ must be natural numbers.

A general method, not necessarily best for this particular equation, is to split into three cases by writing $$x=3u+v$$ with $$v\in\{0,1,2\}$$. Then rewrite your equation as $$A(7^u)^3 + 2 = y^2\quad\text{with A\in\{1,7,49\}.}$$ So any solution to your equation gives an integer solution to one of the three equations $$w^3+2=y^2,\quad 7w^3+2=y^2,\quad49w^3+2=y^2.$$ There are then standard methods for finding integer points on these genus $$1$$ curves.
Addendum: You can use the LMFDB to finish the solution. I'll rewrite the curves using the more typical $$x,y$$ variables.
For $$y^2=x^3+2$$, we see from http://www.lmfdb.org/EllipticCurve/Q/1728/n/4 that the curve has rank $$1$$ and the only integer solutions are $$(-1,\pm1)$$, which don't result in roots for your equation.
For $$7w^3+2=y^2$$, we multiply by $$7^2$$ and change coordinates to get the elliptic curve $$y^2=x^3+98$$. Then http://www.lmfdb.org/EllipticCurve/Q/28224/dp/2 says that the rank is $$1$$, and the only integer points are $$(7,\pm21)$$, which gives the solution $$7^1+2=(\pm3)^2$$.
And for $$49w^3+2=y^2$$, we multiply by $$7^4$$ and change coordinates to get the elliptic curve $$y^2=x^3+4802$$. Then http://www.lmfdb.org/EllipticCurve/Q/84672/fl/2 tells us that this curve has rank $$0$$ and no integer points. Hence your original equation $$7^x+2=y^2$$ has only the solutions $$(x,y)=(1,\pm3)$$.
Here's a proof that the $$x=1$$ solution is unique using only facts about "Pell equations" that were already known to Fermat (if not centuries earlier to Bhaskara II et al.) and should generalize at least to $$p^x + 2 = y^2$$ for odd primes $$p$$ such that $$p+2$$ is a square. I'll simplify the formulas by using $$\sqrt 7$$ (more generally, $$\sqrt p$$).
We start by observing that $$x$$ must be odd; this can be seen in various ways, for example by reducing $$\bmod 4$$. So, $$7^x = 7 z^2$$ where $$z = 7^{(x-1)/2}$$, and we seek solutions of $$y^2 - 7 z^2 = 2$$ where $$z$$ is a power of $$7$$. Now the general solution of $$y^2 - 7z^2 = 2$$ in natural numbers $$y,z$$ is $$(y_n,z_n)$$ such that $$y_n + z_n \sqrt7 = \alpha u^n \quad (n \geq 0)$$ where $$\alpha = 3+\sqrt 7$$ and $$u$$ is the fundamental unit $$\alpha / \bar\alpha = 8 + 3\sqrt 7$$. (Note that this gives $$y_n - z_n \sqrt 7 = \alpha u^{-(n+1)}$$, so the solutions coming from $$n < 0$$ only repeat those with $$n \geq 0$$.) Now if $$x > 1$$ then $$7 \mid z$$, which happens if and only if $$7 \mid 2n+1$$. But then $$z_n$$ is a multiple of $$z_3 = 7 \cdot 617$$, and $$617$$ is not a multiple of $$7$$. Therefore $$z_n$$ is never a power of $$7$$ other than 1, QED.
(Alternatively, having found the condition $$7 \mid 2n+1$$ for $$7 \mid z_n$$, we could continue by asking when $$7^2 \mid z_n$$, $$\ 7^3 \mid z_n$$, etc., finding that $$7^e | z_n$$ if and only if $$7^e | 2n+1$$, and then $$z_n \geq z_{(7^e-1)/2}$$ which is much larger than $$7^e$$.)