Hello, I already read the wikipedia page about it and couldn’t understand much of it. I know that the modular multiplicative inverse of an integer a mod m will be an integer x such that a.x mod m = 1 but other than that I can’t understand anything else like how to use it and when to use it. It can be really helpful to know this subject so I would really appreciate an explanation or a good source for one other than the wikipedia page.
3 Likes
If m is a prime number (read : 10^9 + 7) then (a / b) % m = (a % m * b^(m - 2) % m) % m
For proof look up little Fermat’s theorem.
Also note that (a / b) % m =/= (a % m / (b % m)) % m, otherwise there would be no need for modular inverse.
5 Likes
So basically modular inverse is used to calculate (a/b)%m…
Thanks, the answer was short but enlightening…