lecture #2. euclid’s algorithm. congruences.astrombe/talteori2017/lecture2.pdf · lecture #2....
TRANSCRIPT
![Page 1: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/1.jpg)
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 .
1
![Page 2: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/2.jpg)
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.
2
![Page 3: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/3.jpg)
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.
3
![Page 4: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/4.jpg)
Ex: p10, 15q �
4
![Page 5: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/5.jpg)
Ex: p10, 15q � 5 � p10,�15q � p�10,�15q.
5
![Page 6: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/6.jpg)
Ex: p10, 15q � 5 � p10,�15q � p�10,�15q.
Ex: p1000, 700q �
6
![Page 7: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/7.jpg)
Ex: p10, 15q � 5 � p10,�15q � p�10,�15q.
Ex: p1000, 700q � 100
7
![Page 8: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/8.jpg)
Ex: p10, 15q � 5 � p10,�15q � p�10,�15q.
Ex: p1000, 700q � 100
Ex:
�
25 � 310 � 54, 27 � 38 � 72
�
�
8
![Page 9: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/9.jpg)
Ex: p10, 15q � 5 � p10,�15q � p�10,�15q.
Ex: p1000, 700q � 100
Ex:
�
25 � 310 � 54, 27 � 38 � 72
�
� 25 � 38.
9
![Page 10: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/10.jpg)
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 �
10
![Page 11: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/11.jpg)
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.
11
![Page 12: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/12.jpg)
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.
12
![Page 13: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/13.jpg)
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.
13
![Page 14: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/14.jpg)
Theorem 1 (MNZ Thm. 1.3):
If g � gcdpb, cq then Dx0, y0 P Z such that g � bx0 � cy0.
14
![Page 15: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/15.jpg)
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.
15
![Page 16: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/16.jpg)
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).
16
![Page 17: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/17.jpg)
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.
17
![Page 18: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/18.jpg)
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!)
18
![Page 19: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/19.jpg)
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.
19
![Page 20: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/20.jpg)
Our situation: I � tbx � cy : x, y P Zu
and
ℓ � minpI X Z�q � bx0 � cy0.
Want to prove: ℓ � g � gcdpb, cq.
20
![Page 21: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/21.jpg)
Our situation: I � tbx � cy : x, y P Zu
and
ℓ � minpI X Z�q � bx0 � cy0.
Want to prove: ℓ � g � gcdpb, cq.
We first prove ℓ | b:
21
![Page 22: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/22.jpg)
Our situation: I � tbx � cy : x, y P Zu
and
ℓ � minpI X Z�q � bx0 � cy0.
Want to prove: ℓ � g � gcdpb, cq.
We first prove ℓ | b:
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.
22
![Page 23: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/23.jpg)
Our situation: I � tbx � cy : x, y P Zu
and
ℓ � minpI X Z�q � bx0 � cy0.
Want to prove: ℓ � g � gcdpb, cq.
We first prove ℓ | b:
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 .
23
![Page 24: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/24.jpg)
Our situation: I � tbx � cy : x, y P Zu
and
ℓ � minpI X Z�q � bx0 � cy0.
Want to prove: ℓ � g � gcdpb, cq.
We have proved ℓ | b and ℓ | c .
24
![Page 25: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/25.jpg)
Our situation: I � tbx � cy : x, y P Zu
and
ℓ � minpI X Z�q � bx0 � cy0.
Want to prove: ℓ � g � gcdpb, cq.
We have proved ℓ | b and ℓ | c .
Also g | ℓ, since ℓ � bx0 � cy0 and g | b and g | c .
Hence g ¤ ℓ.
25
![Page 26: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/26.jpg)
Our situation: I � tbx � cy : x, y P Zu
and
ℓ � minpI X Z�q � bx0 � cy0.
Want to prove: ℓ � g � gcdpb, cq.
We have proved ℓ | b and ℓ | c . (*)
Also g | ℓ, since ℓ � bx0 � cy0 and g | b and g | c .
Hence g ¤ ℓ. (**)
Together, (*) and (**) imply g � ℓ � bx0 � cy0, QED!
26
![Page 27: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/27.jpg)
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.)
27
![Page 28: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/28.jpg)
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!
28
![Page 29: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/29.jpg)
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
�
.
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.
29
![Page 30: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/30.jpg)
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
�
.
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”!30
![Page 31: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/31.jpg)
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
�
.
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.
— Proof: “easy” from Theorems 1 and 2...31
![Page 32: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/32.jpg)
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.
32
![Page 33: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/33.jpg)
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.
Note that Theorem 3(d) implies the 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)!
33
![Page 34: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/34.jpg)
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.
Note that Theorem 3(d) implies the 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).
On the other hand: Note that if we assume unique prime factor-ization, then Theorem 3 is “immediate”!
34
![Page 35: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/35.jpg)
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.
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.
35
![Page 36: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/36.jpg)
Next, how to compute gcdpb, cq?
36
![Page 37: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/37.jpg)
Next, how to compute gcdpb, cq?
— Theorem 3(e), pa, bq � pa, b � axq , is a good tool!
37
![Page 38: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/38.jpg)
Next, how to compute gcdpb, cq?
— Theorem 3(e), pa, bq � pa, b � axq , is a good tool!
Ex:
p1105, 117q �
38
![Page 39: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/39.jpg)
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 �
(We used 1105117 � 9.4....)
39
![Page 40: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/40.jpg)
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 �.
40
![Page 41: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/41.jpg)
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.
41
![Page 42: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/42.jpg)
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.
42
![Page 43: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/43.jpg)
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 .
43
![Page 44: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/44.jpg)
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.
44
![Page 45: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/45.jpg)
Ex: gcdp1105, 117q � 13, as we computed above via
1105 � 117 � 9� 52
117 � 52 � 2� 13
52 � 13 � 4.
45
![Page 46: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/46.jpg)
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
46
![Page 47: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/47.jpg)
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 �
47
![Page 48: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/48.jpg)
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.)
48
![Page 49: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/49.jpg)
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).
49
![Page 50: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/50.jpg)
Congruences.
Definition: Let m P Z
� and a, b P Z.
We say a � b pmod mq if m | a � b.
50
![Page 51: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/51.jpg)
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”.
51
![Page 52: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/52.jpg)
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.
52
![Page 53: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/53.jpg)
Definition: For m P Z
� and a P Z we write
a :�
b P Z : bm
� a
(
= the residue class of a.
53
![Page 54: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/54.jpg)
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”.)
54
![Page 55: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/55.jpg)
Definition: For m P Z
� and a P Z we write
a :�
b P Z : bm
� a
(
= the residue class of a.
Also:
Zm :� the set of residue classes pmod mq.
55
![Page 56: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/56.jpg)
Definition: For m P Z
� and a P Z we write
a :�
b P Z : bm
� a
(
= the residue class of a.
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(
.
56
![Page 57: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/57.jpg)
Definition: For m P Z
� and a P Z we write
a :�
b P Z : bm
� a
(
= the residue class of a.
Also:
Zm :� the set of residue classes pmod mq.
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).
57
![Page 58: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/58.jpg)
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.
58
![Page 59: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/59.jpg)
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.
59
![Page 60: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/60.jpg)
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.
Ex: In Z8, 1� 3 � 4 � 9� 27 � 36, which is ok!
60
![Page 61: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/61.jpg)
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.
Ex: In Z8, 1� 3 � 4 � 9� 27 � 36, which is ok!
Remark (extracurricular): xZm,�, �y is a ring, cf. KF §3 and §5.
61
![Page 62: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/62.jpg)
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!
62
![Page 63: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/63.jpg)
Ex: For a, b, x,m P Z with m ¡ 0, we have
a � x � b pmod mq �
63
![Page 64: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/64.jpg)
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 !
64
![Page 65: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/65.jpg)
Ex: ax � 1 pmod mq?
65
![Page 66: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/66.jpg)
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
66
![Page 67: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/67.jpg)
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.
67
![Page 68: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/68.jpg)
Ex: ax � 1 pmod mq?
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
68
![Page 69: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/69.jpg)
Ex: ax � 1 pmod mq?
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.
69
![Page 70: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/70.jpg)
Ex: ax � 1 pmod mq?
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.
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.
70
![Page 71: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/71.jpg)
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.
71
![Page 72: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/72.jpg)
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.)
72
![Page 73: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/73.jpg)
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”, and KF Sec. 6.)
73
![Page 74: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/74.jpg)
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.)
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.)
74
![Page 75: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/75.jpg)
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.
Proof:
75
![Page 76: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/76.jpg)
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.
Proof:
If pa,mq � 1 then Dx, y P Z such that ax �my � 1;
76
![Page 77: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/77.jpg)
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.
Proof:
If pa,mq � 1 then Dx, y P Z such that ax �my � 1;
thus ax � 1 pmod mq.
77
![Page 78: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/78.jpg)
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.
Proof:
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.
78
![Page 79: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/79.jpg)
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.
Proof:
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
79
![Page 80: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/80.jpg)
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.
Proof:
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! �
80
![Page 81: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/81.jpg)
Ex: Solve the congruence equation 103x � 1 pmod 143q.
81
![Page 82: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/82.jpg)
Ex: Solve the congruence equation 103x � 1 pmod 143q.
Solution: Is p103, 143q � 1? Compute using Euclid’s algorithm!
82
![Page 83: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/83.jpg)
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.
83
![Page 84: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/84.jpg)
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.
Now use the above to find x, y P Z with 103x � 143y � 1:
84
![Page 85: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/85.jpg)
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.
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.
85
![Page 86: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/86.jpg)
Ex: Solve the congruence equation 103x � 1 pmod 143q.
Solution: .........
We have proved that p103, 143q � 1, and found that
103x � 143y � 1 holds with x � �18 and y � 25.
86
![Page 87: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/87.jpg)
Ex: Solve the congruence equation 103x � 1 pmod 143q.
Solution: .........
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,
87
![Page 88: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/88.jpg)
Ex: Solve the congruence equation 103x � 1 pmod 143q.
Solution: .........
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).
88
![Page 89: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/89.jpg)
Finally, a result about how to “divide both sides with a” whensolving a congruence equation:
89
![Page 90: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/90.jpg)
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.
90
![Page 91: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/91.jpg)
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.
91
![Page 92: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/92.jpg)
Theorem 7
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.
Proof:
92
![Page 93: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/93.jpg)
Theorem 7
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.
Proof: First note that the second statement is indeed a specialcase of the first statement.
(One may also note that the second statement can be proveddirectly – using Theorem 6 – by “multiplying the equation witha�1”.)
93
![Page 94: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/94.jpg)
Theorem 7
Let a, x, y P Z, m P Z
�. Then
ax � ay pmod mq � x � y
�
modm
pm, aq
.
.......................
Proof: We now prove the first statement in Theorem 7.
First assume ax � ay pmod mq.
Then ax � ay � mz for some z P Z.
94
![Page 95: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/95.jpg)
Theorem 7
Let a, x, y P Z, m P Z
�. Then
ax � ay pmod mq � x � y
�
modm
pm, aq
.
.......................
Proof: 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.
95
![Page 96: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/96.jpg)
Theorem 7
Let a, x, y P Z, m P Z
�. Then
ax � ay pmod mq � x � y
�
modm
pm, aq
.
.......................
Proof: 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,
96
![Page 97: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/97.jpg)
Theorem 7
Let a, x, y P Z, m P Z
�. Then
ax � ay pmod mq � x � y
�
modm
pm, aq
.
.......................
Proof: 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,
and som
pa,mq�
��
x � y , i.e. x � y
�
modm
pa,mq
.
97
![Page 98: Lecture #2. Euclid’s algorithm. Congruences.astrombe/talteori2017/lecture2.pdf · Lecture #2. Euclid’s algorithm. Congruences. Definition (MNZ Def. 1.2) For b,c P Z(b 0 or c](https://reader031.vdocument.in/reader031/viewer/2022022017/5b8459987f8b9a317e8bbf24/html5/thumbnails/98.jpg)
Theorem 7
Let a, x, y P Z, m P Z
�. Then
ax � ay pmod mq � x � y
�
modm
pm, aq
.
.......................
Proof: Conversely, assume x � y
�
modm
pa,mq
.
Then by Thm. 5(8):
ax � ay�
modam
pa,mq
,
and heream
pa,mq� m �
a
pa,mq
is divisible by m;
hence by Theorem 5(7) we get:
ax � ay pmod mq.
�
98