Euclidean Algorithm & Congruences: Solving Equations & Chinese Remainder Theorem, Study notes of Discrete Mathematics

The euclidean algorithm and congruences, focusing on solving congruence equations and the chinese remainder theorem. The concept of multiplicative inverses, the existence and uniqueness of solutions, and the chinese remainder problem. It also introduces fermat's little theorem.

Typology: Study notes

Pre 2010

Uploaded on 10/01/2009

koofers-user-9vo
koofers-user-9vo 🇺🇸

10 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Mathematics 55– Spring 2005
Lecture 10 (Wednesday 2/9/2005)
Euclidean Algorithm and Congruence
Announcement: Midterm exam in class next Wednesday. (I supply paper.) Review
next Tuesday in discussion section.
Today: Congruences, congruence equations, Chinese Remainder Theorem. State-
ment of Fermat’s little Theorem.
Problem: Given a, b, how to solve the congruence equation ax bmod m?
This should remind us of 9th grade algebra: to solve ax =b, we divide through
by ato get x=b/a =ba1. What’s the analogue here? If we had a number ¯asuch
that ¯aa 1 mod mthen x= ¯ab would be a solution, for ax = (a¯a)b, and a¯a1
mod mimplies (by one of our theorems) that (a¯a)bbmod m. Such a number ¯a
is called a multiplicative inverse of amodulo m.
Of course, there are other solutions: if xis a solution then so is x+km for any
integer k; that is, if xymod mthen yis also a solution. Reversing the reasoning,
we see that if ax bmod mthen x¯ab mod m. Thus any two solutions must be
congruent modulo m; the solution is unique modulo m.
But when does ¯aexist? We know that there exist integers s, t such that gcd(a, m) =
sa+tm. If a, m are relatively prime, that is, if gcd(a, m) = 1, then we get 1 = sa+tm.
This says that sa 1 mod m, so ¯a=sis the desired multiplicative inverse of a.
On the other hand, if gcd(a, m) = cis 6= 1 then cdivides both a, m, so c|ax and
c|m, so cmust divide bin order for the equation to be solvable.
Upshot: If a, m are relatively prime then
(i) ahas a multiplicative inverse modulo m,
(ii) for any b, there is an integer solution xof the congruence equation ax bmod m,
and
(iii) Any two solutions x, y are congruent modulo m.
Chinese Remainder Problem: Given finitely many (positive) integers m1, m2,· · · , mN,
and given integers b1,· · · , bN, find an integer xsatisfying xbjmod mjfor all
j {1,2,· · · , N }simultaneously.
Example: Find xcongruent to 1 modulo 2, congruent to 2 modulo 3, and congruent
to 4 modulo 7. We check that x= 11 works; I didn’t explain how xcould be found.
Example: Find xcongruent to 1 modulo 8 and to 2 modulo 12. This is impossible;
the first congruence requires xto be odd, while the second requires it to be even.
Chinese Remainder Theorem: Let N2, and let m1,· · · , mNNbe given. If
the numbers mjare pairwise relatively prime then for any numbers bj,
(i) a solution xexists,
(ii) any two solutions are congruent modulo Mwhere Mis the product M=
m1m2· · · mN.
(iii) if xis a solution, and if yxmod M, then yis also a solution.
1
pf3

Partial preview of the text

Download Euclidean Algorithm & Congruences: Solving Equations & Chinese Remainder Theorem and more Study notes Discrete Mathematics in PDF only on Docsity!

Mathematics 55– Spring 2005 Lecture 10 (Wednesday 2/9/2005) Euclidean Algorithm and Congruence

Announcement: Midterm exam in class next Wednesday. (I supply paper.) Review next Tuesday in discussion section. Today: Congruences, congruence equations, Chinese Remainder Theorem. State- ment of Fermat’s little Theorem. Problem: Given a, b, how to solve the congruence equation ax ≡ b mod m? This should remind us of 9th grade algebra: to solve ax = b, we divide through by a to get x = b/a = ba−^1. What’s the analogue here? If we had a number ¯a such that ¯aa ≡ 1 mod m then x = ¯ab would be a solution, for ax = (a¯a)b, and a¯a ≡ 1 mod m implies (by one of our theorems) that (a¯a)b ≡ b mod m. Such a number ¯a is called a multiplicative inverse of a modulo m. Of course, there are other solutions: if x is a solution then so is x + km for any integer k; that is, if x ≡ y mod m then y is also a solution. Reversing the reasoning, we see that if ax ≡ b mod m then x ≡ ¯ab mod m. Thus any two solutions must be congruent modulo m; the solution is unique modulo m. But when does ¯a exist? We know that there exist integers s, t such that gcd(a, m) = sa+tm. If a, m are relatively prime, that is, if gcd(a, m) = 1, then we get 1 = sa+tm. This says that sa ≡ 1 mod m, so ¯a = s is the desired multiplicative inverse of a. On the other hand, if gcd(a, m) = c is 6 = 1 then c divides both a, m, so c|ax and c|m, so c must divide b in order for the equation to be solvable. Upshot: If a, m are relatively prime then (i) a has a multiplicative inverse modulo m, (ii) for any b, there is an integer solution x of the congruence equation ax ≡ b mod m, and (iii) Any two solutions x, y are congruent modulo m.

Chinese Remainder Problem: Given finitely many (positive) integers m 1 , m 2 , · · · , mN , and given integers b 1 , · · · , bN , find an integer x satisfying x ≡ bj mod mj for all j ∈ { 1 , 2 , · · · , N } simultaneously. Example: Find x congruent to 1 modulo 2, congruent to 2 modulo 3, and congruent to 4 modulo 7. We check that x = 11 works; I didn’t explain how x could be found. Example: Find x congruent to 1 modulo 8 and to 2 modulo 12. This is impossible; the first congruence requires x to be odd, while the second requires it to be even. Chinese Remainder Theorem: Let N ≥ 2, and let m 1 , · · · , mN ∈ N be given. If the numbers mj are pairwise relatively prime then for any numbers bj , (i) a solution x exists, (ii) any two solutions are congruent modulo M where M is the product M = m 1 m 2 · · · mN. (iii) if x is a solution, and if y ≡ x mod M , then y is also a solution.

Here pairwise relatively prime means that no two have any positive common divisors except of course 1. The main new element here is that we have N equations for a single unkown x. Conclusion (iii) is obvious. Proof of (ii): Suppose that x, y are solutions, and let z = x−y. Then z ≡ 0 mod mj for all j ∈ { 1 , 2 , · · · , N }; that is, each mj divides z. Because the mj are pairwise relatively prime, this implies that their product M also divides z. (A detailed proof was given in class.) Thus x − y = kM for some integer k, that is, x ≡ y mod M. Example: 4|12 and 6|12, yet 4 · 6 = 24 does not divide 12. The above reasoning doesn’t apply, since 4, 6 are not relatively prime. Proof of (i): Here’s a method that gives a formula for a solution (then part (iii) tells us all other solutions). For each k define

Mk =

M

mk

m 1 m 2 · · · mN mk

(That is, Mk is the product of all the mj except mk.) Note

mk|Mj whenever j 6 = k. (1)

We seek a solution in the special form

x = c 1 M 1 + c 2 M 2 + · · · + cN MN. (2)

Here the cj are new unknown integers. Consider any index k ∈ { 1 , 2 , · · · , N }. For any coefficients cj ,

[c 1 M 1 + c 2 M 2 + · · · + cN MN ] ≡ ckMk mod mk.

This holds whenever j 6 = k, by (1). Thus in order to solve the original equation for x, we need to solve

Mkck ≡ bk mod mk for each k ∈ { 1 , 2 , · · · , N }.

Here the mk are given, Mk is defined in terms of these, and bk is likewise given, while each ck is an unknown. Now we’re in clover. We have N linear congruence equations, each with a different unknown quantity ck. As we learned in the first part of the lecture, each of these can be solved, provided that Mk, mk are relatively prime for each k. Equivalently, we need Mk = m 1 m 2 · · · mk− 1 mk+1mN and mk to be relatively prime, for each index k. This holds by our original hypothesis. For any prime factor p of mk is by hypoth- esis not a prime factor of any mj for j 6 = k. By Lemma 2 on page 183 of our text, this means that p doesn’t divide m 1 m 2 · · · mk− 1 mk+1mN. Thus a solution exists, and in fact can be found in the special form (2).