[Math] Show that $n^2 \mod 5$ equals $0,1$, or $4$ for every integer $n$.

proof-explanationproof-writing

Show that $n^2 \mod 5$ equals $0,1$, or $4$ for every integer $n$. Using divison in to cases.

Proof: let integer $n$ be given.

Case $1$: Suppose there exists an integer $k$ such that $n = 2k$

Case $2$: Suppose there exists an integer $k$ such that $n = 2k+1$

Do I have the right idea of having two cases for all integers, one that covers even numbers and one that covers odd, or am I not on the right track?

Best Answer

You should consider cases

$$n \equiv i \pmod 5$$

where $i \in \{0\,\ldots, 4\}$.