TITLE: Modular Arithmetic involving fractional remainder
QUESTION [2 upvotes]: can you explain for me the arithmetic manipulation:
Let p a prime number, so
$\frac{1}{p-1}≡\frac{1}{-1}≡-1 (\text{mod}\ p)$
$\frac{1}{p-2}≡\frac{1}{-2}≡\frac{-1}{2} (\text{mod}\ p)$
$\frac{1}{p-3}≡\frac{1}{-3}≡\frac{-1}{3} (\text{mod}\ p)$
$\vdots$
$\frac{1}{p-3}≡\frac{1}{-3}≡\frac{-1}{3} (\text{mod}\ p)$
I understand that $p-k≡-k(\text{mod}\ p)$ for any natural p, but I can't figure out how to generalize for a fraction of type  $\frac{1}{p-k}≡\frac{-1}{k}(\text{mod}\ p)$. I can't understand, how can you explain it?

REPLY [1 votes]: Mod $\,n,\,$ a fraction $\,x \equiv a/b\,$ is a root of $\,bx \equiv a.\,$ It is well defined $\iff$ a root uniquely exists $\!\iff\!$ $\gcd(b,n) = 1,\,$ in which case $\,b^{-1}$ exists by Besout, so $\ a/b = ab^{-1}.$
It is easy to see that - just like for other arithmetical congruence laws -  we can replace the arguments of fractions by any congruent value.
Indeed, by said congruence laws, if $\,A\equiv a,\,B\equiv b\,$ then $\, Bx\equiv A\iff ax\equiv b,\,$ hence 
$$\begin{align}{A\equiv a\\ B\equiv B}\end{align}\ \Rightarrow\, \dfrac{A}B\equiv \dfrac{a}b$$
Note that if $\,B\equiv b\,$ then $\,\gcd(B,n) = \gcd(b,n) = 1\,$ so both fractions are well-defined, i.e. their denominators are invertible.
Thus in your example, $\ {\rm mod}\ n\!:\ n\!-\!1\equiv -1\,\Rightarrow\, \dfrac{1}{n-1}\equiv \dfrac{1}{-1}\equiv -1$
{"set_name": "stack_exchange", "score": 2, "question_id": 1882657}