Find the inverse modulo,
Modulo inverse of $5991 \pmod{2014}$ ?
I am aware of the Euclid algorithm, but I am not sure how to apply it here?
Find the inverse modulo,
Modulo inverse of $5991 \pmod{2014}$ ?
I am aware of the Euclid algorithm, but I am not sure how to apply it here?
Hints:
Try to follow, understand and justify the following steps:
$$5991=-51\pmod{2104}$$
But:
$$\begin{align}&-51=2\pmod{53}\;,\;\;2^{-1}=27\pmod{53}\\&-51=6\pmod{19}\;,\;\;6^{-1}=16\pmod{19}\end{align}$$
and thus we need a solution for
$$\begin{cases}x=27\pmod{53}\\{}\\x=16\pmod{19}\\{}\\x=1\pmod2\end{cases}$$
and the Chinese Remainder Theorem (CRT) gives us:
$$x=27\cdot38\cdot\overbrace{7}^{=38^{-1}\pmod{53}}+16\cdot106\cdot\overbrace{7}^{=106^{-1}\pmod{19}}+1\cdot1007\cdot\overbrace{1}^{=1007^{-1}\pmod2}=20061$$
so that finally
$$5991^{-1}=20061=1935\pmod{2014}$$
The (extended) Euclidean algorithm applied to $a,b$ does not only give the $\gcd(a,b)$ but also two integers $u,v$ such that $ua +vb = \gcd(a,b)$. Also, note that you can only find a modular inverse of $a \mod b$ if $\gcd(a,b)=1$.
Now, to use this to fine modular inverses proceed like this.
Perform extended Euclidean algorithm on $5991$ and $2014$.
You find $1=\gcd(5991, 2014)$ and $u,v$ such that $u\ 5991 +v\ 2014 = 1$.
So, $ u \ 5991 = 1 + v\ 2014$. And this just means $u \ 5991 \equiv 1 \mod 2014$, that is $u$ is the modular inverse you searched.
This assumes knowing how to perform the extended Euclidean algorithm to find the GCD and the couple $(u,v)$ sometimes called Bézout coefficients. For details on this algorithm see How to use the Extended Euclidean Algorithm manually?
A way to do the extended Euclidean algorithm is to start from the following two equations:
Now perform the normal Euclidean algorithm on the right and keep track of what you do on the left. As $5991 = 2\cdot 2014 + 1963$:
As $2014 = 1 \cdot 1963 + 51$:
As $1963 = 38 \cdot 51 + 25$:
As $51 = 2 \cdot 25 + 1$:
As $1$ divides $25$, we have found that $1$ is the gcd and we also have in Eq 6 that
$$5991 \cdot (-79) = 1 - 2014 \cdot (150) $$
So $5991 \cdot (-79) \equiv 1 \mod 2014$ and $-79$ is the modular inverse. If you want one between $1$ and $2013$ add $2014$ to it. Then it matches the solution in another answer.
Using Steps, 1, 2 from Mark.
– Amad27 Jan 23 '15 at 14:29$$b \equiv 1725*1935 \equiv 3337875 \pmod{2014}$$ Yikes, what can I do?
– Amad27 Jan 23 '15 at 15:41After using the Euclidean algorithm and manipulating the equations backward, you can find $a,b \in \mathbb{Z}$ such that $$a \cdot 2014 + b \cdot 5991 = 1.$$
Working modulo 2014, we see that $b$ is the inverse of 5991.
what next?
– Amad27 Jan 23 '15 at 14:28$$ \text{Step 3: } 1963 = 38(51)+25.$$
– user67953840 Jan 23 '15 at 14:31