Correct method for finding the multiplicative inverse of an element in $\mathbb{Z}/n\mathbb{Z}$

38 Views Asked by At

I have found two different methods for finding the multiplicative inverse of a number modulo $n$ in $\mathbb{Z}/n\mathbb{Z}$.

One is using the Extended Euclidean Algorithm, which produces a different result to the much faster approach below.

Say I am trying to find the multiplicative inverse of the value $5$ in $\mathbb{Z}/8\mathbb{Z}$.

$$\begin{split} 5x &= 1+8n\\ x &= \frac{1 + 8n}{5}\\ \end{split}$$

Then find the smallest value of $n$ that makes $x$ an integer. In this case, $n=3$ which produces an inverse value of $5$.

Is this a correct method?

1

There are 1 best solutions below

0
On

Yes, that works. However, for large values of $8$ it will be MUCH slower than the Euclidean algorithm.