Prove if $5 \nmid n$, then $n^2 = 5k \pm 1$ 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.
 A: As you showed, $n^2=25q^2+10qr+r^2$, where $r=1, 2, 3,$ or $4$.
When $r=1$, $n^2=25q^2+10qr+1=5(5q^2+2qr)+1=5k+1.$
When $r=2$, $n^2=25q^2+10qr+4=5(5q^2+2qr+1)-1=5k-1.$
When $r=3$, $n^2=25q^2+10qr+9=5(5q^2+2qr+2)-1=5k-1.$
When $r=4$, $n^2=25q^2+10qr+16=5(5q^3+2qr+3)+1=5k+1.$
(Note:  I did not mean to imply that $k$ in one equation is the same as $k$ in another.)
A: Just do it.
$n^2 = 25q^2 + 10qr + r^2 = 5(5q^2 + 2qr) + r^2$.
ANd $r^2 = 1,4=5-1, 9 =10-1$ or $16=15+1$.
So if $n = 5q + 1$ then $n^2 = 5(5q^2 + 2q) + 1$
If $n=5q+2$ then $n^2 = 5(5q^2 + 4q)+4 = 5(5q^2+4q + 1) -1$
If $n = 5q+3$ then $n^2= 5(5q^2 + 6q) + 9 = 5(5q^2 + 6q + 2) -1$
And if $n = 5q+4$ then $n^2 = 5(q^2 + 8q) + 16=5(5q^2 + 8q + 3) + 1$.
That's it.
A: To keep things concise I have stretched the notation a bit, but I think my meaning is clear:
In the language of congruence, 
$5 \not \mid n \Longrightarrow n \not \equiv 0 \mod 5; \tag 1$
then one of the following holds:
$n \equiv 1, 2, 3, 4 \mod 5, \tag 2$
whence
$n^2 \equiv 1, 4, 9, 16 \mod 5 \equiv 1, 4, 4, 1 \mod 5; \tag 3$
but 
$4 \equiv -1 \mod 5, \tag 4$
so
$n^2 \equiv \pm 1 \mod 5 \Longrightarrow n^2 \pm 1 \equiv 0 \mod 5$
$\Longrightarrow \exists k \in \Bbb Z, \; n^2 \pm 1 = 5k \Longrightarrow \exists k \in \Bbb Z, \;n^2 = 5k \pm 1. \tag 5$
