Okay so I am reading up on RSA, trying to understand how it works, and I come across this
$ x∈ℤ_p, x^{−1} ∈ ℤ_p ⟺ \gcd(x,p) = 1$
Now it then gives an example, as follows:
Let's work in the set $ℤ_9$, then $4∈ℤ_9$ and $\gcd(4,9)=1$. Therefore 4 has a multiplicative inverse (written $4^{-1}$) in $ℤ_9$, which is 7. And indeed, $4⋅7=28 \equiv 1\pmod9.$
Now I do not understand how one can simply say the inverse is 7.
Essentially my question is, where has this come from?
Apologies if I am being stupid
Thanks for the help, sorry I do not know how to format properly!
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.