How can you calculate modular inverses and use them to solve equations?

  • Thread starter Thread starter smoothman
  • Start date Start date
AI Thread Summary
To calculate the modular inverse of a number "a modulo n," one can use Euclid's theorem, which states that if there exists integers u and v such that ua + vn = 1, then u is the modular inverse of a. For example, with a = 29 and n = 78, the inverse is found to be 35, as 29 * 35 ≡ 1 mod 78. An algorithm exists for finding this inverse, often involving the extended Euclidean algorithm or methods related to Diophantine equations. Additionally, the Euler phi function can be used to determine the modular inverse by finding n such that a^n ≡ 1 mod n. Understanding these concepts allows for solving equations like 43x ≡ 3 mod 125 effectively.
smoothman
Messages
38
Reaction score
0
Hi is there a general formula to find the inverse modulo of "a modulo n"...
i know its denoted as a^{-1} and
a.a^{-1} = 1 mod n

for example if a=29 and n = 78 then the inverse is 35 since: 29.35 = 1 mod 78...

(a)
but HOW DO U CALCULATE THE INVERSE? is there a formula?? please help me out here?

(b)
and how can this be used to solve 43 modulo 125, hence solve 43x = 3 mod 125

thanks
 
Mathematics news on Phys.org
Well, if you unroll the definition, you have

ua = 1 (mod n)

if and only if you can find a v such that

ua + vn = 1.

Does that look familiar at all?
 
thats euclids theorem I am guessing?

could u show me how to calculate for a = 29 and n =78?
so that u get the inverse of 29 as 35??
then ill try part B and see if i can do it :) thanks
 
smoothman said:
thats euclids theorem I am guessing?
Well, if you mean what I think you mean... then doesn't Euclid's theorem come with an algorithm for doing computation?
 
yea but that's for just finding HCF...
i need to know if there's a formula for finding the inverse
you said :

"if and only if you can find a v such that
ua + vn = 1."

to do this.. do i have to manually go through all the possibilites or is there an algorithm etc? thnx :)
 
search wikipedia or google for ``diophantine equation''. There is an algorithm.
 
thnx :D just what i wanted :)
 
smoothman said:
yea but that's for just finding HCF...

It is more than that - it gives a way to express the HCF of x and y as ax+by.
 
There is another way. Using the Euler phi function, we can determine the n such that 29^n==1 Mod 78 for example. In this particular case it is 2(1-1/2)*3(1-1/3)*13(1-1/13) = 24. So that:

29^{23}\equiv\frac{1}{29} Mod 78
 
Back
Top