Fermat's little theorem's proof for a negative integer

Solution 1:

Use the fact that if $a^p\equiv a$ for some $a$, then this automatically also holds for every $a'$ that is congruent to $a$. From first principles, here is how it goes:

If $a$ is negative, then there is still a $k$ such that $a+kp$ is positive. Then we have $$ (a+kp)^p \equiv a+kp \pmod p $$ The right-hand side obviously equals $a$ modulo $p$. For the left-hand side, expand using the binomial theorem -- all terms except for $a^p$ include one or more factors of $p$ and are therefore $0$ modulo $p$. So the left-hand side is congruent to $a^p$ modulo $p$.