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?