Why does $M \equiv a^{p-1}M\pmod p$ implies $a^{p-1}\equiv 1\pmod p$?

27 Views Asked by At

Why do we need that $\gcd(M,p)=1$ to say that:

$M \equiv a^{p-1}M\pmod p$ implies $a^{p-1}\equiv 1\pmod p$?

2

There are 2 best solutions below

4
On BEST ANSWER

Otherwise, $p\mid M$. Then the assertion $M\equiv a^{p-1}M\pmod p$ would be true for any $a$. And if this assertion is always true, you can't deduce that $a^{p-1}\equiv1\pmod p$ happens sometimes.

0
On

Otherwise, $p \mid M$, so cancellation of $M \equiv 0 \pmod 0$ on both sides is not legitimate under $\pmod p$. In fact, you have

$$M - a^{p-1}M = M (1 - a^{p-1}),$$

which is divisible by $p$ for whatever $a$, so you can't conclude anything about $a^{p-1} \pmod p$.