The square of an integer is congruent to 0 or 1 mod 4 This is a question from the free Harvard online abstract algebra lectures.  I'm posting my solutions here to get some feedback on them.  For a fuller explanation, see this post.
This problem is from assignment 6.  The notes from this lecture can be found here.

a) Prove that the square $a^2$ of an integer $a$ is congruent to 0 or 1 modulo 4.
  b) What are the possible values of $a^2$ modulo 8?

a) Let $a$ be an integer. Then $a=4q+r, 0\leq r<4$ with $\bar{a}=\bar{r}$.  Then we have $a^2=a\cdot a=(4q+r)^2=16q^2+8qr+r^2=4(4q^2+2qr)+r^2, 0\leq r^2<4$ with $\bar{a^2}=\bar{r^2}$.  So then the possible values for $r$ with $r^2<4$ are 0,1.  Then $\bar{a^2}=\bar{0}$ or $\bar{1}$.
b) Let $a$ be an integer. Then $a=8q+r, 0\leq r<8$ with $\bar{a}=\bar{r}$.  Then we have $a^2=a\cdot a=(8q+r)^2=64q^2+16qr+r^2=8(8q^2+2qr)+r^2, 0\leq r^2<8$ with $\bar{a^2}=\bar{r^2}$.  So then the possible values for $r$ with $r^2<8$ are 0,1,and 2.  Then $\bar{a^2}=\bar{0}$, $\bar{1}$ or $\bar{4}$.
Again, I welcome any critique of my reasoning and/or my style as well as alternative solutions to the problem.
Thanks.

Hint $ $ Division $\rm\Rightarrow n = 4q\! +\! r,\ r\in \{0\ 1\ 2\ 3\}\Rightarrow n^2 = (4q\!+\!r)^2 =$ $\rm\: 4(4q^2\!+\!2qr)\!+\!r^2 = $ $\rm\:4Q\! +\! \color{#c00}{r^2}.\,$ For the  remainder of $\rm\,r^2\,$  note: $\,\rm r\in \{0\ 1\ 2\ 3\}$ $\rm\Rightarrow\, \color{#c00}{r^2 = \,4 \bar q + \bar r},\ \bar r\in \{0\ 1\},\,$  so $\rm \, n^2 = 4Q\!+\!\color{#c00}{4\bar q + \bar r}$
It's simpler in modular language $\rm\ mod\ 4\!:\ n\equiv r\ \Rightarrow\ n^2 \equiv r^2\equiv \{0\ 1\ 2\ 3\}^2\equiv \{0\ 1\ \color{#c00}4\ \color{#0a0}9\}\equiv  \{\color{#c00}0\ \color{#0a0}1\}\, $ by applying Congruence Product Rule, or working in the quotient / residue ring $\rm\ \mathbb Z/4\, =\, \mathbb Z\ mod\ 4.$
Optimization: work is halved employing a balanced residue system, e.g. $\rm\: \pm \{0\ 1\ 2\ 3\ 4\}\ mod\ 8.\ $  Using that we quickly compute $\rm\ mod\ 8\!:\ odd^2\equiv \{ 1 \ 3\}^2 \equiv 1,\ \: even^2 \equiv \{0\ 2\ 4\}^2 \equiv \{0\  4\}.$
Or we can halve the cases using  $\ \rm n\equiv r\pmod{\!2m}\Rightarrow n^2\equiv r^2\pmod{\!4m}\,$ by here.
