Friday, October 21, 2016

elementary number theory - Calculating Modular Multiplicative Inverse for negative values of a.



If I'm calculating a11(modn) where a is negative. Do I simply add kn to a until 0<a<n?



I'm currently using the extended euclidean algorithm to calculate my modular multiplicative inverses since I already have to make sure that a and n are coprime. From what little number theory I understand a=a+kn is going to give me the same result as a(modn). So that should mean that a1(modn) is the same as a1(modn)



I've confirmed this with a few values below but don't know if I'm understanding this properly.




a=36a=14



9=361(mod25)



9=141(mod25)



a=11a=15



7=111(mod26)




7=151(mod26)



Here's a link to my python code.
https://paste.debian.net/1117624/


Answer



Hint: like sums & products, inverses too are preserved on replacing argument(s) by a congruent one



Congruence Inverse Law
 aaa1a1 if  a is invertible, i.e. ab1 for some b.




Proof   Notice  ab1  abab1 by the Congruence Product Rule, therefore we conclude a1ba1 by Uniqueness of Inverses.


No comments:

Post a Comment

analysis - Injection, making bijection

I have injection f:AB and I want to get bijection. Can I just resting codomain to f(A)? I know that every function i...