Understanding Multiplicative Inverse in RSA

Solution 1:

Remember that in the ordinary real numbers the multiplicative inverse of $a$, written $\frac1a$, is the number $x$ such that $a\cdot x=1$.

Here we're not working with real numbers, but with residues modulo $n$, which means (primitively speaking) that after each addition or multiplication we're supposed to reduce to one of the residues $0, 1, 2, \ldots, n-1$.

So in the integers modulo $9$, it is indeed the case that $4\cdot 7=1$ because $28$ and $1$ are the same thing when we work modulo $9$.

Since $7$ is something that makes $1$ when multiplied by $4$, it is by definition the multiplicative inverse of $4$.

Or did you ask how the author discovered that the right number to try was $7$ rather than something else? In this case, he probably just tried all of the possible numbers modulo 9 one my one until finding one that would work (there are only 9 numbers to try).

For larger moduli, the extended Euclidean algorithm can be used to find modular inverses. There's a pretty good chance that the text you're reading will explain how that works if you just read on and keep faith for a page or so. So far it's probably just explaining what "multiplicative inverse" means and how to recognize one if you come across it. Actually finding it is the logical next step.