Square Modulo 8

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


 * If $x$ is even then:
 * $x^2 \equiv 0 \pmod 8$ or $x^2 \equiv 4 \pmod 8$


 * If $x$ is odd then:
 * $x^2 \equiv 1 \pmod 8$

Proof for Even Integer
Let $x \in \Z$ be even.

Then from Square Modulo 4:
 * $x^2 \equiv 0 \pmod 4$

Hence there are two possibilities for $x^2$:
 * $x^2 \equiv 0 \pmod 8$
 * $x^2 \equiv 4 \pmod 8$

The fact that there do exist such squares can be demonstrated by example:
 * $2^2 = 4 \equiv 4 \pmod 8$
 * $4^2 = 16 \equiv 0 \pmod 8$

Proof for Odd Integer
Let $x \in \Z$ be odd.

Then from Odd Square Modulo 8:
 * $x^2 \equiv 1 \pmod 8$