Could not understand modular inverse

Could not understand how modular inverse is working. Please help me.

Do you want to understand the code working of the modulo inverse function or the theory as to what is modulo inverse?

both. But first of all theory.


You will also get to know efficient methods to find modulo inverse