<s>[INST] Does $b^2 = 4a + 2$ have integer solutions? I got the following question on an exam I had today: $$b^2 = 4a+2$$
I said that it didn't since $b^2 -2$ was not a multiple of $4a$ or in other words, was not divisible by $4$. Is this correct?
 [/INST] We assume, on the contrary, that $b^2 = 4a + 2$ does indeed have integer solutions. Then, $b^2 \equiv 2 \mod 4 \implies 2$ is a quadratic residue modulo $4$.
We now aim to obtain a contradiction by proving (as demanded by the rigorous standards of mathematics) that $2$ cannot be a quadratic residue modulo $4$, i.e. $b^2 \not\equiv{2} \mod 4$ for all $b\in\mathbb{Z}$.
Note that the integer $b$ can be written as either one of $4k, 4k + 1, 4k + 2, 4k + 3$ for some $k \in \mathbb{Z}$. Taking the residues of the square of each modulo $4$, we get :
$$\begin{align}b^2 &= (4k)^2, (4k + 1)^2, (4k + 2)^2, (4k + 3)^2\\
&\equiv 0, 1^2,2^2, 3^2 \mod 4\\
&\equiv 0,1 \mod4\end{align}$$
From the above, we see that $b^2 \not\equiv{2} \mod 4$ for all $b\in\mathbb{Z}$, and hence $2$ cannot be a quadratic residue modulo 4, leading to a contradiction. Thus, there cannot be any integer solutions in $a,b$.
</s>