Upload
buituyen
View
231
Download
0
Embed Size (px)
Citation preview
Lecture #2. Euclid’s algorithm. Congruences.
Definition (MNZ Def. 1.2) For b, c P Z (b � 0 or c � 0),pb, cq = gcdpb, cq :� the greatest common divisor of b and c .
Similarly for b1, b2, . . . , bn P Z (at least one � 0),
pb1, b2, . . . , bnq = gcdpb1, b2, . . . , bnq :� the greatest commondivisor of b1, b2, . . . , bn.
CAUTION: As you know, “pb1, . . . , bnq” sometimes just refersto “the n-tuple of integers b1, . . . , bn”, and not to their gcd. Itshould be clear from the context which is meant.
1
Ex: p10, 15q � 5 � p10,�15q � p�10,�15q.
Ex: p1000, 700q � 100
Ex:
�
25 � 310 � 54, 27 � 38 � 72
�
� 25 � 38.
Ex: If a �±
p pαppq and b �
±
p pβppq, then
gcdpa, bq �±
p pminpαppq,βppqq.
More generally, if b1, . . . , bn P N, bj �±
p pβjppq, then
gcdpb1, b2, . . . , bnq �±
p pminpβ1ppq,...,βnppqq.
2
Also define:rb1, b2, . . . , bns = lcmpb1, b2, . . . , bnq :� the least common multiple
of b1, b2, . . . , bn.
Note that if bj �±
p pβjppq then
lcmpb1, b2, . . . , bnq �±
p pmaxpβ1ppq,...,βnppqq.
3
Theorem 1 (MNZ Thm. 1.3):
If g � gcdpb, cq then Dx0, y0 P Z such that g � bx0 � cy0.
Proof. (We follow the proof in MNZ.) Set
I � tbx � cy : x, y P Zu.
Note 0 P I and I X Z� � H (since b � 0 or c � 0).
Set
ℓ � minpI X Z�q.
We will prove that ℓ � g � gcdpb, cq! (Then we are done!)
Take x0, y0 P Z so that ℓ � bx0 � cy0.
4
Div algo ñ Dq, r P Z such that b � ℓq � r , 0 ¤ r ℓ.
Then r � b � ℓq � b � pbx0 � cy0qq P I. Hence r � 0, by thedefinition of ℓ.
Hence b � ℓq, i.e. we have proved that ℓ | b. (*)
By symmetry we also have ℓ | c . (**)
Also g | ℓ, since ℓ � bx0 � cy0 and g | b and g | c .
Hence g ¤ ℓ. (***)
Together, (*) and (**) and (***) imply g � ℓ � bx0 � cy0,QED! �
5
Remark The set
I � tbx � cy : x, y P Zu
which appears in the above proof is an ideal in Z, i.e. it satisfies
(1) �s, t P I: s � t P I and (2) �r P Z, s P I: r s P I.
In fact it follows easily from the above proof that
I � gZ � tgx : x P Zu
(Cf. LL pp. 2–4 and/or KF Sec. 4.)
6
Theorem 2 (MNZ Thm. 1.4):
gcdpb, cq � min
�
tbx � cy : x, y P Zu X Z�
�
�
the positive common divisor of b and c which isdivisible by every common divisor of b and c
�
.
“Proof”: Clear/easy from Theorem 1!
7
Theorem 3 (MNZ Thms 1.6-10):
(a) For m P Z
�: pma,mbq � mpa, bq.
(b) If d P Z� and d | a and d | b, then
�a
d,b
d
�
1
d
pa, bq.
(b’) If d � pa, bq then
�a
d,b
d
� 1.
(c) If pa,mq � pb,mq � 1 then pab,mq � 1.(d) If c | ab and pb, cq � 1 then c | a.(e) For x P Z: pa, bq � pa, b � axq.
— Part of our “toolbox”!
— Proof: “easy” from Theorems 1 and 2...
— Note that Theorem 3(d) implies Key Lemma of Lecture #1:
If p, a, b P Z and p | ab and p is a prime, then p | a or p | b.
This completes the proof of the Fundamental Theorem ofArithmetic (i.e. Theorem 1.3, about unique prime factorization)!
8
— On the other hand: Note that if we assume unique primefactorization, then Theorem 3 is “immediate”!
Definition (MNZ Def 1.3): We say that a and b are relativelyprime if pa, bq � 1.
Similarly for an n-tuple of integers b1, . . . , bn, we say that b1, . . . , bnare relatively prime if pb1, . . . , bnq � 1. A stronger property is tosay that b1, . . . , bn are pairwise relatively prime; this means that
pbi , bjq � 1 for all 1 ¤ i j ¤ n.
9
Next, how to compute gcdpb, cq?
— Theorem 3(e), pa, bq � pa, b � axq , is a good tool!
Ex:
p1105, 117q � p1105� 9 � 117, 117q � p52, 117q �
� p52, 117� 2 � 52q � p52, 13q � 13.
— Note that by following the above computation backwards, onecan also compute integers x, y such that 1105x � 117y � 13.
10
Theorem 4 (Euclid’s Algorithm):
Given b, c P Z�, use the division algorithm to obtain
b � cq1 � r1 0 r1 c
c � r1q2 � r2 0 r2 r1r1 � r2q2 � r3 0 r3 r2
� � � � � �
rj�2 � rj�1qj � rj 0 rj rj�1rj�1 � rjqj�1.
Then gcdpb, cq � rj .
(Special case: If “j � 0”, i.e. r1 � 0, then gcdpb, cq � c .)
x0, y0 P Z giving gcdpb, cq � bx0 � cy0 can be obtained bysuccessively expressing r1, r2, . . . , rj as linear combinations of b, c .
Proof: Clear using pa, bq � pa, b � axq (=Theorem 3(e)).The process ends since r1 ¡ r2 ¡ � � � ¡ 0.
11
Ex: gcdp1105, 117q � 13, as we computed above via
1105 � 117 � 9� 52
117 � 52 � 2� 13
52 � 13 � 4.
Hence gcdp1105, 117q � 13 � 117� 2 � 52
� 117� 2p1105� 9 � 117q � p�2q � 1105� 19 � 117.
Thus: we have 13 � 1105x0 � 117y0 for x0 � �2, y0 � 19.
(Other examples: MNZ pp. 12–15, LL p. 6.)
Remark: j 3 log c in Theorem 4 (cf. MNZ p. 15).
12
Congruences.
Definition: Let m P Z
� and a, b P Z.
We say a � b pmod mq if m | a � b.
Same thing:
am
� b,
a � bpmq,
“a is congruent to b mod m”.
13
Theorem 5 (MNZ Thm. 2.1 + more!):
Let m P Z
� and a, b, c, d P Z. Then:
(1) am
� b � bm
� a � a � bm
� 0.
(2)
�
am
� b and bm
� c
�
ñ am
� c.
(3) am
� a
(4) the relationm
� is an equivalence relation on Z.
(5)
�
am
� b and cm
� d�
ñ a � cm
� b � d.
(6)
�
am
� b and cm
� d�
ñ acm
� bd.
(7)
�
a � b pmod mq and d | m, d ¡ 0
�
ñ a � b pmod dq.(8)
�
a � b pmod mq and c ¡ 0�
ñ ac � bc pmod mcq.
14
Definition: For m P Z
� and a P Z we write
a :�
b P Z : bm
� a
(
= the residue class of a.
(Note that m is implicit in this notation; KF calls the same thing“Rmpaq”.)
Also:
Zm :� the set of residue classes pmod mq.
Ex: Modulo 3 we have
0 �
. . . ,�6,�3, 0, 3, 6, . . .
(
1 �
. . . ,�5,�2, 1, 4, 7, . . .
(
2 �
. . . ,�4,�1, 2, 5, 8, . . .
(
,
and
Z3 �
0, 1, 2
(
.
15
Ex/fact: For a general m P Z
�, we have
Zm �
0, 1, 2, . . . ,m � 1
(
�
1, 2, 3, . . . ,m
(
,
and here for each 0 ¤ r m we have that r equals the set ofall integers which give remainder r when divided by m (using theDivision Algorithm, Thm. 1.2).
Definition The operations � and � on residue classes: For fixedm P Z
�, we define the operations � and � in Zm by:
a � b :� a � b p�a, b P Zq;
a � b :� a � b p�a, b P Zq;
and also
�a :� �a and a � b :� a � b.
These operations are well-defined since, by Theorem 5(5),(6):
�
am
� b and cm
� d
�
ñ a � cm
� b � d , and
�
am
� b and cm
� d
�
ñ acm
� bd.
16
Ex: In Z8, 1� 3 � 4 � 9� 27 � 36, which is ok!
Remark (extracurricular): xZm,�, �y is a ring, cf. KF §3 and §5.
A large part of the course is about computing in Zm, solvingequations in Zm, and interesting facts and formulas in Zm whichdon’t have a counterpart in Z or R!
Ex: For a, b, x,m P Z with m ¡ 0, we have
a � x � b pmod mq � a � x � am
� b � a� xm
� b � a
Thus we have solved the equation a � x � b pmod mq !
17
Ex: ax � 1 pmod mq?
For m � 3;
the multiplication table of Z3:
� 0 1 2
0 0 0 0
1 0 1 2
2 0 2 1
ñ
�
ax � 1 pmod 3q�
has a solution x iff a � 1 or 2 pmod 3q.
18
For m � 4;
the multiplication table of Z4:
� 0 1 2 3
0 0 0 0 0
1 0 1 2 3
2 0 2 0 2
3 0 3 2 1
ñ
�
ax � 1 pmod 4q�
has a solution x iff a � 1 or 3 pmod 4q.
19
Theorem 6 (MNZ Thm 2.9): Let a P Z, m P Z
�. The equationax � 1 pmod mq has a solution x pmod mq iff pa,mq � 1. Whenthis holds, the solution is unique mod m.
Def: Z�m � ta : a P Z, gcdpa,mq � 1u.
(Here note that pa,mq only depends on a P Zm; namely if a, a
1
are any two integers with a � a1 then pa,mq � pa1,mq.)
Def: We say that α P Zm is invertible if α P Z
�
m. For α P Z
�
m
we write α�1 for the unique solution to αx � 1.
(Note α�1 P Z�m.) (Cf. LL Def. 4.11 “relatively prime”, andKF Sec. 6.)
Note: α, β P Z�m ñ
�
αβ P Z�m and pαβq�1 � α�1β�1
�
.
Hence Z�m is a group. (Cf. MNZ 2.10-11; this is extracurricular.)
20
Proof of Theorem 6:
If pa,mq � 1 then Dx, y P Z such that ax �my � 1;
thus ax � 1 pmod mq.
Conversely, if ax � 1 pmod mq then Dy P Z such that
ax �my � 1; thus pa,mq � 1 by Theorem 2.
Finally, if ax1 � ax2 � 1 pmod mq, then
x1 a
loomoon
�1
x1 � x1 a
loomoon
�1
x2 pmod mq,
and so
x1 � x2 pmod mq.
Done! �
21
Ex: Solve the congruence equation 103x � 1 pmod 143q.
Solution: Is p103, 143q � 1? Compute using Euclid’s algorithm!
143 � 103 � 1� 40
103 � 40 � 2� 23
40 � 23 � 1� 17
23 � 17 � 1� 6
17 � 6 � 2� 5
6 � 5 � 1� 1
Hence YES, p103, 143q � 1.
22
Now use the above to find x, y P Z with 103x � 143y � 1:
1 � 6� 5
� 6� p17� 2 � 6q � p�1q � 17� 3 � 6� p�1q � 17� 3 � p23� 17q � 3 � 23� 4 � 17
� 3 � 23� 4 � p40� 23q � �4 � 40� 7 � 23
� �4 � 40� 7 � p103� 2 � 40q � �18 � 40� 7 � 103
� 7 � 103� 18 � p143� 103q � �18 � 143� 25 � 103.
We have proved that p103, 143q � 1, and found that
103x � 143y � 1 holds with x � �18 and y � 25.
Hence 103 � p�18q � 1 pmod 143q, and by Theorem 6,
x � �18 pmod 143q is the unique solution to the equation
�
103x � 1 pmod 143q�
.
Answer: The unique solution is x � �18 pmod 143q
(or equivalently, x � 125 pmod 143q).23
Finally, a result about how to “divide both sides with a” whensolving a congruence equation:
Theorem 7 (MNZ Thm. 2.3, LL Prop. 4.5):
Let a, x, y P Z, m P Z
�. Then
ax � ay pmod mq � x � y
�
modm
pm, aq
.
In particular, if pa,mq � 1, then
ax � ay pmod mq � x � y pmod mq.
Ex: 21x � 21y pmod 35q � x � y pmod 5q.
15x � 15y pmod 10q � x � y pmod 2q.
24
Proof of Theorem 7: First note that the second statement isindeed a special case of the first statement.
(One may also note that the second statement can be proveddirectly – using Theorem 6 – by “multiplying the equation witha�1”.)
We now prove the first statement in Theorem 7.
First assume ax � ay pmod mq.
Then ax � ay � mz for some z P Z.
Hencea
pa,mqpx � y q �
m
pa,mqz , and so
m
pa,mq�
��
a
pa,mqpx � y q.
Also
� m
pa,mq
,a
pa,mq
�
pm, aq
pa,mq� 1 pThm. 3(b)q,
25