Difference between revisions of "Modular arithmetic"
Line 37: | Line 37: | ||
* [[Number theory]] | * [[Number theory]] | ||
* [[Quadratic residues]] | * [[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>). |
Revision as of 14:05, 24 June 2006
Modular arithmetic is a special type of arithmetic that involves only integers. Given integers , , and , with , we say that is congruent to modulo , or (mod ), if the difference is divisible by .
For a given positive integer , the relation (mod ) is an equivalence relation on the set of integers. This relation gives rise to an algebraic structure called the integers modulo (usually known as "the integers mod ," or for short). This structure gives us a useful tool for solving a wide range of number-theoretic problems, including finding solutions to Diophantine equations, testing whether certain large numbers are prime, and even some problems in cryptology.
Contents
Introductory
Useful Facts
Consider four integers and a positive integer such that and . In modular arithmetic, the following identities hold:
- Addition: .
- Substraction: .
- Multiplication: .
- Division: , where is a positive integer that divides and .
- Exponentiation: where is a positive integer.
Examples
Applications
Modular arithmetic is an extremely useful tool in mathematics competitions. It enables us to easily solve Linear Diophantine equations, and it often helps with other Diophantine equations as well.
Intermediate
Topics
See also
Miscellany
The binary operation "mod"
Related to the concept of congruence mod is the binary operation mod , which is used often in computer programming.
Recall that, by the Division Algorithm, given any two integers and , with , we can find integers and , with , such that . The number is called the quotient, and the number is called the remainder. The operation mod returns the value of the remainder . For example:
mod , since .
mod , since .
mod , since .
Observe that if mod , then we also have (mod ).