Difference between revisions of "Modular arithmetic"

(Introductory)
 
(25 intermediate revisions by 4 users not shown)
Line 1: Line 1:
'''Modular arithmetic''' is a special type of arithmetic that involves only [[integers]].  Given integers <math>a</math>, <math>b</math>, and <math>n</math>, with <math>n > 0</math>, we say that <math>a</math> is ''congruent to'' <math>b</math> ''modulo'' <math>n</math>, or <math>a \equiv b</math> (mod <math>n</math>), if the difference <math>{a - b}</math> is divisible by <math>n</math>.
+
'''Modular arithmetic''' is a special type of arithmetic that involves only [[integers]].  Since modular arithmetic is such a broadly useful tool in [[number theory]], we divide its explanations into several levels:
 +
* [[Modular arithmetic/Introduction|Introduction to modular arithmetic]]
 +
* [[Intermediate modular arithmetic]]
 +
* [[Olympiad modular arithmetic]]
  
For a given positive integer <math>n</math>, the relation <math>a \equiv b</math> (mod <math>n</math>) is an [[equivalence relation]] on the set of integers.  This relation gives rise to an algebraic structure called '''the integers modulo <math>n</math>''' (usually known as "the integers mod <math>n</math>," or <math>\mathbb{Z}_n</math> for short).  This structure gives us a useful tool for solving a wide range of number-theoretic problems, including finding solutions to [[Diophantine equation|Diophantine equations]], testing whether certain large numbers are prime, and even some problems in cryptology.
 
  
 +
== Resources ==
 +
=== Introductory Resources ===
 +
==== Books ====
 +
* The AoPS [http://www.artofproblemsolving.com/Books/AoPS_B_Item.php?page_id=10 Introduction to Number Theory] by [[Mathew Crawford]].
 +
==== Classes ====
 +
* [http://www.artofproblemsolving.com/Classes/AoPS_C_ClassesS.php#begnum AoPS Introduction to Number Theory Course]
  
== Introductory ==
+
=== Intermediate Resources ===
=== Useful Facts ===
+
* [http://www.artofproblemsolving.com/Resources/Papers/SatoNT.pdf Number Theory Problems and Notes] by [[Naoki Sato]].
  
Consider four integers <math>{a},{b},{c},{d}</math> and a positive integer <math>{m}</math> such that <math>a\equiv b\pmod {m}</math> and <math>c\equiv d\pmod {m}</math>. In modular arithmetic, the following [[identity | identities]] hold:
+
=== Olympiad Resources ===
 
+
* [http://www.artofproblemsolving.com/Resources/Papers/SatoNT.pdf Number Theory Problems and Notes] by [[Naoki Sato]].
* Addition: <math>a+c\equiv b+d\pmod {m}</math>.
 
* Substraction: <math>a-c\equiv b-d\pmod {m}</math>.
 
* Multiplication: <math>ac\equiv bd\pmod {m}</math>.
 
* Division: <math>\frac{a}{e}\equiv \frac{b}{e}\pmod {\frac{m}{\gcd(m,e)}}</math>, where <math>e</math> is a positive integer that divides <math>{a}</math> and <math>b</math>.
 
* Exponentiation: <math>a^e\equiv b^e\pmod {m}</math> where <math>e</math> is a positive integer.
 
 
 
=== Examples ===
 
 
 
* <math>{7}\equiv {1} \pmod {2}</math>
 
 
 
* <math>49^2\equiv 7^4\equiv (1)^4\equiv 1 \pmod {6}</math>
 
 
 
* <math>7a\equiv 14\pmod {49}\implies a\equiv 2\pmod {7}</math>
 
 
 
=== Computation of Powers Mod n ===
 
 
 
The "exponentiation" property given above allows us to perform rapid calculations modulo <math>n</math>.  Consider, for example, the problem
 
 
 
''What are the tens and units digits of <math>7^{1942}</math>?''
 
 
 
We could (in theory) solve this problem by trying to compute <math>7^{1942}</math>, but this would be extremely time-consuming. Moreover, it would give us much more information than we need. Since we want only the tens and units digits of the number in question, it suffices to find the remainder when the number is divided by <math>100</math>.  In other words, all of the information we need can be found using arithmetic mod <math>100</math>.
 
 
 
By writing down the first few powers of <math>7</math>, we see that <math>7^4 = 2401 \equiv 1</math> (mod <math>100</math>). So for any positive integer <math>k</math>, we have <math>7^{4k} = (7^4)^k \equiv 1^k \equiv 1</math> (mod <math>100</math>).  In particular, we can write
 
 
 
<math>7^{1940} = 7^{4 \cdot 485} \equiv 1</math> (mod <math>100</math>).
 
 
 
By the "Multiplication" property above, then, it follows that
 
 
 
<math>7^{1942} = 7^{1940} \cdot 7^2 \equiv 1 \cdot 7^2 \equiv 49</math> (mod <math>100</math>).
 
 
 
Therefore, by the definition of congruence, <math>7^{1942}</math> differs from <math>49</math> by a multiple of <math>100</math>.  Since both integers are positive, this means that they share the same tens and units digits.  Those digits are <math>4</math> and <math>9</math>, respectively.
 
 
 
=== Applications ===
 
 
 
Modular arithmetic is an extremely useful tool in mathematics competitions. It enables us to easily solve [[Linear Diophantine equation]]s, and it often helps with other [[Diophantine equation | Diophantine equations]] as well.
 
 
 
== Intermediate ==
 
=== Topics ===
 
* [[Fermat's Little Theorem]]
 
* [[Euler's Totient Theorem]]
 
* [[Phi function]]
 
 
 
=== See also ===
 
 
 
* [[Number theory]]
 
* [[Quadratic residues]]
 
 
 
== Miscellany ==
 
 
 
=== The binary operation "mod" ===
 
 
 
Related to the concept of congruence mod <math>n</math> is the binary operation '''<math>a</math> mod <math>n</math>''', which is used often in computer programming.
 
 
 
Recall that, by the [[Division Algorithm]], given any two integers <math>a</math> and <math>n</math>, with <math>n > 0</math>, we can find integers <math>q</math> and <math>r</math>, with <math>0 \leq r < n </math>, such that <math>a = nq + r</math>.  The number <math>q</math> is called the ''quotient'', and the number <math>r</math> is called the ''remainder''.  The operation ''<math>a</math> mod <math>n</math>'' returns the value of the remainder <math>r</math>.  For example:
 
 
 
<math>15</math> mod <math>6 = 3</math>, since <math>15 = 6 \cdot 2 + 3</math>.
 
 
 
<math>35</math> mod <math>7 = 0</math>, since <math>35 = 7 \cdot 5 + 0</math>.
 
 
 
<math>-10</math> mod <math>8 = 6</math>, since <math>-10 = 8 \cdot -2 + 6</math>.
 
 
 
Observe that if <math>a</math> mod <math>n = r</math>, then we also have <math>a \equiv r</math> (mod <math>n</math>).
 

Latest revision as of 19:38, 19 July 2006

Modular arithmetic is a special type of arithmetic that involves only integers. Since modular arithmetic is such a broadly useful tool in number theory, we divide its explanations into several levels:


Resources

Introductory Resources

Books

Classes

Intermediate Resources

Olympiad Resources