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

I’m in the process of proving Fermat’s little theorem.

For a prime integers $p$ we have $a^p \equiv a \mod{p}$

I proved it for a non-negative $a$, not I need to generalize the case to an arbitrary $a \in \mathbb{Z}$. That is, I need to prove that give a negative integer $a$ we have $a^p \equiv a \mod{p}$ using the fact that it is so for a non-negative $a$.

#### Solutions Collecting From Web of "Fermat's little theorem's proof for a negative integer"

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$.