so I have to prove this and I use two different types of proof and I came to a contradicting result. Can someone point out an error I made?
Using a direct proof: If 2 divides $x^2-5$ than $x^2-5=2k$ from that $x^2=2(k+2)+1$. From that we know x is odd. since x is odd x=2y+1. From that $(2y+1)^2-5=4y^2+4y-4=4(y^2+y+1)$ so the implication is true.
Using a contrapositive proof. If 4 does not divide $x^2-5$ then we have 3 cases.\ $x^2-5=4k+1$\ $x^2-5=4k+2$\ $x^2-5=4k+3$\
Looking at the second case we have $4k+2=2(2k+1)$. Therefore the implication is false as from truth we have false. What am I doing wrong? Any help would be appreciated.
It is clear that $x^2-5$ is not divisible by $2$ when it is of the form $4k-1$ or $4k-3$. So suppose $x^2-5 = 4k-2$. This quantity is certainly divisible by $2$ if there is such an integer $k$, which is why we need to do a bit more analysis to make sure something fishy isn't going on. From this we have $$x^2 = 4k+3$$ which makes $x$ odd, so let $ x= 2y+1$ to get $$\begin{align}(2y+1)^2 = 4k+3 \\ \implies 4y^2+4y+1 = 4k+3 \\ \implies 4y^2+4y = 4k+2 \\ \implies 2(y^2+y) = 2k+1\end{align}$$ Now the LHS is necessarily even while the RHS is necessarily odd, a contradiction. Hence no such integer $y$ exists, meaning no such integer $x$ exists such that $x^2-5$ can take the form $4k+2$ for any integer $k$. This is enough to complete the proof by contrapositive.