You are on page 1of 12

CONGRUENCE THEOREMS

Intended Learning Outcomes


By the end of this topic/chapter, you must be able to:
1. State and prove properties of congruence
2. Apply properties of congruence

Activity:
We can verify that 25  13 (mod 6). Now:
1) Add the same integer to both sides of the congruence (mod 6). Does congruence
(mod 6) still apply? You can write your answer below.

25 + ___  13 + ____ (mod 6). Still true? (Yes/No) ____________

2) Subtract the same integer from both sides of the congruence (mod 6). Does
congruence (mod 6) still apply? You can write your answer below.

25 – ___  13 – ____ (mod 6). Still true? (Yes/No) ____________

3) Multiply the same integer to both sides of the congruence (mod 6). Does
congruence (mod 6) still apply? You can write your answer below.

25  ___  13  ____ (mod 6). Still true? (Yes/No) ____________

Processing the Activity


If you performed the activity correctly, then you would
see that all congruences above are still correct, even if
we add, subtract, or multiply the same number to both
sides of the congruence.

Theorem. If a, b, c, and n are integers with n > 1, such that a  b (mod n), then:
a) a + c  b + c (mod n)
b) a – c  b – c (mod n)
c) a  c  b  c (mod n)

Proof. The proof of (a) will be shown here. The proofs of (b) and (c) will be left as an
exercise.

Since a  b (mod n), then n divides (a – b); in other words:


a – b = kn for some integer k.
The equation is the same as the following equation (where we add and subtract c, so
we do not affect the value):

MathEd 222: Number Theory


1
a + c – b – c = kn for some integer k.
Now we can express the above equation this way (verify that if you simplify, these
equations are all the same):
(a + c) – (b + c) = kn for some integer k.
In this last equation, we’ve shown that (a + c) minus (b + c) is n times an integer,
which shows that a + c  b + c (mod n).

Activity: Dividing by the Same Number


Can we divide by the same number, and still retain the congruence? Let us find out.

We can verify that 10  40 (mod 3).


1) Divide both sides by 2. Does congruence (mod 3) still apply? You can write your
answer below.

10 ÷ 2  40 ÷ 2 (mod 3). Still true? (Yes/No) ____________

Let us perform another example.

Again, we can verify that 10  40 (mod 6).


2) Divide both sides by 2. Does congruence (mod 3) still apply? You can write your
answer below.

10 ÷ 2  40 ÷ 2 (mod 6). Still true? (Yes/No) ____________

Processing the Activity


If you performed the activity correctly, then you would
see that one of the items above is true, and the other
is false. This means that it is valid to divide both sides
of a congruence by the same number sometimes, and
not all the time.

Theorem. If ac  bc (mod n), and c and n are relatively prime, then a  b (mod n).

Proof. Since ac  bc (mod n), then n|(ac – bc). Equivalently n|c(a – b). But since n
and c are relatively prime (i.e., they do not share a common divisor), then n must
divide (a – b). This implies that a  b (mod n).

Activity: Adding, Subtracting, Multiplying Different


Numbers That are Congruent (mod n)
In the previous activity, we added, subtracted or multiplied the same number
to both sides of the congruence. Will the congruence still be preserved if we
MathEd 222: Number Theory
2
consider different numbers that are congruent (mod 4)? We will find out in this
activity.
We can verify that 21  9 (mod 4).
First, Think of two numbers c and d that are congruent (mod 4):

c  d (mod 4).
1) Add c to the left side, and d to the right side of the equation below. Does
congruence (mod 4) still apply? You can write your answer below.

21 + ___  9 + ____ (mod 4). Still true? (Yes/No) ____________


2) Subtract c from the left side, and d from the right side of the equation below. Does
congruence (mod 4) still apply? You can write your answer below.

21 + ___  9 + ____ (mod 4). Still true? (Yes/No) ____________


3) Multiply c to the left side, and d to the right side of the equation below. Does
congruence (mod 4) still apply? You can write your answer below.

21 + ___  9 + ____ (mod 4). Still true? (Yes/No) ____________

Processing the Activity


If you performed the activity correctly, then you would
see that all congruences above are still correct, even if
we add, subtract, or multiply the different numbers to
both sides of the congruence.

Theorem. If a, b, c, d and n are integers with n > 1, such that a  b (mod n) and c
 d (mod n), then:
a) a + c  b + d (mod n)
b) a – c  b – d (mod n)
c) a  c  b  d (mod n)
Proof. We will prove (a). The proofs of the others are left as exercises.

It is given that a  b (mod n) and c  d (mod n). Therefore, there exist integers r and s
such that (a – b) = nr and (c – d) = ns.
Now, consider (a + c) – (b + d). Is this divisible by n also? We will find out.
Observe that (a + c) – (b + d) = (a – b) + (c – d). [if we simplify, these are the same]
= nr + ns = n(r + s)

Thus, we’ve shown that n divides (a + c) – (b + d), which implies that a + c  b + d


(mod n).

Fast Exponentiation

MathEd 222: Number Theory


3
Activity
Now we will investigate what happens if both sides of a congruence are raised
to the same power.
We can verify that 2  5 (mod 3).
1) Square both sides.
22  52 (mod 3), or 4  25 (mod 3). Still true? (Yes/No) ____________

2) Cube both sides.


23  53 (mod 3), or 8  125 (mod 3). Still true? (Yes/No) ____________

3) Raise both sides to the fourth power.


24  54 (mod 3), or 16  625 (mod 3). Still true? (Yes/No) ____________

Processing the Activity


If you performed the activity correctly, then you would
see that all congruences above are still correct, if we
raise both sides of a congruence to the same power.

Theorem. If a, b, k, and n are integers with k > 0 and m > 1, such that a  b (mod
n), then
ak  bk (mod n).

Proof. It is given that a  b (mod n), which means that n|(a – b). We need to
prove that n|(ak – bk).
If we factor ak – bk, we will get:
ak – bk = (a – b)(ak – 1 + ak – 2b + … + abk – 2 + bk – 1)
Thus, (a – b) is a divisor of ak – bk, or (a – b)|(ak – bk). Together with the fact
that n|(a – b), then n|(ak – bk).

Example. Compute the least positive residues of 2, 22, 24, 28, 216, … 2512
(mod 645) by applying the previous theorem (i.e., square both sides of the
congruence repeatedly).
Solution. Since we are dealing with mod 645, then the least positive residues
can be any integer from 0 to 644.

MathEd 222: Number Theory


4
Firstly, 2  2 (mod 645). You may also check that 2 – 2 = 0, and 645 divides 0.
[in the previous Chapter, the fact that a number is congruent to itself mod n
was discussed]
In the same way, we have:
22 = 4 4 (mod 645)
24 = 16  16 (mod 645)
28 = 256  256 (mod 645)
What about 216? The value is 65536. When we divide this by 645, the
remainder is 391 (please verify). In other words:
216 = 65536  391 (mod 645)
At this point, it is okay to use a calculator—the number can still fit in. After this
(or for even larger numbers, we can apply the theorem of squaring both
sides of the congruence):
216  391 (mod 645) → 232  3912 (mod 645)
→ 232  152881  16 (mod 645)
Now square both sides again:
232  16 (mod 645) → 264  162 (mod 645)
→ 264  256 (mod 645)
Square both sides again:
264  256 (mod 645) → 2128  2562 (mod 645)
→ 2128  65536  391 (mod 645)
Repeat the process, until we find the least positive residue of 2512.
2128  391 (mod 645) → 2256  3912 (mod 645)
→ 2256  152881  16 (mod 645)
2256  16 (mod 645) → 2512  162 (mod 645)
→ 2512  256 (mod 645)
Example. Compute 2644 (mod 645). That is, find the least positive residue of
2644 (mod 645).
Solution. In the previous example, we already found all the least positive
residues of 2, 22, 24, all the way up to 2512. We will use them in this problem.
First, we try to express 644 in terms of the other exponents:
644 = 512 + 128 + 4
MathEd 222: Number Theory
5
Therefore:
2644 = 2512 + 128 + 4 = 2512  2128  24  256  391  16 (mod 645)
= 1601536 (mod 645)
 1 (mod 645)

Example. Compute 399 (mod 101)


Solution. First, we write 99 as sums of powers of 2:
99 = 64 + 32 + 2 + 1
As in the previous example, we square 3k (mod 101) repeatedly (and
immediately reduce modulo 101) until we reach 364 (the highest power of 2
in the equation above).
• 31  3 (mod 101) → 32  9 (mod 101)
• 32  9 (mod 101) → 34  81 (mod 101)
• 34  81 (mod 101) → 38  812 = 6561  97 (mod 101)
• 38  97 (mod 101) → 316  972 = 9409  16 (mod 101)
• 316  16 (mod 101) → 332  162 = 256  54 (mod 101)
• 332  54 (mod 101) → 364  542 = 2916  88 (mod 101)

Now we are ready to compute 399 (mod 101).


399 = 364 + 32 + 2 + 1 = (364)(332)(32)(31)
 (88)(54)(9)(3) = 128304 (mod 101)
 34 (mod 101)

Example. Give the last two digits of 7202.


Solution. If we enter 7202 in a calculator, we cannot see the last two digits. To
find the last two digits, we compute 7204 (mod 100); i.e., we find the remainder
when we divide 7202 by 100.
First we write 202 as sums of powers of 2:
202 = 128 + 64 + 8 + 2
Next, we square 71  7 (mod 100) repeatedly:
• 71  7 (mod 100) → 72  49 (mod 100)
• 72  49 (mod 100) → 74  492 = 2401  1 (mod 100)
• 74  1 (mod 100) → 78  12 = 1 (mod 100)
• 78  1 (mod 100) → 716  12 = 1 (mod 100)
• 716  1 (mod 100) → 732  12 = 1 (mod 100)
MathEd 222: Number Theory
6
• 732  1 (mod 100) → 764  12 = 1 (mod 100)
• 764  1 (mod 100) → 7128  12 = 1 (mod 100)
Now we are ready to compute 7202 (mod 100).
7202 = 7128+64+8+2= (7128)(764)(78)(72)
 (1)(1)(1)(49) = 49 (mod 100)

Therefore, the last two digits of 7202 is 49.

Summary of Congruence Properties


[+,–,, or ÷ by the same number]
If a, b, c, and n are integers with n > 1, such that a  b (mod n), then:
a) a + c  b + c (mod n)
b) a – c  b – c (mod n)
c) a  c  b  c (mod n)
d) a ÷ c  b ÷ c (mod n) [We can only divide if c and n are relatively
prime]

[+,–, or  by different, but congruent numbers modulo n]


If a, b, c, d and n are integers with n > 1, such that a  b (mod n) and c  d (mod
n), then:
a) a + c  b + d (mod n)
b) a – c  b – d (mod n)
c) a  c  b  d (mod n)

[raising to a power]
If a, b, k, and n are integers with k > 0 and m > 1, such that a  b (mod n), then
ak  bk (mod n).

Problem Set

1. Prove: If a is an even integer, then a2  0 (mod 4). Hint: Start with defining a
= 2k where k is an integer.
2. Prove: If a is an odd integer, then a2  1 (mod 4).
3. Prove: If a is an odd integer, then a2  1 (mod 8). Hint: This is similar to the
previous problem. You would need an additional step here, where you will use
the fact that if there are 2 consecutive integers such as k and k + 1, then one
of them must be odd and one must be even.
4. Prove: If a, b, c, d and n are integers with n > 1, such that a  b (mod n) and c  d
(mod n), then a – c  b – d (mod n).

MathEd 222: Number Theory


7
5. Prove: If a, b, c, d and n are integers with n > 1, such that a  b (mod n)
and c  d (mod n), then ac  bd (mod n).
6. Find the least positive residues of 3, 32, 34, 38, … 3512 (mod 418)
7. Use your answer in the previous item to find the least positive residue of a)
3155 (mod 418) and b) 3750 (mod 418).
8. Give the last two digits of 978. (That is, what is the remainder when 978 is
divided by 100?)
9. Give the last three digits of 5816. (That is, what is the remainder when 5816 is
divided by 1000?)
10. Find the least positive residue of the following:
a) 310 (mod 11) c) 516 (mod 17)
b) 212 (mod 13) d) 322 (mod 23)
e) Propose a theorem based on your observations in parts (a) to (d).
11. Find the least positive residue of the following:
a) 6! (mod 7) c) 12! (mod 13)
b) 10! (mod 11) d) 16! (mod 17)
e) Propose a theorem based on your observations in parts (a) to (d).

Answer key:
6) 3, 9, 81, 291, 245, 251, 301, 313, 157, 405
7) 67 8) 21 9) 625 10) All answers from (a) to (d) are
the same… Then use letters/variables to try to generalize into a conjecture;
11) You should notice something similar in your answers in (a) to (d). Then
use letters/variables to try to generalize into a conjecture.

MathEd 222: Number Theory


8
CHAPTER 5: SOLVING CONGRUENCES
(Start: ___)

Intended Learning Outcomes


By the end of this topic/chapter, you must be able to:
1. Solve linear congruences
2. Apply the Chinese Remainder Theorem

Solving Linear Congruences

In this section, we will solve congruences of the form ax  b (mod n).


Example. Solve the following linear congruences:
a) 5x  6 (mod 8) b) 6x  5 (mod 8)
Solution. There are only 8 least possible residues (i.e., remainders) modulo 8.
These are {0, 1, 2, 3, 4, 5, 6, 7}. So we can test each of these to see which
satisfy the equation:
• 5(0) = 0 ≢ 6 (mod 8)
• 5(1) = 5 ≢ 6 (mod 8)
• 5(2) = 10  2 ≢ 6 (mod 8)
• 5(3) = 15  7 ≢ 6 (mod 8)
• 5(4) = 20  4 ≢ 6 (mod 8)
• 5(5) = 25  1 ≢ 6 (mod 8)
• 5(6) = 30  6 (mod 8) → True ✓
• 5(7) = 35  3 ≢ 6 (mod 8)
Here, we see that one solution is x = 6. All other solutions are given by 6 + 8k,
where k can be any integer (including negative integers).
Now we will solve 6x  5 (mod 8), again by testing each possibility:
• 6(0) = 0 ≢ 5 (mod 8)
• 6(1) = 6 ≢ 5 (mod 8)
• 6(2) = 12  4 ≢ 5 (mod 8)
• 6(3) = 18  2 ≢ 5 (mod 8)
• 6(4) = 24  0 ≢ 5 (mod 8)
• 6(5) = 30  6 ≢ 5 (mod 8)
• 6(6) = 36  4 ≢ 5 (mod 8)
• 6(7) = 42  6 ≢ 5 (mod 8)
This list shows that there is NO solution to 6x  5 (mod 8.
The previous example shows that some linear congruences have a solution,
while some do not.

MathEd 222: Number Theory


9
We now generalize the result.

Theorem. The linear congruence ax  b (mod n) has a solution if and only if


gcd(a, n) divides b.

Let d = gcd(a, n). If c is one solution, then all solutions are of the form c +
k(n/d), where k is any integer.
The proof is beyond the scope of this module.
Example Solve 4x  6 (mod 8).
Solution. Based on the theorem above, first compute d = gcd(4,8) = 4. Note
that 4 does not divide 6. Therefore, the equation has no solution.

Quick Practice: Earlier, we solved 6x  5 (mod 8). Apply the theorem to


verify that this equation has no solution.

Example. Solve 10x  2 (mod 4).


Solution. Again, we compute d = gcd(10, 4) = 2. Since 2|2, then the equation
has a solution.
The congruence involves modulo 4. Thus, we only need to check four
possibilities {0, 1, 2, 3}:
• 10(0) = 0 ≢ 2 (mod 4)
• 10(1) = 10  2 (mod 4) → True ✓
• 10(2) = 20  0 ≢ 2 (mod 4)
• 10(3) = 30  2 (mod 4) → True ✓
Thus, x = 1 is a solution. In this problem, n = 4 and d = gcd(10, 4) = 2, so n/d
= 2. All solutions are of the form 1 + 2k, where k is an integer.

Example. Solve (a) 24x  1 (mod 37), and (b) 24x  5 (mod 37)
Solution. (a) Since d = gcd(24, 37) = 1 and 1|1, then there is a solution.
However it is very tedious to check all integers from 0 through 36. We will now
employ another strategy: The Euclidean Algorithm.
Let us apply the Euclidean Algorithm for 24 and 37 as follows.

MathEd 222: Number Theory


10
Next, we work backwards from the second to the last line:
1 = 11 – 5(2)
1 = 11 – 5(13 – 11) [because 2 = 13 – 11 from the third to last line]
= 11 – 5(13) + 5(11)
= 6(11) – 5(13) [combine the terms with 11]
= 6(24 – 13) – 5(13) [because 11 = 24 – 13 from the fourth to last line]
= 6(24) – 6(13) – 5(13)
= 6(24) – 11(13) [combine the terms with 13]
= 6(24) – 11(37 – 24) [because 13 = 37 – 24 from the first line]
= 6(24) – 11(37) + 11(24)
1 = 17(24) – 11(37) [combine the terms with 24]

Thus, we’ve found [and you can verify using a calculator] that
1 = 17(24) – 11(37)

This is a multiple
of 37, and so it is
 0 (mod 37)

Therefore 24(17)  1 (mod 37), and we have solved equation (a): x = 17.
To solve part (b), we can use part (a) by multiplying both sides by 5.
24(17)  1 (mod 37) → 24(17)(5)  5 (mod 37)
→ 24(85)  5 (mod 37)

MathEd 222: Number Theory


11
Therefore, x  85 is a solution. The least positive residue (mod 37) of 85 is x =
11, and so x = 11 is the least positive solution (verify using a calculator that x
= 11 satisfies 24x  5 (mod 37)).

Problem Set

Solve the following congruences. If there are no solutions, explain why.


1. 5x  6 (mod 11)
2. 5x  12 (mod 20)
3. 2x  3 (mod 5)
4. 7x  6 (mod 9)
Solve the following by using the strategy involving the Euclidean Algorithm.
5. 17x  8 (mod 21) [Note: Solve 17x  1 (mod 21) first]
6. 22x  1 (mod 29)
7. 15x  6 (mod 72) [Give all positive solutions less than 72]
8. 23x  9 (mod 65)

Answer key:
1) 10 + 11k where k is an integer; 2) no solution; 3) 4 + 5k where k is an
integer; 4) 6 + 9k where k is an integer; 5) 19 + 21k where k is an integer; 6) 4
+ 29k where k is an integer; 7) 10, 34, 58; 8) 23 + 65k where k is an integer

MathEd 222: Number Theory


12

You might also like