Rotor (mathematics): Difference between revisions

From formulasearchengine
Jump to navigation Jump to search
en>Maschen
add diagram
en>David Eppstein
unstub
 
Line 1: Line 1:
{{Refimprove|date=March 2007}}
Nice to meet you, I am Marvella Shryock. For years he's been living in North Dakota and his family loves it. For years I've been operating as a payroll clerk. Body developing is what my family members and I enjoy.<br><br>Here is my weblog ... over the counter std test - [http://www.adosphere.com/member/28512/blog/view/66112/ find more information],
In [[modular arithmetic]], the '''modular multiplicative inverse''' of an [[integer]] ''a'' [[modular arithmetic|modulo]] ''m'' is an integer ''x'' such that
 
:<math>a\,x \equiv 1 \pmod{m}.</math>
 
That is, it is the [[multiplicative inverse]] in the [[Ring (mathematics)|ring]] of integers modulo ''m'', denoted <math>\mathbb{Z}_m</math>.
 
Once defined, ''x'' maybe noted <math>a^{-1}</math>, where the fact that the inversion is m-modular is implicit.
 
The multiplicative inverse of ''a'' modulo ''m'' exists [[Iff|if and only if]] ''a'' and ''m'' are [[coprime]] (i.e., if {{nowrap|1=[[Greatest common divisor|gcd]](''a'', ''m'') = 1}}). If the modular multiplicative inverse of ''a'' modulo ''m'' exists, the operation of [[Division (mathematics)|division]] by ''a'' modulo ''m'' can be defined as multiplying by the inverse, which is in essence the same concept as division in the [[field (mathematics)|field]] of reals.
 
==Example==
 
Suppose we wish to find modular multiplicative inverse ''x'' of 3 modulo 11.
 
:<math>3^{-1} \equiv x \pmod{11}</math>
 
This is the same as finding ''x'' such that
 
:<math>3x \equiv 1 \pmod{11}</math>
 
Working in <math>\mathbb{Z}_{11}</math> we find one value of ''x'' that satisfies this congruence is 4 because
 
:<math>3 (4) = 12 \equiv 1 \pmod{11}</math>
 
and there are no other values of ''x'' in <math>\mathbb{Z}_{11}</math> that satisfy this congruence. Therefore, the modular multiplicative inverse of 3 modulo 11 is 4.  
 
Once we have found the inverse of 3 in <math>\mathbb{Z}_{11}</math>, we can find other values of ''x'' in <math>\mathbb{Z}</math> that also satisfy the congruence. They may be found by adding multiples of {{nowrap|1=''m'' = ''11''}} to the found inverse. Generalizing, all possible ''x'' for this example can be formed from
 
:<math>4 + (11 \cdot z ), z \in \mathbb{Z}</math>
 
yielding  {..., −18, −7, '''4''', 15, 26, ...}.
 
==Computation==
===Extended Euclidean algorithm===
{{wikibooks|Algorithm Implementation|Mathematics/Extended Euclidean algorithm|Extended Euclidean algorithm}}
The modular multiplicative inverse of ''a'' modulo ''m'' can be found with the [[extended Euclidean algorithm]]. The algorithm finds solutions to [[Bézout's identity]]
 
:<math>ax + by = \gcd(a, b)\,</math>
 
where ''a'' and ''b'' are given and&nbsp;''x'',&nbsp;''y'' and gcd(''a'',&nbsp;''b'') are the integers that the algorithm discovers. So, since the modular multiplicative inverse is the solution to
 
:<math>ax \equiv 1 \pmod{m},</math>
 
by the definition of congruence, {{nowrap|''m'' {{pipe}} ''ax'' − 1}}, which means that m is a [[divisor]] of {{nowrap|''ax'' − 1}}. This, in turn, means that
 
:<math>ax - 1 = qm.\,</math>
 
Rearranging produces
 
:<math>ax - qm = 1,\,</math>
 
with ''a'' and ''m'' given, ''x'' the inverse, and ''q'' an integer multiple that will be discarded. This is the exact form of equation that the extended Euclidean algorithm solves—the only difference being that {{nowrap|1=gcd(''a'', ''m'') = 1}} is predetermined instead of discovered. Thus, ''a'' needs to be [[coprime]] to the modulus, or the inverse won't exist.
 
This algorithm runs in time O(log(''m'')<sup>2</sup>), assuming {{nowrap|{{abs|''a''}} < ''m''}}, and is generally more efficient than exponentiation.
 
===Using Euler's theorem===
 
As an alternative to the extended Euclidean algorithm, Euler's theorem may be used to compute modular inverse:<ref>Thomas Koshy. [http://books.google.com/books?id=d5Z5I3gnFh0C&pg=PA346 Elementary number theory with applications], 2nd edition. ISBN 978-0-12-372487-8. P. 346.</ref>
 
According to [[Euler's theorem]], if ''a'' is [[coprime]] to ''m'', that is, {{nowrap|1=[[Greatest common divisor|gcd]](''a'', ''m'') = 1}}, then
 
:<math>a^{\varphi(m)} \equiv 1 \pmod{m}</math>
 
where φ(''m'') is [[Euler's totient function]]. This follows from the fact that ''a'' belongs to the [[multiplicative group of integers modulo n|multiplicative group]] ('''Z'''/''m'''''Z''')<sup>×</sup> [[if and only if|iff]] ''a'' is [[coprime]] to ''m''. Therefore the modular multiplicative inverse can be found directly:
 
:<math>a^{\varphi(m)-1} \equiv a^{-1} \pmod{m}</math>
 
In the special case when ''m'' is a prime, the modular inverse is given by the below equation as:
: <math>a^{-1} \equiv a^{m-2} \pmod{m}</math>
 
This method is generally slower than the extended Euclidean algorithm, but is sometimes used when an implementation for modular exponentiation is already available. Some disadvantages of this method include:
*The value ''φ''(''m'') must be known, whose most efficient computation requires ''m''<nowiki/>'s [[factorization]]. Factorization is widely believed to be a computationally hard problem.  However, calculating ''φ''(''m'') is straightforward when the prime factorisation of ''m'' is known.
*The relative cost of exponentiation. Though it can be implemented more efficiently using [[modular exponentiation]], when large values of ''m'' are involved this is most efficiently computed with the [[Montgomery reduction]] method. This algorithm itself requires a modular inverse mod ''m'', which is what was to be calculated in the first place. Without the Montgomery method, we're left with standard [[binary exponentiation]] which requires division mod ''m'' at every step, a slow operation when ''m'' is large. Furthermore, any kind of modular exponentiation is a taxing operation with computational complexity {{nowrap|1=[[Big O notation|O]]([[logarithm|log]] ''φ''(''m'')) = O(log ''m'')}}.
 
==Applications==
The modular multiplicative inverse has many applications in algorithms, particularly those related to number theory, since many such algorithms rely heavily on the theory of modular arithmetic. As a simple example, consider the ''exact division problem'' where you have a list of odd word-sized numbers each divisible by ''k'' and you wish to divide them all by ''k''. One solution is as follows:
# Use the extended Euclidean algorithm to compute ''k''<sup>−1</sup>, the modular multiplicative inverse of ''k'' mod 2<sup>''w''</sup>, where ''w'' is the number of bits in a word. This inverse will exist since the numbers are odd and the modulus has no odd factors.
# For each number in the list, multiply it by ''k''<sup>−1</sup> and take the least significant word of the result.
 
On many machines, particularly those without hardware support for division, division is a slower operation than multiplication, so this approach can yield a considerable speedup. The first step is relatively slow but only needs to be done once.
 
==See also==
* [[Inversive congruential generator]]
* [[Modular arithmetic]]
* [[Number theory]]
* [[Public-key cryptography]]
* [[Rational reconstruction (mathematics)]]
 
==References==
{{reflist}}
*{{MathWorld |title=Modular Inverse |id=ModularInverse}}
 
{{DEFAULTSORT:Modular Multiplicative Inverse}}
[[Category:Modular arithmetic]]

Latest revision as of 18:53, 5 May 2014

Nice to meet you, I am Marvella Shryock. For years he's been living in North Dakota and his family loves it. For years I've been operating as a payroll clerk. Body developing is what my family members and I enjoy.

Here is my weblog ... over the counter std test - find more information,