Thursday 29 March 2018

modular arithmetic - Find the inverse modulo of a number - got a negative result



I'm trying to find the inverse modulo of $17\pmod{3120}$



I've tried:



$$
\begin{eqnarray}
3120 =& 17\cdot 183 &+ 9\\
17 =& 9\cdot 1 &+ 8\\

9 =& 8\cdot 1 &+ 1\\
8 =& 8\cdot1
\end{eqnarray}
$$



and then do it from the the bottom:



$$
\begin{align}
1 = & 9 - 8\cdot1 \\

= & 9 - (17 - 9\cdot1)\\
= & 9\cdot2 - 17\cdot1\\
= & 2 (3120 - 17\cdot183) -17\cdot1\\
= & 3120\cdot2 -17\cdot367
\end{align}
$$
This means that $-367$ is the inverse modulo. Is it the correct result? Can a reverse modulo be negative? Using this website it gives the inverse modulo to be $2753$ instead, how can I get that?


Answer



You have obtained the correct answer. Note that
$$-367 \equiv (3120-367) \pmod{3120} \equiv 2753 \pmod{3120}$$

In general, if you do not like negative modulo, you can always make it into a positive one. If you have $-a \pmod{n}$, where $a \in \{1,2,\ldots,n\}$, then you can make it into a positive one as follows.
$$-a \pmod{n} \equiv (n-a) \pmod{n}$$


No comments:

Post a Comment

real analysis - How to find $lim_{hrightarrow 0}frac{sin(ha)}{h}$

How to find $\lim_{h\rightarrow 0}\frac{\sin(ha)}{h}$ without lhopital rule? I know when I use lhopital I easy get $$ \lim_{h\rightarrow 0}...