Calculating Modular Multiplicative Inverse for negative values of a.

Solution 1:

Hint: $ $ like sums & products, inverses too are preserved on replacing argument(s) by a congruent one

Congruence Inverse Law $\ \color{#c00}{\bar a\equiv a}\,\Rightarrow\,{\bar a}^{-1}\equiv a^{-1}\,$ if $\ a\,$ is invertible, i.e. $\, ab\equiv 1\,$ for some $b$.

Proof $\ $ Notice $\,\ \color{c00}ab\equiv 1\ \Rightarrow\ \color{#c00}{\bar a} b\equiv \color{#c00}ab\equiv 1\,$ by applying the Congruence Product Rule. Therefore we conclude that $\, {\bar a}^{-1}\!\equiv b\equiv a^{-1}\,$ by Uniqueness of Inverses.

Solution 2:

Yes of course since

$$a\equiv a+ka =a' \mod k$$

we have that $a$ and $a'$ have the same unique modular inverse $a^{-1}$ when it exists, indeed

$$a^{-1}\cdot a\equiv 1\mod k \iff a^{-1}\cdot a+a^{-1}\cdot ka\equiv 1\mod k$$

$$\iff a^{-1}\cdot (a+ka)\equiv 1\mod k\iff a^{-1}\cdot a'\equiv 1\mod k$$