Square Modulo 4

Theorem
Let $$x \in \Z$$ be an integer.


 * If $$x$$ is even then $$x^2 \equiv 0 \pmod 4$$.
 * If $$x$$ is odd then $$x^2 \equiv 1 \pmod 4$$.

Proof

 * Let $$x \in \Z$$ be even.

Then $$\exists n \in \Z: x = 2 n$$.

Hence $$x^2 = \left({2n}\right)^2 = 4 n^2 \equiv 0 \pmod 4$$.


 * Let $$x \in \Z$$ be odd.

Then $$\exists n \in \Z: x = 2 n + 1$$.

Hence $$x^2 = \left({2n + 1}\right)^2 = 4 n^2 + 4n + 1 \equiv 1 \pmod 4$$.