0% found this document useful (0 votes)
118 views21 pages

Math106 Module 3

Uploaded by

Flordeliz Lado
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
118 views21 pages

Math106 Module 3

Uploaded by

Flordeliz Lado
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

Math 106: Elementary Number Theory

Module 3 : Solving Linear Congruence, Chinese Remainder Theorem


Learning Objectives: At the end of the lesson the students should be able to

1. Understand the concept of a congruence.

2. Find the complete residue system of a given congruence.

3. Find the solution to a given linear congruence.

4. Applying properties in solving linear congruence.

5. Solve systems of linear congruences

6. Use the Chinese Remainder Theorem in solving system of linear congruences

7. Use Wilson, Euler and Fermat’s Theorem in solving congruences

1 Congruences

A congruence is nothing more than a statement about divisibility. The theory of congruences was
introduced by Carl Friedreich Gauss. Gauss contributed to the basic ideas of congruences and proved
several theorems related to this theory. Gauss introduces the concept of congruence and the notation
that makes it such a powerful technique (he explains that he was induced to adopt the symbol ≡ because
of the close analogy with algebraic equality). According to Gauss, “If a number n measures the difference
between two numbers a and b, then a and b are said to be congruent with respect to n; if not, incongruent.”

In this section we will introduce congruences and their properties. Then present solutions to linear
congruences which will serve as an introduction to the Chinese Remainder Theorem. Finally,we will
present some important congruence theorems derived by Fermat and Euler.

Definition: Let m ≥ 0. We we say that the numbers a and b are congruent modulo m, denoted by
a ≡ b (mod m), if a and b leave the same remainder when divided by m. The number m is the modulus
of the congruence. The notationa 6≡ b (mod m) means that they are not congruent.

Equivalently, we say that a is congruent to b modulo m if m|(a − b) where a and b are integers,that
is, if a = b + km where k ∈ Z.

Remark : Congruence is an equivalence relation(Abstract Algebra).

Example: Consider m = 7. Then

3 ≡ 24 (mod 7) − 31 ≡ 11 (mod 7) − 15 ≡ −64 (mod 7)

1
because 3 − 24 = (−3)7, −31 − 11 = (−6)7, and −15 − (−64) = 7 · 7.

Given an integer a, let q and r be its quotient and remainder upon division by m, so that

a = qm + r 0≤r<n

Then, by definition of congruence, a ≡ r (mod m). Because there are m choices for r, we see that every
integer is congruent modulo m to exactly one of the values 0, 1, 2, · · · , m−1; in particular, a ≡ 0 (mod m)
if and only if m|a. The set of m integers 0, 1, 2, · · · , m − 1 is called the set of least nonnegative residues
modulo m.

In general, a collection of m integers a1 , a2 , · · · , am is said to form a complete set of residues (or a


complete system of residues) modulo m if every integer is congruent modulo m to one and only one of
the ak . To put it another way, a1 , a2 , · · · , am are congruent modulo m to 0, 1, 2, · · · , m − 1, taken in some
order. For instance,
−12, −4, 11, 13, 22, 82, 91

constitute a complete set of residues modulo 7; here, we have

−12 ≡ 2 − 4 ≡ 3 11 ≡ 4 13 ≡ 6 22 ≡ 1 82 ≡ 5 91 ≡ 0

all modulo 7. An observation of some importance is that any m integers form a complete set of residues
modulo m if and only if no two of the integers are congruent modulo m.

There are many common properties between equations and congruences. Some properties are listed
in the following theorem.

Theorem 3.1: Let a, b, c and d denote integers. Let m be a positive integer. Then:

1. a ≡ a (mod m)

2. If a ≡ b (mod m), then b ≡ a (mod m).

3. If a ≡ b (mod m) and b ≡ c (mod m), then a ≡ c (mod m).

4. If a ≡ b (mod m), then a + c ≡ b + c (mod m).

5. If a ≡ b (mod m), then a − c ≡ b − c (mod m).

6. If a ≡ b (mod m), then ac ≡ bc (mod m).

7. If a ≡ b (mod m), then ac ≡ bc (mod mc), for c > 0.

8. If a ≡ b (mod m) and c ≡ d (mod m) then a + c ≡ b + d (mod m).

9. If a ≡ b (mod m) and c ≡ d (mod m) then a − c ≡ b − d (mod m).

10. If a ≡ b (mod m) and c ≡ d (mod m) then ac ≡ bd (mod m).

2
Proofs: We will present some proofs of the given properties and the others are left as an exercise.

(1) a − a = 0 = m(0). Thus m|(a − a). Hence a ≡ a (mod m).

(2) If a ≡ b (mod m), then m|(a − b). Thus there exists integer k such that a − b = mk, this implies
b − a = m(−k) and thus m|(b − a). Consequently b ≡ a (mod m).

(3) Suppose a ≡ b (mod m) and b ≡ c (mod m). Then m|(a−b) and m|(b−c). Then there exist integers
x and y such that a − b = mx and b − c = my. Thus, a − c = a − b + b − c = mx + my = m(x + y).
Hence, there exists x + y ∈ Z such that a − c = m(x + y). So m|(a − c). Therefore, a ≡ c (mod m).

(8) Assume that a ≡ b (mod m) and c ≡ d (mod m). Then m|(a − b) and m|(c − d). Thus ∃x, y ∈ Z
such that a − b = mx and c − d = my. So

(a − b) + (c − d) = mx + my

=⇒ (a + c) − (b + d) = m(x + y)

where x + y ∈ Z. Hence, m|((a + c) − (b + d)). Therefore, a + c ≡ b + d (mod m)

(10) Assume that a ≡ b (mod m) and c ≡ d (mod m). Then m|(a − b) and m|(c − d). Thus ∃x, y ∈ Z
such that a − b = mx and c − d = my. Now, a = b + mx and c = d + my. Then

ac = (b + mx)(d + my)

=⇒ ac = bd + bmy + dmx + m2 xy

=⇒ ac − bd = bmy + dmx + m2 xy

=⇒ ac − bd = m(by + dx + mxy)

where by + dx + mxy ∈ Z. Hence m|(ac − bd). Therefore ac ≡ bd (mod m).

3
Another Proof :

There exists two integers k and l such that a − b = mk and c − d = ml and thus ca − cb = m(ck)
and bc − bd = m(bl). Note that (ca − cb) + (bc − bd) = ac − bd = m(kc − lb). Hence, m|(ac − bd).
Therefore ac ≡ bd(mod m).

Example:

1. Since 14 ≡ 8 (mod 6), then 8 ≡ 14 (mod 6).

2. Since 22 ≡ 10(mod 6) and 10 ≡ 4(mod 6), it follows that 22 ≡ 4(mod 6).

3. Since 50 ≡ 20(mod 15), then 50 + 5 = 55 ≡ 20 + 5 = 25(mod 15).

4. Since 50 ≡ 20(mod 15), then 50 − 5 = 45 ≡ 20 − 5 = 15(mod 15).

5. Since 19 ≡ 16(mod3), then 2(19) = 38 ≡ 2(16) = 32(mod 3).

6. Since 19 ≡ 16(mod3), then 2(19) = 38 ≡ 2(16) = 32(mod 2(3) = 6).

7. Since 19 ≡ 3(mod 8) and 17 ≡ 9 (mod 8), then 19 + 17 = 36 ≡ 3 + 9 = 12 (mod 8).

8. Since 19 ≡ 3(mod 8) and 17 ≡ 9 (mod 8), then 19 − 17 = 2 ≡ 3 − 9 = −6 (mod 8).

9. Since 19 ≡ 3(mod 8) and 17 ≡ 9 (mod 8), then 19(17) = 323 ≡ 3(9) = 27 (mod 8).

With suitable precautions, cancellation can be allowed; one step in this direction, and an important
one, is provided by the following theorem Theorem 3.2:

m

(1) If a, b, c and m are integers such that m > 0, d = (m, c) and ac ≡ bc(mod m), then a ≡ b mod d .

(2) If (m, c) = 1 then a = b(mod m) if ac ≡ bc(mod m).

Proof. Part 2 follows immediately from Part 1. For Part 1, if ac ≡ bc(modm),then m|(ac − bc) =
c(a − b). Hence there exists k such that c(a − b) = mk. Dividing both sides by d, we get
( dc )(a − b) = k m m c m m
  
d . Since d , d = 1, it follows that d |(a − b). Hence a ≡ b mod d .
0 0
Another Proof: Assume that ab ≡ ac(mod m) and (a, m) = d. Then d|a and d|m. So ∃a , m ∈ Z
0 0
such that a = a d and m = m d. Moreover, m|(ab − ac) and so ∃x ∈ Z such that ab − ac = mx.
Now,

a(b − c) = mx
0 0
=⇒ a d(b − c) = m dx
0 0
=⇒ a (b − c) = m x

0 0 0 0
a m

Thus m |a (b − c). Since (a, m) = d, it follows that d, d
= 1. That is, (a , m ) = 1. This implies
0
that m |(b − c) that is m m

d |(b − c). Therefore, a ≡ b mod d .

4
The following Corollary is a special case of part (2) in Theorem 3.2.

Corollary If ca ≡ cb (mod p) and p 6 |c, where p is a prime number, then a ≡ b (mod p).

Proof. The conditions p 6 |c and p a prime imply that gcd(c, p) = 1.

Theorem 3.3: If a ≡ b (mod m), then an ≡ bn (mod m) ∀n ∈ N.

Proof. Let n ∈ N and assume that a ≡ b (mod m). Then m|(a − b) and so ∃x ∈ Z such that a − b = mx
that is a = b + mx. Thus

an = (b + mx)n
nbn−1 (mx) n(n − 1)bn−2 (mx)2 n(n − 1)(n − 2)bn−3 (mx)3
an = bn + + + + · · · + (mx)n
1! 2! 3!
nbn−1 (mx) n(n − 1)bn−2 (mx)2 n(n − 1)(n − 2)bn−3 (mx)3
an − bn = + + + · · · + (mx)n
1!
 n−1 2! 3!
(x) n(n − 1)bn−2 (mx2 ) n(n − 1)(n − 2)bn−3 (m2 x3 )

nb
an − bn = m + + + · · · + (mn−1 xn )
1! 2 6
nbn−1 (x) n−2 2 n−3
(m2 x3 )
where 1! + n(n−1)b 2 (mx ) + n(n−1)(n−2)b
6 +· · ·+(mn−1 xn ) is an integer. Hence m|(an −bn ).
Therefore an ≡ bn (mod m).

Theorem 3.4: If a ≡ b (mod m1 ), a ≡ b (mod m2 ), · · · , a ≡ b (mod mt ), where a, b, m1 , m2 , · · · , mt


are integers and m1 , m2 , · · · , mt are positive, then

a≡b (mod m1 , m2 , · · · , mt )

Example 1: Consider the congruence 33 ≡ 15 (mod 9). Then 3 · 11 ≡ 3 · 5 (mod 9). Since gcd(3, 9) = 3,
Theorem 3.2 leads to the conclusion that 11 ≡ 5 (mod 3). Another illustration is given by the congruence
−35 ≡ 45 (mod 8), which is the same as 5 · (−7) ≡ 5 · 9 (mod 8). The integers 5 and 8 being relatively
prime, then we cancel the factor 5 to obtain a correct congruence −7 ≡ 9 (mod 8).

Example 2: Show that 41 divides 220 − 1.

Solution: Note that 25 ≡ −9 (mod 41). Then (25 )4 ≡ (−9)4 (mod 41). In other words, 220 ≡ 81 · 81
(mod 41). But 81 ≡ −1 (mod 41), and so 81 · 81 ≡ 1 (mod 41). Using parts (2) and (4) of Theorem 3.1,
we have
220 − 1 ≡ 81 · 81 − 1 ≡ 1 − 1 ≡ 0 (mod 41).

Thus, 41|220 − 1.

Example 3: Find the remainder obtained upon dividing the sum 1! + 2! + 3! + 4! + · · · + 99! + 100! by
12.

Solution: Note that 4! ≡ 24 ≡ 0 (mod 12). Observe that

5! = 5 · 4! ≡ 5 · 0 (mod 12) and 6! = 6 · 5! ≡ 6 · 0 (mod 12).

5
Thus, for k ≥ 4,
k! ≡ 4! · 5 · 6 · · · k ≡ 0 · 5 · 6 · · · k ≡ 0 (mod 12).

Thus we find that

1! + 2! + 3! + 4! + · · · + 100! ≡ 1! + 2! + 3! + 0 + · · · + 01! + 2! + 3! + 0 + · · · + 0 (mod 12)

≡9 (mod 12)

The binary system is most convenient for use in modern electronic computing machines, because
binary numbers are represented by strings of zeros and ones; 0 and 1 can be expressed in the machine
by a switch (or a similar electronic device) being either on or off.

We shall frequently wish to calculate the value ofak (mod n) when k is large. Is there a more efficient
way of obtaining the least positive residue than multiplying a by itself k times before reducing modulo
n? One such procedure, called the binary exponential algorithm, relies on successive squarings, with a
reduction modulo n after each squaring. More specifically, the exponent k is written in binary form,
j
as k = (am am−1 · · · a2 a1 a0 )2 , and the values a2 (mod n) are calculated for the powers of 2, which
correspond to the 1’s in the binary representation.

Example 4: Calculate 5110 (mod 131).

Solution: Note that the exponent 110 can be expressed in binary form as

110 = 64 + 32 + 8 + 4 + 2 = (1101110)2

j
Thus, we obtain the powers 52 (mod 131) for 0 ≤ j ≤ 6. Then we have

52 ≡ 25 (mod 131) 516 ≡ 27 (mod 131)

54 ≡ 101 (mod 131) 532 ≡ 74 (mod 131)

58 ≡ 114 (mod 131) 564 ≡ 105 (mod 131)

Now,

5110 ≡ 564+32+8+4+2 (mod 131)

≡ 564 · 532 · 58 · 54 · 52 (mod 131)

≡ 105 · 74 · 114 · 101 · 25 (mod 131)

≡ 60 (mod 131).

Another calculation for 5110 (mod 131), we can consider the powers

5, 52 , 53 , 56 , 512 , 524 , 548 , 596 .

6
Then we have
5110 = 596 · 512 · 52 ≡ 41 · 117 · 25 ≡ 60 (mod 131).

which would require two fewer multiplications.

Exercises

1. Determine whether 3 and 99 are congruent modulo 7 or not.

2. Find the remainders when 250 and 4165 are divided by 7.

3. What is the remainder when the following sum 15 + 25 + 35 + · · · + 995 + 1005 is divided by 4?

4. Use the binary exponentiation algorithm to compute both 1953 (mod 503) and 14147 (mod 1537).
9
5. Find the last two digits of the number 99 .
9
[Hint: 99 ≡ 9 (mod 10); hence, 99 = 99+10k ; notice that 99 ≡ 89 (mod 100).]

6. Give an example to show that a2 ≡ b2 (mod n) need not imply that a ≡ b (mod n).

7. Prove each of the following assertions:

(a) If x is an odd integer, then x2 ≡ 1(mod 8).

(b) If a ≡ b (mod n) and m|n, then a ≡ b (mod m).

(c) If a, b, m and n are integers such that m, n > 0, n|m and a ≡ b (mod m), then a ≡ (mod n).

(d) If a ≡ b (mod n) and c > 0, then ca ≡ cbmodcn.

a b n
(e) If a ≡ b (mod n) and the integers a, b, n are all divisible by d > 0, then d ≡ d (mod d ).

8. If a ≡ b (mod n), prove that gcd(a, n) = gcd(b, n).

9. Show that if ai ≡ bi (mod m) for i = 1, 2, · · · , n, where m is a positive integer and ai , bi are integers
Pn Pn
for i = 1, 2, · · · , n, then i=1 a1 ≡ i=1 bi (mod m)

10. Show that f (a) ≡ f (b) (mod m) for all polynomials f (x) with integer coefficients.

2 Residue Classes

A set of integers containing exactly those integers which are congruent to fixed integer module m is
called a residue class module m.

Definition: The set {[a]|a ∈ Z} of all residue classes modulo m is denoted Zm .

7
Definition: Fix m > 0. The residue class class of a modulo m (or congruence class, or equivalence class
of a modulo m) is [a] = {x : x ≡ a(modm)}, the set of all integers congruent to a modulo m. Note that,
by definition, [a] is a set and so we denote

[a] = mq + a : q ∈ Z = {· · · , −2m + a, −m + a, a, m + a, 2m + a, · · · }

Example: Fix m = 4. Then the residues of 1 is given by [1] = {· · · , −7, −3, 1, 5, · · · }. Note that

· · · = [−7] = [−3] = [1] = [5] = · · ·

Also, [2] = {· · · , −6, −2, 2, 6, · · · } and [3] = {· · · , −5, −1, 3, 7, · · · }. Hence, we can write Z4 = {[0], [1], [2], [3]}
as Z4 = {[8], [5], [−6], [11]}.

Definition: A complete residue system modulo m is a set of integers such that every integer is congruent
modulo m to exactly one integer of the set.

The complete residue system modulo m is the set of integers 0, 1, 2, · · · , m − 1. Every integer is
congruent to one of these integers modulo m.

Example 1: The set of integers 0, 1, 2, 3, 4 form a complete residue system modulo 5. Another complete
residue system modulo 5 could be 6, 7, 8, 9, 10.

Example 2: Consider Z7 . Then we have the complete residue classes given by

[0] = {· · · , −14, −7, 0, 7, 14, · · · }

[1] = {· · · , −13, −6, 1, 8, 15, · · · }

[2] = {· · · , −12, −5, 2, 9, 16, · · · }

[3] = {· · · , −11, −4, 3, 10, 17, · · · }

[4] = {· · · , −10, −3, 4, 11, 18, · · · }

[5] = {· · · , −9, −2, 5, 12, 19, · · · }

[6] = {· · · , −8, −3, 6, 13, 20, · · · }

Note that [0] = [7]. Thus the complete residue system is Z7 = {0, 1, 2, 3, 4, 5, 6}.

Definition: A reduced residue system modulo m is a set of integers ri such that (ri , m) = 1 for all i and
ri 6= rj (mod m) if i 6= j.

Example: The set of integers {1, 5} is a reduced residue system modulo 6.

Theorem 3.5: [a] = [b] iff a ≡ b (mod m).

8
Proof: Assume that [a] = [b]. Note that a ∈ [a] because a ≡ a (mod m). Since [a] = [b], we have
a ∈ [b]. Thus a ≡ b (mod m).

Assume that a ≡ b (mod m). Suppose that x ∈ [a], so that x ≡ a(mod m). Since a ≡ b (mod
m), by transitivity of equivalence, x ≡ b (mod m), and so x ∈ [b]. Hence [a] ⊆ [b]. The argument
to show that if x ∈ [b] then x ∈ [a] is similar. Thus [b] ⊆ [a].

Therefore [a] = [b] iff a ≡ b (mod m).

Exercises

1. Give a reduced residue system modulo 12.

2. Give a complete residue system modulo 13 consisting only of odd integers.

3. Suppose that 6 ≡ −5 (mod 22). Find two integers a and b such that [a] = [b].

3 Solving Linear Congruences

We will solve any linear congruence of the form

ax ≡ b (mod m)

where a, b are given integers and m is a positive integer.For a simple example, you can easily check by
inspection that the linear congruence 6x ≡ 4 (mod 10) has solutions x = 4, 9. Already we see a difference
from ordinary algebra and note that linear congruences can have more than one solution.

In this section, we will be discussing linear congruences of one variable and their solutions. We start
by defining linear congruences.

Definition: A congruence of the form ax ≡ b (mod m) where x is an unknown integer is called a linear
congruence in one variable.

Note that if x0 is a solution for a linear congruence, then all integers xi such that xi ≡ x0 (mod
m) are solutions of the linear congruence. Also, observe that ax ≡ b (mod m) is equivalent to a linear
Diophantine equation. That is, there exists y such that ax − my = b.

Theorem 3.6: Let a, b and m be integers such that m > 0 and let d = (a, m). If d does not divide
b, then the congruence ax ≡ b (mod m) has no solutions. If d|b, then ax ≡ b (mod m) has exactly d
incongruent solutions modulo m.

m

Definition: The set of incongruent solutions is given by x = x0 + d t, where t is taken modulo d.

9
Remark 1: If x0 is a solution of the congruence, then the general solution is

m
x ≡ x0 (mod )
d

Remark 2: If d = (a, m) = 1, then there is a unique solution modulo m for the equation ax ≡ b
(mod m).

Examples:

1. Find all the solutions of 42x ≡ 50 (mod 91)

Solution: Note that

91 = 42(2) + 7

42 = 7(6) + 0

Thus (42, 91) = 7. But 7 6 | 50. Hence the given linear congruence has no solution.

2. Find all the solutions of the congruence 3x ≡ 12 (mod 6).

Solution: Notice that (3, 6) = 3 and 3|12. Thus there are three incongruent solutions modulo 6.
We use the Euclidean algorithm to find the solution of the equation 3x − 6y = 12 As a result, we
get x0 = 6. The residue system of t is {0, 1, 2} since t is taken modulo 3. Hence the solutions are
 
6
x0 = 6 + 0=6
3
 
6
x1 = 6 + 1=8
3
 
6
x2 = 6 + 2 = 10
3

Therefore,three solutions of 3x ≡ 12 (mod 6) are given by

x0 ≡ 6 (mod 6)

x1 ≡ 8 ≡ 2 (mod 6)

x2 ≡ 10 ≡ 4 (mod 6)

or by Remark 1,
x≡6 (mod 2) =⇒ x = 6 + 2k, k ∈ Z.

That is
SS = {· · · , 0, 2, 4, 6, 8, 10, · · · }

3. Find all the solutions of the congruence 68x ≡ 100 (mod 120)).

10
Solution: Note that (68, 120) = 4 and 4|100. Now, we find x0 using the linear diophantine equation
68x − 120y = 100 =⇒ 17x − 30y = 25. We have

30 = 17(1) + 13

17 = 13(1) + 4

13 = 4(3) + 1

4 = 1(4) + 0

Thus

1 = 13 − 4(3)

1 = 13 − [17 − 13](3)

1 = −17(3) + 13(4)

1 = −17(3) + [30 − 17](4)

1 = −17(3) + 30(4) − 17(4)

1 = 17(−7) + 30(4)

1 = 17(−7) − 30(−4)

=⇒ 25 = 17(−175) − 30(−100)

Hence x0 = −175. Therefore the general solution is given by

x ≡ −175 (mod 30) =⇒ x = −175 + 30k, 0 ≤ k ≤ 30.

That is
SS = {· · · , −205, −175, −145, · · · }

Definition: A solution for the congruence ax ≡ 1 (mod m) for (a, m) = 1 is called the modular inverse
of a modulo m. We denote such a solution by ā.

Example: The modular inverse of 7 modulo 48 is 7. Notice that

7x ≡ 1 (mod 48) =⇒ 7x − 48y = 1.

Then

48 = 7(6) + 6

7 = 6(1) + 1

6 = 1(6)

11
Now,

1=7−6

1 = 7 − [48 − 7(6)]

1 = 7 − 48 + 7(6)

1 = 7(7) − 48

=⇒ x = 7 + 48k, ∀k ∈ Z.

Therefore, the solution is x ≡ 7 (mod 48).

Exercises

1. Find all solutions of 3x ≡ 6 (mod 9).

2. Find all solutions of 3x ≡ 2 (mod 7).

3. Find an inverse modulo 13 of 2 and of 11.

4 Systems of Linear Congruences

In this section, we will solve systems of linear congruences in one variable. That is the systems of the
form

a1 x ≡ b (mod m1 )

a2 x ≡ b (mod m2 )

a3 x ≡ b (mod m3 )
..
.

an x ≡ b (mod mn )

The process of solving this system is the same as the ones we have presented in the previous section.

Example: Solve the following system of linear congruences.

(1) x ≡ 8 (mod 12)

x ≡ 6 (mod 9)

Solution: For the first congruence x ≡ 8(mod12), note that x = 8 + 12k1 ∀k1 ∈ Z. Substituting to

12
the second congruence we have

8 + 12k1 ≡ 6 (mod 9)

12k1 ≡ −2 (mod 9)

12k1 ≡ 7 (mod 9)

Since (12, 9) = 3 and 3 6 |7, this system of linear congruences has no solutions.

(2) x ≡ 8 (mod 12)

x ≡ 6 (mod 13)

Solution: Note that x = 8 + 12k1 ∀k1 ∈ Z. Substituting to the second congruence we have

8 + 12k1 ≡ 6 (mod 13)

12k1 ≡ −2 (mod 13)

12k1 ≡ 11 (mod 13)

Since (12, 13) = 1 and 1|11 so there exists a solution. Now, we solve for x0 using the solution
12x − 13y = 1 we have

13 = 12(1) + 1

12 = 1(12) + 0

Thus 1 = 13 − 12(1) =⇒ 1 = 12(−1) − 13(−1). Hence x0 = −1. We then have

(−1)12k1 ≡ (−1)11 (mod 13)

−12k1 ≡ −11 (mod 13)

k1 ≡ −11 (mod 13), by Cancellation Property

k1 ≡ 2 (mod 13)

Thus k1 = 2 + 13k2 and so x = 8 + 12k1 = 8 + 12(2 + 13k2 ) = 32 + 156k2 ∀k2 ∈ Z. Therefore the
general solution is given by
x ≡ 32 (mod 156).

Another Solution: For x ≡ 8 (mod 12). We have the solution x = 8 + 12k ∀k ∈ Z. Substitute to
the second congruence we have

8 + 12k ≡ 6 (mod 13)

12k ≡ −2 (mod 13)

13
But

12k ≡ −k (mod 13)

−2 ≡ −k (mod 13)

k≡2 (mod 13)

=⇒ k = 2 + 13t

Hence

x = 8 + 12(2 + 13t)

x = 8 + 24 + 156t

x = 32 + 156t

=⇒ x ≡ 32 (mod 156)

(3) 5x ≡ 7 (mod 12)

4x ≡ 12 (mod 14)

Solution: For 5x ≡ 7 (mod 12), note that (5, 12) = 1 and 1|7. Also using division algorithm and
its reverse we have x0 = −1. Thus the solution is

x ≡ −1 (mod 12) =⇒ x ≡ 11 (mod 12).

Hence we have x = 11 + 12k ∀k ∈ Z. For 4x ≡ 12 (mod 14), we have x ≡ 3 (mod 7). Thus

11 + 12k ≡ 3 (mod 7) =⇒ 12k ≡ −8 (mod 7).

Note that

12k ≡ −2k (mod 7)

−2k ≡ 12k (mod 7)

−2k ≡ −8 (mod 7)

k≡4 (mod 7)

=⇒ k = 4 + 7t

Hence we can have the solution

x = 11 + 12k = 11 + 12(4 + 7t) = 59 + 84t ∀t ∈ Z.

Therefore the general solution is x ≡ 59 (mod 84) or

SS = {· · · , −109, −25, 59, 143, 227 · · · }

14
Another Solution: Note that for 5x ≡ 7 (mod 12), x0 = 35. Then we have the solution

x ≡ 35 (mod 12) =⇒ x = 35 + 12k ∀k ∈ Z.

Substitute to the second congruence we have

35 + 12k ≡ 3 (mod 7)

12k ≡ −32 (mod 7)

−2k ≡ −32 (mod 7)

k ≡ 16 (mod 7)

=⇒ k = 16 + 7t

Hence

x = 35 + 12(16 + 7t)

x = 35 + 192 + 84t

x = 227 + 84t

=⇒ x ≡ 227 (mod 84)

5 The Chinese Remainder Theorem

In the previous section, we provide a solution to system of linear congruences. In this section, we
discuss the solution of a system of congruences having different moduli. An example of this kind of
systems is the following; find a number that leaves a remainder of 1 when divided by 2, a remainder of 2
when divided by three and a remainder of 3 when divided by 5. This kind of question can be translated
into the language of congruences. Thus we will present a systematic way of solving this system of
congruences.

Theorem 3.7: (The Chinese Remainder Theorem) Suppose that m1 , m2 , · · · , mn are pairwise
relatively prime. Let M = m1 m2 · · · mn . We define the numbers b1, b2 , · · · , bn by choosing y = bi as a
M
solution of mi y ≡ 1 (mod mi ) for i = 1, 2, 3, · · · , n

15
Then the general solution of the system

x ≡ a1 (mod m1 )

x ≡ a2 (mod m2 )

x ≡ a3 (mod m3 )
..
.

x ≡ an (mod mn )

is given by the formula


 
M1 M2 Mn
x ≡ a1 b1 + a2 b2 + · · · + an bn (mod M )
m1 m2 mn

Examples: Solve the following system of congruences using Chinese Remainder Theorem.

(1) x ≡ 5 (mod 7)

x ≡ 8 (mod 19)

Solution: Let M = 7 · 19 = 133. Note that m1 = 7 and a1 = 5. Solving for b1 we have


133
y≡1 (mod 7) =⇒ 19y ≡ 1 (mod 7) =⇒ y = 3.
7
Thus b1 = 1.

Also, note that m2 = 19 and a2 = 8. Solving for b2 we have


133
y≡1 (mod 19) =⇒ 7y ≡ 1 (mod 19) =⇒ y = −8.
19
Thus b2 = −8.

Therefore, the solution is given by

x ≡ [5(3)(19) + 8(−8)(7)] ≡ −163 ≡ 103 (mod 133).

(2) x ≡ 1 (mod 2)

x ≡ 2 (mod 3)

x ≡ 3 (mod 5)

Solution: Note that M = 2 · 3 · 5 = 30. Then

a1 = 1 a2 = 2 a3 = 3

m1 = 2 m2 = 3 m3 = 5

15y ≡ 1 (mod 2) 10y ≡ 1 (mod 3) 6y ≡ 1 (mod 5)

=⇒ y = 1 =⇒ y = 1 =⇒ y = 1

=⇒ b1 = 1 =⇒ b2 = 1 =⇒ b3 = 1

16
Therefore, the solution is given by

x ≡ [1(1)(15) + 2(1)(10) + 3(1)(6)] ≡ 53 ≡ 23 (mod 30).

(3) x ≡ 2 (mod 5)

x ≡ 4 (mod 3)

x ≡ 3 (mod 7)

Solution: Note that M = 5 · 3 · 7 = 105. Then

a1 = 2 a2 = 4 a3 = 3

m1 = 5 m2 = 3 m3 = 7

21y ≡ 1 (mod 5) 35y ≡ 1 (mod 3) 15y ≡ 1 (mod 7)

=⇒ y = 1 =⇒ y = −1 =⇒ y = 1

=⇒ b1 = 1 =⇒ b2 = −1 =⇒ b3 = 1

Therefore, the solution is given by

x ≡ [2(1)(21) + 4(−1)(35) + 3(1)(15)](mod133) =⇒ x ≡ −53 (mod 105).

(4) x ≡ 3 (mod 10)

x ≡ 8 (mod 15)

x ≡ 5 (mod 84)

Solution: The moduli in this problem are not pairwise relatively prime, so we can not apply the
Chinese remainder theorem directly, and it is possible that such a system has no solution. Since
10 = 2 · 5, 15 = 3 · 5 , and84 = 4 · 3 · 7 , the first congruence is equivalent to

x≡3≡1 (mod 2) , x ≡ 3 (mod 5)

The second congruence is equivalent to

x≡8≡2 (mod 3) , x ≡ 8 ≡ 3 (mod 5)

The third congruence is equal to

x≡5≡1 (mod 4) , x ≡ 5 ≡ 2 (mod 3) , x ≡ 5 (mod 7).

Note that
x≡1 (mod 4) =⇒ x ≡ 1 (mod 2), x ≡ 1 (mod 2).

17
Therefore, the original system is equivalent to the following system:

x≡2 (mod 3)

x≡1 (mod 4)

x≡3 (mod 5)

x≡5 (mod 7)

Note that M = 3 · 4 · 5 · 7 = 420. Then

a1 = 2 a2 = 1 a3 = 3 a4 = 5

m1 = 3 m2 = 4 m3 = 5 m4 = 7

140y ≡ 1(mod3) 105y ≡ 1(mod4) 84y ≡ 1(mod5) 60y ≡ 1(mod7)

=⇒ y = 2 =⇒ y = 1 =⇒ y = −1 =⇒ y = 2

=⇒ b1 = 2 =⇒ b2 = 1 =⇒ b3 = −1 =⇒ b4 = 2

Therefore, the solution is given by

x ≡ [2(2)(140) + 1(1)(105) + 3(−1)(84) + 5(2)(60)] (mod 420)

x ≡ 1013 ≡ 173 (mod 420)

x ≡ 173 (mod 420)

6 Fermat and Euler Theorems

In this section we present applications of congruences. We present Fermat’s theorem, also known as
Fermat’s little theorem, Wilson Theorem and the Euler-Fermat’s Theorem.

Theorem 3.8: ((Euler-Fermat’s Theorem) If m is a positive integer and (a, m) = 1 , then

aφ(m) ≡ 1 (mod m)

Theorem 3.9: (Fermat’s Theorem) Let p be a prime and suppose that p 6 |a. Then

ap−1 ≡ 1 (mod p).

Example 1: By Fermat’s Theorem, 94 ≡ 1 (mod 5).

Example 2: Verify that 538 ≡ 4 (mod 11).

Solution: Note that 38 = 10(3) + 8. Also, by Fermat’s Theorem,

510 ≡ 511−1 ≡ 1 (mod 11).

18
Thus

538 = 510·3+8

= (510 )3 (52 )4

≡ 13 · 34

≡ 81

≡4 (mod 11)

Theorem 3.10: ( Wilson’s Theorem) If p is a prime number, then p divides (p − 1)! + 1. That is,

(p − 1)! ≡ −1 (mod p).

Example 1: 2! = 2 ≡ −1 (mod 3) and 4! = 24 ≡ −1 (mod 5)

Example 2: Note that 34 = 81 ≡ 1 (mod 5). Also, 2φ(9) = 26 = 64 ≡ 1 (mod 9).

Example 3: Find the remainder of 97! when divided by 101.

Solution: Using Wilson Theorem, we have 100! ≡ −1 (mod 101). Then

(100)(99)(98)(97!) ≡ −1 (mod 101)

Note that 100 ≡ −1 (mod 101), 99 ≡ −2 (mod 101) and 98 ≡ −3 (mod 101). Thus

(−1)(−2)(−3)(97!) ≡ −1 (mod 101)

(−6)(97!) ≡ −1 (mod 101)

(6)(97!) ≡ 1 (mod 101)

Using the division algorithm, we get

101 = 6(16) + 5

6 = 5(1) + 1

5 = 1(5) + 0

1 = 6 + 5(−1)

1 = 6 + [101 + 6(−16)](−1)

1 = 101(−1) + 6(17)

Thus we get x0 = 17. Hence,

(17)(6)(97!) ≡ (17)1 (mod 101)

97! ≡ 17 (mod 101)

19
Theorem 3.11: (Fermat’s Little Theorem) If p is a prime number and a is an integer, then

ap ≡ a (mod p)

Proof. Let p be a prime number and let a be an integer. If (a, m) = 1 then

aφ(m) ≡ 1 (mod p)

ap−1 ≡ 1 (mod p)

aap−1 ≡ a (mod p)

ap ≡ a (mod p)

If (a, p) 6= 1 then a ≡ 0 (mod p). Thus ap ≡ 0(modp). Hence ap ≡ a (mod p).

Example: Use Fermat’s Little Theorem to find the remainder of the following.

(1) 331 (mod 7).

Solution: Since 31 is prime, it follows by Fermats’ Little Theorem that 331 ≡ 3mod 7.

(2) 235 (mod 7).

Solution: Since 35 is not prime, we use Fermat-Euler Theorem. Note that φ(35) = φ(5)φ(7) =
4(6) = 24. Then 224 ≡ 1 (mod 7). Also, 26 ≡ 1 (mod 7). Thus

235 = 211 · 224 ≡ 211 · 1 ≡ 26 · 25 ≡ 25 · 1 ≡ 32 ≡ 4 (mod 7).

It might be worthwhile to give an example illustrating the failure of the converse of Fermat’s theorem
to hold, in other words, to show that if an−1 ≡ 1 (mod n) for some integer a, then n need not be prime.
To verify this, we require a technical lemma.

Lemma. If p and q are distinct primes with ap ≡ a (mod q) and aq ≡ a (mod p), then apq ≡ a
(mod pq).

Example: Suppose we want to verify 2340 ≡ 1 (mod 341), where 341 = 11 · 31. Notice that

210 = 1024 = 31 · 33 + 1.

Thus,
211 = 2 · 210 ≡ 2 · 1 ≡ 2 (mod 31)

and
231 = 2(210 )3 ≡ 2 · 13 ≡ 2 (mod 11)

Then by the lemma,


211·31 ≡ 2 (mod 11 · 31)

20
or
2341 ≡ 2 (mod 341).

Canceling a factor of 2, we have


2340 ≡ 1 (mod 341).

Exercises

1. Find all solutions to the following linear congruences.

(a) 2x ≡ 5 (mod 7)

(b) 6x ≡ 5 (mod 8)

(c) 19x ≡ 30 (mod 40)

(d) 234x ≡ 60 (mod 732)

(e) 128x ≡ 833 (mod 1001)

2. Solve the systems of linear congruences

(a) 2x ≡ 5 (mod 7) (b) 3x ≡ 7 (mod 12)

4x ≡ 2 (mod 2) x≡3 (mod 9)

2x ≡ 1 (mod 5)

3. Use Chinese Remainder Theorem to solve the following systems of linear congruences.

(a) x ≡ 1 (mod 21) (b) x ≡ 4 (mod 11)

x≡2 (mod 20) x≡3 (mod 17)

x≡3 (mod 7)11 x≡6 (mod 18)

x≡2 (mod 5)

4. Find the remainder of the following

(a) 416 (mod 5)

(b) 2925 (mod 11)

(c) 128129 (mod 17).

(d) 220 + 330 + 440 + 550 + 660 (mod 7).

5. Use Fermat’s theorem to verify that 17 divides 11104 + 1.

6. Show that if a is an integer such that a is not divisible by 3 or such that a is divisible by 9, then
a7 ≡ a (mod 63).

21

You might also like