If $n$ is an integer then $n^2$ is the same as $0$ or $1\pmod 4$? I have been stuck on this problem for awhile.
How would i go about solving it, an explanation would be helpful as well.
Show that if $n$ is an integer then $n^2 \equiv 0$ or $1 \pmod 4$?
 A: Let $k\in\mathbb Z$.
If $n=2k$, then $n^2=4k^2$.
If $n=2k-1$, then $n^2=4k^2-4k+1$.
A: HINT: An integer $n$ is either even or odd. If $n$ is even, then $n=2m$ for some integer $m$. If $n$ is odd, then $n=2m+1$ for some integer $m$. In each case express $n^2$ in terms of $m$.
A: An important and fundamental idea:
There are only four numbers mod $4$. You can try them all.
A: Did you try calculating? There are only four cases mod 4:
$n \equiv 0 \Rightarrow n^2 \equiv 0^2 \equiv 0$
$n \equiv 1 \Rightarrow n^2 \equiv 1^2 \equiv 1$
$n \equiv 2 \Rightarrow n^2 \equiv 2^2 \equiv \ ...$
$n \equiv 3 \Rightarrow \ ...$
A: Suppose $n$ is even. Then $n=2k$ for some integer $k$.
Then  $n^2 = (2k)^2 = 4k^2 \equiv 0$ (mod 4).
You can do something similar with $n$ odd
A: To prove $n^2\not\equiv 2 \mod 4$, we can see that $n$ must be even, and therefore $4|n^2$.
To prove $n^2\not\equiv 3 \mod 4$, if it is true we have $n^2-1=4k+2\to (n+1)(n-1)=4k+2$, but as $n$ is odd both $n+1$ and $n-1$ are even and so $4|(n+1)(n-1)$.
We can establish the presence of $n^2\equiv 0\mod4$ and $n ^2\equiv 1\mod4$ by examining $n=0$ and $n=1$.
