Show that the square of any positive integer cannot be of the form 5q + 2 or 5q + 3 for any integer q.
Let a be an arbitrary positive integer.
Then, by Euclid’s divisions Algorithm, corresponding to the positive integers a and 5, there exist non-negative integers m and r such that
$a=5 m+r$, where $0 \leq r<5$
$\Rightarrow \quad a^{2}=(5 m+r)^{2}=25 m^{2}+r^{2}+10 m r \quad\left[\because(a+b)^{2}=a^{2}+2 a b+b^{2}\right]$
$\Rightarrow \quad a^{2}=5\left(5 m^{2}+2 m r\right)+r^{2}$
where, $0 \leq r<5$
Case $1 \quad$ When $r=0$, then putting $r=0$ in Eq. (i), we get
$a^{2}=5\left(5 m^{2}\right)=5 q$
where, $q=5 m^{2}$ is an integer.
Case II When $r=1$, then putting $r=1$ is Eq. (i), we get
$a^{2}=5\left(5 m^{2}+2 m\right)+1$
$\Rightarrow \quad q=5 q+1$
where, $q=\left(5 m^{2}+2 m\right)$ is an integer.
Case III When $r=2$, then putting $r=2$ in Eq. (i), we get
$a^{2}=5\left(5 m^{2}+4 m\right)+4=5 q+4$
where, $q=\left(5 m^{2}+4 m\right)$ is an integer.
Case IV When $r=3$, then putting $r=3$ in Eq. (i), we get
$a^{2}=5\left(5 m^{2}+6 m\right)+9=5\left(5 m^{2}+6 m\right)+5+4$
$=5\left(5 m^{2}+6 m+1\right)+4=5 q+4$
where, $q=\left(5 m^{2}+6 m+1\right)$ is an integer.
Case V When $r=4$, then putting $r=4$ in Eq. (i), we get
$a^{2}=5\left(5 m^{2}+8 m\right)+16=5\left(5 m^{2}+8 m\right)+15+1$
$\Rightarrow \quad a^{2}=5\left(5 m^{2}+8 m+3\right)+1=5 q+1$
where, $q=\left(5 m^{2}+8 m+3\right)$ is an integer.
Hence, the square of any positive integer cannot be of the form 5q + 2 or 5q + 3 for any integer q.