What will be the remainder when $2^{31}$ is divided by $5$? The question is given in the title:

Find the remainder when $2^{31}$ is divided by $5$.

My friend explained me this way:

$2^2$ gives $-1$ remainder.
So, any power of $2^2$ will give $-1$ remainder.
So, $2^{30}$ gives $-1$ remainder.
So, $2^{30}\times 2$ or $2^{31}$ gives $3$ remainder.

Now, I cannot understand how he said the last line. So, please explain this line.
Also, how can I do this using modular congruency?

From Fermat's Little Theorem-
$a^{p-1}\equiv1\pmod p$
Putting $a=2$ and $p=5$ we have,
$2^4\equiv 1\pmod 5$
$\implies 2^{28}\equiv 1\pmod 5$
Now,$2^{31}=2^{28}\times 2^{3}$.So,it is equivalent to finding the remainder when $2^3$ is divided by $5$..which is $3$.So,the remainder when $2^{31}$ is divided by $5$ is $3$..
