Content deleted Content added
m →Integers modulo m: Ce |
|||
(32 intermediate revisions by 15 users not shown) | |||
Line 1:
{{short description|Computation modulo a fixed integer}}
{{About|the concept that uses the "''{{mvar|a}} (mod {{mvar|m}})''" notation|the binary operation ''mod({{mvar|a,m}})'' |
{{More citations needed|date=June 2025}}
[[File:Clock group.svg|thumb|upright=1.1|right|Time-keeping on this clock uses arithmetic modulo 12. Adding 4 hours to 9 o'clock gives 1 o'clock, since 13 is congruent to 1 modulo 12.]]
In [[mathematics]], '''modular arithmetic''' is a system of [[arithmetic]] operations for [[integer]]s, other than the usual ones from elementary arithmetic, where numbers "wrap around" when reaching a certain value, called the '''modulus'''. The modern approach to modular arithmetic was developed by [[Carl Friedrich Gauss]] in his book ''[[Disquisitiones Arithmeticae]]'', published in 1801.
A familiar example of modular arithmetic is the hour hand on a [[12-hour clock]]. If the hour hand points to 7 now, then 8 hours later it will point to 3.
Similarly, if one starts at 12 and waits 8 hours, the hour hand will be at 8. If one instead waited twice as long, 16 hours, the hour hand would be on 4. This can be written as 2 × 8 ≡ 4 (mod 12). Note that after a wait of exactly 12 hours, the hour hand will always be right where it was before, so 12 acts the same as zero, thus 12 ≡ 0 (mod 12).
Line 12 ⟶ 13:
Given an [[integer]] {{math|''m'' ≥ 1}}, called a '''modulus''', two integers {{mvar|a}} and {{mvar|b}} are said to be '''congruent''' modulo {{mvar|m}}, if {{mvar|m}} is a [[divisor]] of their difference; that is, if there is an integer {{math|''k''}} such that
: {{math|1=''a'' − ''b'' = ''k m''}}.
Congruence modulo {{mvar|m}} is a [[congruence relation]], meaning that it is an [[equivalence relation]] that is compatible with
: {{math|''a'' ≡ ''b'' (mod ''m'')}}.
The parentheses mean that {{math|(mod ''m'')}} applies to the entire equation, not just to the right-hand side (here, {{mvar|b}}).
This notation is not to be confused with the notation {{math|''b'' mod ''m''}} (without parentheses), which refers to
The congruence relation may be rewritten as
: {{math|1=''a'' = ''k m'' + ''b''}},
explicitly showing its relationship with [[Euclidean division]]. However, the {{math|''b''}} here need not be the remainder in the division of {{math|''a''}} by {{math|''m''.}} Rather, {{math|''a'' ≡ ''b'' (mod ''m'')}} asserts that {{math|''a''}} and {{math|''b''}} have the same [[remainder]] when divided by {{math|''m''}}. That is,
: {{math|1=''a'' = ''p m'' + ''r''}},
: {{math|1=''b'' = ''q m'' + ''r''}},
Line 96 ⟶ 97:
It is generally easier to work with integers than sets of integers; that is, the representatives most often considered, rather than their residue classes.
Consequently, {{math|(''a'' mod ''m'')}} denotes generally the unique integer {{mvar|
In particular, {{math|1=(''a'' mod ''m'') = (''b'' mod ''m'')}} is equivalent to {{math|''a'' ≡ ''b'' (mod ''m'')}}, and this explains why "{{math|1==}}" is often used instead of "{{math|≡}}" in this context.
Line 119 ⟶ 120:
=== Reduced residue systems ===
{{main|Reduced residue system}}
Given the [[Euler's totient function]] {{math|''φ''(''m'')}}, any set of {{math|''φ''(''m'')}} integers that are [[Coprime integers|relatively prime]] to {{math|''m''}} and mutually incongruent under modulus {{math|''m''}} is called a '''reduced residue system modulo {{math|''m''}}'''.<ref>{{harvtxt|Long|1972|p=85}}</ref> The set {{math|{{mset|5, 15}}}} from above, for example, is an instance of a reduced residue system modulo 4.
Line 146 ⟶ 148:
as in the arithmetic for the 24-hour clock.
The notation <math>\mathbb{Z}/m\mathbb{Z}</math> is used because this ring is the [[quotient ring]] of <math>\mathbb{Z}</math> by the [[ideal (ring theory)|ideal]] <math>m\mathbb{Z}</math>, the set formed by all multiples of {{math|''m''}}, i.e., all numbers {{math|''k m''}} with <math>k\in\mathbb{Z}.</math>
The ring of integers modulo {{math|''m''}} is a [[field (mathematics)|field]], i.e., every nonzero element has a [[Modular multiplicative inverse|multiplicative inverse]], if and only if {{math|''m''}} is [[Prime number|prime]]
If {{math|''m'' > 1}}, <math>(\mathbb Z/m\mathbb Z)^\times</math> denotes the [[multiplicative group of integers modulo n|multiplicative group of the integers modulo {{math|''m''}}]] that are invertible. It consists of the congruence classes {{math|{{overline|''a''}}{{sub|''m''}}}}, where {{math|''a''}} [[coprime integers|is coprime]] to {{math|''m''}}; these are precisely the classes possessing a multiplicative inverse. They form an [[abelian group]] under multiplication; its order is {{math|''φ''(''m'')}}, where {{mvar|φ}} is [[Euler's totient function]].
== Applications ==
In pure mathematics, modular arithmetic is one of the foundations of [[number theory]], touching on almost every aspect of its study, and it is also used extensively in [[group theory]], [[ring theory]], [[knot theory]], and [[abstract algebra]]. In applied mathematics, it is used in [[computer algebra]], [[cryptography]], [[computer science]], [[chemistry]] and the [[visual arts|visual]] and [[music]]al arts.
A very practical application is to calculate checksums within serial number identifiers. For example, [[International Standard Book Number]] (ISBN) uses modulo 11 (for 10-digit ISBN) or modulo 10 (for 13-digit ISBN) arithmetic for error detection. Likewise, [[International Bank Account Number]]s (IBANs)
In cryptography, modular arithmetic directly underpins [[Public-key cryptography|public key]] systems such as [[RSA (algorithm)|RSA]] and [[Diffie–Hellman key exchange|Diffie–Hellman]], and provides [[finite field]]s which underlie [[elliptic curve]]s, and is used in a variety of [[symmetric key algorithm]]s including [[Advanced Encryption Standard]] (AES), [[International Data Encryption Algorithm]] (IDEA), and [[RC4]]. RSA and Diffie–Hellman use [[modular exponentiation]].
|