# Suppose that $p$ is prime. If $a$ and $b$ are integers for which $a^p \equiv b^p \pmod{p}$, then how do I prove that $a \equiv b \pmod{p}$.

I saw the explanation of it here using Fermat's Little Theorem but I do not get how I can go from $a^p \equiv a \equiv b^p \equiv b \pmod{p}$ because of transitivity (I guess I want to ask what is transitivity too?)

P.S. and just to make sure $a^p \equiv a \pmod{p}$ means when you divide ($a^p$) with $a$, the remainder will be $p$ right?

• $a^p = a~ (~mod~ p)$ actually means the remainder of $a^p$ when divided by $p$ is $a.$ – kodlu Apr 7 '15 at 0:42

By Fermat's, you have $a^{p} \equiv a$ mod p and $b^{p} \equiv b$ mod p , if $a^{p} \equiv b^{p}$ then $a \equiv a^{p} \equiv b^{p} \equiv b$ mod p , so $a \equiv b$ mod p. (Transitivity of the congruence relation means that if $a \equiv b$ and $b \equiv c$ then $a \equiv c$ modulo some integer n)