Difference between revisions of "Modular arithmetic/Intermediate"
(added see also section) |
(began resources section) |
||
Line 142: | Line 142: | ||
Let <math>A=\frac{k_2-k_1}{c_i}</math> then <math>d_i - f_i =</math> '''7A mod 7 = 0 mod 7''' for all <math>(d_i,f_i)</math>, QED. | Let <math>A=\frac{k_2-k_1}{c_i}</math> then <math>d_i - f_i =</math> '''7A mod 7 = 0 mod 7''' for all <math>(d_i,f_i)</math>, QED. | ||
+ | |||
+ | |||
+ | |||
+ | == Resources == | ||
+ | * [http://www.artofproblemsolving.com/Resources/Papers/SatoNT.pdf Number Theory Problems and Notes] by [[Naoki Sato]]. | ||
+ | |||
Revision as of 16:43, 28 June 2006
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
[hide]Arithmetic Modulo n
Useful Facts
Consider four integers and a positive integer
such that
and
. In modular arithmetic, the following identities hold:
- Addition:
.
- Subtraction:
.
- Multiplication:
.
- Division:
, where
is a positive integer that divides
and
.
- Exponentiation:
where
is a positive integer.
For examples, see Introduction to modular arithmetic.
Algebraic Properties of the Integers Mod n
The integers modulo form an algebraic structure called a ring -- a structure in which we can add, subtract, and multiply elements.
Anyone who has taken a high school algebra class is familiar with several examples of rings, including the ring of integers, the ring of rational numbers, and the ring of real numbers. The ring has some algebraic features that make it quite different from the more familiar rings listed above.
First of all, notice that if we choose a nonzero element of
, and add
copies of this element, we get
,
since is a multiple of
. So it is possible to add several copies of a nonzero element of
and get zero. This phenomenon, which is called torsion, does not occur in the reals, the rationals, or the integers.
Another curious feature of is that a polynomial over
can have a number of roots greater than its degree. Consider, for example, the polynomial congruence
.
We might be tempted to solve this congruence by factoring the expression on the left:
.
Indeed, this factorization yields two solutions to the congruence: , and
. (Note that two values of
that are congruent modulo
are considered the same solution.)
However, since , the original congruence is equivalent to
.
This time, factoring the expression on the left yields
.
And we find that there are two more solutions! The values and
both solve the congruence. So our congruence has at least four solutions -- two more than we might expect based on the degree of the polynomial.
Why do the "rules" of algebra that work so well for the real numbers seem to fail in ? To understand this, let's take a closer look at the congruence
.
If we were solving this as an equation over the reals, we would immediately conclude that either must be zero, or
must be zero in order for the product to equal zero. However, this is not the case in
! It is possible to multiply two nonzero elements of
and get zero. For example, we have
But wait! Suppose we take a close look at this last product, and we set and
. Then we have
-- another of the solutions of our congruence! (One can check that the other two factorizations don't lead to any valid solutions; however, there are many other factorizations of zero that need to be checked.)
In the ring of real numbers, it is a well-known fact that if , then
or
. For this reason, we call the ring of real numbers a domain. However, a similar fact does not apply in general in
; therefore,
is not in general a domain.
Topics
The following topics expand on the flexible nature of modular arithmetic as a problem solving tool:
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
).
An example exercise with modular arithmetic:
Problem:
Let
be a nine-digit positive integer (each digit not necessarily distinct). Consider
,
another nine-digit positive integer with the property that each digit ei when substituted for di makes the modified D divisible by 7. Let
be a third nine-digit positive integer with the same relation to E as E has to D.
Prove that every is divisible by 7.
Solution:
Any positive integer can be expressed
.
Since 10=3 mod 7, and since it holds that if a=b mod c then mod c, then D can be expressed much more simply mod 7; that is,
= x mod 7.
Each number in E must make the modified D equal 0 mod 7, so for each ,
, where c is the coefficient of
and k is an element of {-2,-1,0,1,2}. The patient reader should feel free to verify that this makes D = 0 mod 7.
In terms of terms, then, we find each
.
Then mod 7 can be expressed
mod 7 = (9x)- x = 8x = x mod 7.
(note that the 7s, which do not change the mod value, have been eliminated).
Each number in F must make the modified E equal 0 mod 7, so for each ,
.
By design and selection of k, all are integers, and
is always an integer because it is the difference of two integers.
is a member of the set {1, 2, 3}. Since no
divides 7, 7 may be factored and
is the product of two integers.
Let then
7A mod 7 = 0 mod 7 for all
, QED.
Resources