Exercise 11. Find all integers $z \in \mathbb{Z}$ such that

$$
2^{z}+2=r^{2}
$$

where $r \in \mathbb{Q}$ is a rational number.

A rational number is a number that can be written in the form $\frac{a}{b}$ with $a, b$ integers and $b \neq 0$.
Solution to Exercise 11 Note that if $(z, r)$ is a solution pair, $(z, -r)$ is also a solution pair. We can therefore assume for the rest that $r \geqslant 0$. Given that $2^{z}+z>0$, we even have $r>0$. We set $\mathrm{r}=\frac{\mathrm{a}}{\mathrm{b}}$, with $\mathrm{a}$ and $\mathrm{b}$ being strictly positive integers and coprime.

If $z \geqslant 0$, then $2^{z}+2$ is an integer, so $\mathrm{r}$ is an integer and $\mathrm{b}=1$. We must now solve the equation $2^{z}+2=a^{2}$ in the positive integers. If $z \geqslant 2$, then the equation viewed modulo 4 gives $a^{2} \equiv 2 \bmod 4$ which has no solution since a square is always congruent to 0 or 1 modulo 4. We deduce that $z=0$ or $z=1$. In the first case, we get $3=a^{2}$ which has no integer solution. In the second case, we find $4=a^{2}$, so $a=2$. Conversely, the pairs $(1,-2)$ and $(1,2)$ do indeed satisfy the equation.

If $z<0$. The equation becomes $\frac{1}{2^{z^{\prime}}}+2=\frac{\mathrm{a}^{2}}{\mathrm{~b}^{2}}$. By eliminating the denominators, we get

$$
b^{2}\left(1+2^{z^{\prime}+1}\right)=a^{2} \cdot 2^{z^{\prime}}
$$

Since $1+2^{z^{\prime}+1}$ is coprime with $2^{z^{\prime}}$, by Gauss's lemma, we get that $2^{z^{\prime}+1}+1$ divides $a^{2}$. Since $a$ and $b$ are coprime, by Gauss's lemma, we also get that $a^{2}$ divides $1+2^{z^{\prime}+1}$. We deduce that $a^{2}=2^{z^{\prime}+1}+1$, which we rewrite as $2^{z^{\prime}+1}=(a-1)(a+1)$. We deduce that $a+1$ and $a-1$ are both powers of 2 whose difference is 2. We therefore deduce that $a+1=4$ and $a-1=2$, so $\mathrm{a}=3$ and $z^{\prime}=2$. Thus $b=2$. Conversely, the pairs $\left(-2,-\frac{3}{2}\right)$ and $\left(-2, \frac{3}{2}\right)$ are indeed solutions to the equation. The solutions are therefore $\left\{\left(-2,-\frac{3}{2}\right),\left(-2, \frac{3}{2}\right),(1,-2),(1,2)\right\}$.

Graders' Comments

One third of the students wrote that $x^{2}=4$ implies $x=2$ and thus forgot the solution $x=-2$. Some students did not see that we were working in $\mathbb{Z}$ and $\mathbb{Q}$ and only looked at the equation over the positive integers. Apart from that, the exercise was quite well done.