# Why is this statement a corollary of Fermat's little theorem?

I know that if $p$ prime and $p\nmid a$, then $a^{p-1}\equiv 1\pmod p$ and I know also that $a^{p}\equiv a \pmod p$ using the fact $a\equiv a \pmod p$ and multiplying the members.

What I couldn't understand is why in the Fermat little theorem we have $a^{p}\equiv a \pmod p$ for all integer $a$.

• I don't understand your question properly. May 1 '14 at 5:40
• If $p$ divides $a$ then both $a^p$ and $a$ are congruent to $0$. May 1 '14 at 5:42
• @AndréNicolas of course!!! thanks May 1 '14 at 5:43
• You already know the result for coprime p and a. If $p|a$ , $a^p\equiv 0\pmod p$ and since $0\equiv a\pmod p$, and the claim follows. May 1 '14 at 5:44
• @user42912: You are welcome. Sometimes "too easy" can be hard to see, we look for something fancy. May 1 '14 at 5:46

If $p$ divides $a$ then both $a^p$ and $a$ are congruent to $0$, so $a^p\equiv a\pmod{p}$ holds trivially.

Remark: From $a^p\equiv a\pmod{p}$, we can conversely derive the more common form of Fermat's Theorem. For if $a^p\equiv a\pmod p$, then $p$ divides $a(a^{p-1}-1)$. So if $p$ does not divide $a$, then $p$ divides $a^{p-1}-1$.

Either $p$ divides $a$ or $p\nmid a$

As $p$ is prime $p\nmid a\implies (a,p)=1$

As $\displaystyle a^p-a=a(a^{p-1}-1)$

This will be divisible by $p$ if $p|a$

otherwise it will also be divisible by $p$ as $p|(a^{p-1}-1)$ by Fermat little theorem

Following the comments of André Nicholas:

If $p\mid a$, then $a\equiv 0 \pmod p$, then multiplying $p$ times both sides we have $a^p\equiv 0 \pmod p$. Thus we have $a\equiv 0 \pmod p$ and $0\equiv a^p\pmod p$ by symmetry, then finally by transitivity:

$$a\equiv a^p \pmod p$$