Modular Division

 


Modular Division

Modular division is a mathematical operation that involves dividing two integers under a specified modulus. It’s particularly useful in number theory, cryptography, and computer science. The goal is to find the remainder of the division (modulo) of one number by another.

Definition

Given three positive integers: a,b, and m, we want to compute a/b under modulo m. In other words, we seek to find a number c such that:

(bc)modm=amodm

When Is Modular Division Defined?
1.Inverse Existence:
  • Modular division is defined when the inverse of the divisor exists.
  • The inverse of an integer x is another integer y such that (xy)modm=1, where m is the modulus.
  • In other words, x and m must be co-prime (i.e., their greatest common divisor is 1).

2.Finding the Inverse:

  • To compute modular division, we need to find the modular multiplicative inverse of b under modulus m.
  • If the inverse doesn’t exist (i.e., GCD(b, m) is not 1), then modular division is not defined.

How to Find Modular Division?

Check for Inverse Existence:
First, check if the inverse of  b under modulus m exists.
If the inverse doesn’t exist (i.e., GCD(b, m) is not 1), then print “Division not defined.”

Compute the Result:
If the inverse exists, compute the result as: 
Result of division=(inversea)modm

Example:
Let a=8,b=3 and m=5. Compute (83mod5)

Inverse Existence:
The GCD of 3 and 5 is 1, so the inverse exists.

Compute the Result:
The inverse of 3 under modulo 5 is 2 (since (32mod5=1)).
The result of division is (82)mod5=1.

Therefore, the solution is 831mod5

Remember that modular division behaves differently from ordinary division
Note: Inverse can be computed easily by using the Extended Euclid Algorithm

Example: University Question
Solve the congruence 17x3(mod29)

x=171.3(mod29)
x=12.3(mod29)
x=36(mod29)
x=7

Python Code 
from sympy import mod_inverse
print(mod_inverse(17,29))
12

Comments

Popular posts from this blog

Number Theory CST 292 KTU IV Semester Honors Course Notes Dr Binu V P 9847390760

Sum of Squares

Well Ordering Principle