Fermat's Little Theorem: $r \equiv s \pmod {p-1} \implies a^r \equiv a^s \pmod p$

342 Views Asked by At

An implication of Fermat's Little Theorem is the following:

If $p$ is prime, and $a$ is not a multiple of $p$, then $$r \equiv s \pmod {p-1} \implies a^r \equiv a^s \pmod p.$$

I need this implication to prove the verification of the Elgamal signature, but I honestly do not see how to derive from Fermat's Little Theorem to this implication and I could not find any proof of this.

Any help would be much appreciated!

2

There are 2 best solutions below

1
On BEST ANSWER

Assume without loss of generality that $r\geq s$, so $r=s+k(p-1)$ for some $k\geq 0$. Then $a^r=a^sa^{k(p-1)}$. Can you see how to get from here to what you want?

2
On

There is a more universal Theorem to get it.
The Theorem lies in 《elementary number thoery 6th》 Theorem 9.2.
It can be used to prove the verification of the Elgamal signature and DSA.
DSA is a much more popular variant of the Elgamal signature.

Theorem 9.2 If $a$ and $n$ are relative prime integers with $n>0$,then $a^i \equiv a^j \pmod n$,where i and j are nonnegative integers, if and only if $i \equiv j \pmod {ord_n^a}$

Specially, when $p$ is a prime integer, ${ord_p^a}=\varphi(p)=p-1$ , so we get the result:
Corollary If $a$ and $p$ are relative prime integers, and $p$ is a prime integer,then $a^i \equiv a^j \pmod p$,where i and j are nonnegative integers, if and only if $i \equiv j \pmod {p-1}$

hence:

$$i \equiv j \pmod {p-1} \Leftrightarrow a^i \equiv a^j \pmod p.$$

That is the answer.