- #36
Curious3141
Homework Helper
- 2,862
- 88
Pranav-Arora said:Thanks once again ehild!
I still don't understand how you get
6-1=5 (mod29) and what does this mean "5*6=30=1+29 "?
That's based on the definition of multiplicative modular inverse. Remember that if [itex]ax \equiv 1 \pmod n[/itex] such that [itex]0 < x < n[/itex], then x is defined as the multiplicative modular inverse of a modulo n. x is only defined if (a,n) = 1, which is a fancy way of saying the greatest common divisor of a and n is 1, which is another way of saying that a and n are coprime.
The notation for the modular inverse is [itex]a^{-1}[/itex], so here you can write: [itex]x \equiv a^{-1} \pmod n[/itex].
So, in this particular case, [itex]5 \equiv 6^{-1} \pmod {29}[/itex] because [itex](5)(6) = 30 \equiv 1 \pmod {29}[/itex], which is what ehild was highlighting.
Only two numbers give "self inverses": 1 and (n-1). This is easy to see if you solve [itex]a \equiv a^{-1} \pmod n[/itex]. Multiply both sides by a (remember this is OK, because a and n are coprime, therefore you are not multiplying by zero). So you get: [itex]a^2 \equiv 1 \pmod n[/itex], which has solutions of [itex]a \equiv \pm 1 \pmod n[/itex], so a can be 1 or (n-1).
If we suppose, x is the number we need to find here in this: 6-1=x (mod 29), how should i go on finding that?
The method to actually go about finding the inverse (when it's not trivial as discussed above) is called Euclid's algorithm. It can be implemented simply by using the "magic box" method mentioned in the wiki article on the first page. There's a cool online implementation of this algorithm that shows the steps, and here it is: http://www.cs.princeton.edu/~dsri/modular-inversion.html
Last edited by a moderator: