Modular Multiplicative Inverse
Suppose for an integer there exists integer such that , then is called multiplicative inverse
of . Same idea can be extended to modular arithmetic as well.
Definition
For an integer , under modulo , multiplicative inverse of is defined as :-
Formally, if you have two integers and , is said to be modular multiplicative inverse
of under modulo if it satisfies the following equation:
Modular Division
To perform modular division, we usually start by finding modular multiplicative inverse
of divisor as explained below in equation
- =
Modular multiplicative inverse lies in range if it exists
Existence of Modular Multiplicative Inverse
Modular multiplicative inverse of under modulo exists, iff
i.e and are co-prime
Proof using Bézout's Identity
:
If and are coprime, by Bézout's identity: There exist integers and such that:
Rearranging the equation:
is the modular multiplicative inverse of modulo Because when we divide both sides by , we get a remainder of 1
The converse:
If a modular multiplicative inverse exists:
This means for some integer . Upon rearranging equation we get
must divide
This proves both necessity and sufficiency - MMI exists iff and are coprime.
Example:
For and
Using Extended Euclidean Algorithm:
Therefore, is the modular multiplicative inverse of modulo
We can verify: