I am having difficulty finishing this proof. At first, the proof is easy enough. Here's what I have thus far:
Because $5 \nmid n$, we know $\exists q \in \mathbb{Z}$ such that $$n = 5q + r$$ where $0 < r < 4$. Note $r \neq 0$ because if $r = 0$, then $5 \mid n$. Also note that $n^2 = 25q^2 + 10qr + r^2$. Then we have four cases: when $r=1$, $r=2$, $r = 3$, and $r = 4$. This is where I run into difficulty. In each of these cases, we can prove that either $n^2 = 5k + 1$ or $n^2 = 5k - 1$ for some integer $k$, but I cannot see how to prove both for each case. Any ideas?
As a side note on how I went to prove each case, I simply plugged $r$ into the formula $n^2 = 25q^2 + 10qr + r^2$. This results in $n^2 = 25q^2 + 10q + 1$. Continuing, we get $n^2 = 5(5q^2 + 2q) + 1$, and because $5q^2 + 2q$ is still an integer, this is of the form $n^2 = 5k + 1$ for some integer $k$. But I cannot find how to make the 1 a negative to prove both cases.