Difference between revisions of "Modular arithmetic"
(→Introductory) |
(→Computation of Powers Mod n) |
||
Line 35: | Line 35: | ||
<math>7^{1940} = 7^{4 \cdot 485} \equiv 1</math> (mod <math>100</math>). | <math>7^{1940} = 7^{4 \cdot 485} \equiv 1</math> (mod <math>100</math>). | ||
− | By the " | + | 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>). | <math>7^{1942} = 7^{1940} \cdot 7^2 \equiv 1 \cdot 7^2 \equiv 49</math> (mod <math>100</math>). |
Revision as of 20:04, 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
Computation of Powers Mod n
The "exponentiation" property given above allows us to perform rapid calculations modulo . Consider, for example, the problem
What are the tens and units digits of ?
We could (in theory) solve this problem by trying to compute , 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 . In other words, all of the information we need can be found using arithmetic mod .
By writing down the first few powers of , we see that (mod ). So for any positive integer , we have (mod ). In particular, we can write
(mod ).
By the "multiplication" property above, then, it follows that
(mod ).
Therefore, by the definition of congruence, differs from by a multiple of . Since both integers are positive, this means that they share the same tens and units digits. Those digits are and , respectively.
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 ).