[Math] Tricks for Find Modular Inverses

modular arithmetic

I know that you can apply Euclid's Extended Algorithm, but I was wondering if there were "tricks" for guessing modular inverses. For example, if you have something like $ 13 \pmod{25}$ then you easily just guess $2$. But if you have something like $37 \pmod{12*18}$ is there a good way? I considered $6$, because 36 is one less than 37 and is a factor of 12*18, but that (obviously) gives $6$ not $1$. So are there other "tricks" for guessing modular inverses?

Best Answer

No guessing is needed. Both are easy using Gauss's algorithm

$\qquad{\rm mod}\ 25\!:\ \ \ \dfrac{1}{13}\equiv \dfrac{2}{26}\equiv \dfrac{2}1$

$\qquad {\rm mod}\ 216\!:\ \dfrac{1}{37}\equiv \dfrac{5}{185}\equiv \dfrac{5}{-31}\equiv\dfrac{35}{-217}\equiv\dfrac{35}{-1}$

You can find many more examples (and other methods) in prior posts. Note that Gauss's algorithm won't always work for composite moduli, and you must keep all denominators coprime to the modulus (that's why I chose $5$ vs. $6$ in the 2nd example). See the linked posts for further details.