-4

When $b$ is prime and $a>0$ is any integer:
$$(1/a)\pmod b \equiv a^{b-2}\pmod b$$

Can somebody explain me how this equation holds true in number theory.

Someone told me that it can be proven through Euler's theorem, but how?

JMP
  • 21,771

1 Answers1

1

This looks like Fermat's little theorem: If $p$ is prime and $a$ is an integer not divisible by $p$, then $$a^{p-1} \equiv 1\pmod p.$$ Since $a$ has an inverse mod $p$, we can divide both sides of the congruence by $a$ to get $$a^{p-2}\equiv a^{-1}\pmod p.$$

Remark 1: This is your result, but with $b=p$. Also, I have written $a^{-1}$ instead of $1/a$.

Remark 2: You write that $a$ can be any integer, but you need to assume that $a$ is not divisible by $p$.

Remark 3: You refer to "Euler's theorem", but this is really Fermat's little theorem. Sometimes a generalization of this theorem is called the "Euler-Fermat theorem" or just "Euler's theorem", so that might be what was meant.

Mankind
  • 13,170