120 21. Proof. Let p ≥ 5 be a prime. Dividing p by 6

120
21. Proof. Let p ≥ 5 be a prime. Dividing p by 6, we obtain p = 6k + r for some integers
k and r, where 0 ≤ r ≤ 5. If r = 0, then 6 | p, which is impossible. If r = 2, then
p = 6k + 2 = 2(3k + 1). Since 3k + 1 is an integer, 2 | p. Since p ≥ 5, we have a contradiction.
If r = 3, then p = 6k + 3 = 3(2k + 1). Since 2k + 1 is an integer, 3 | p, which is a contradiction
since p ≥ 5. If r = 4, then p = 6k + 4 = 2(3k + 2). Since 3k + 2 is an integer, 2 | p, which is a
contradiction since p ≥ 5. Hence p = 6k + 1 or p = 6k + 5 for some integer k.
22. Proof. Assume that n = 6k + 5 for some integer k. Then
n = 6k + 5 = 6k + 3 + 2 = 3(2k + 1) + 2.
Letting ℓ = 2k + 1, we have n = 3ℓ + 2, where ℓ ∈ Z.
23. Proof. We show that 3 ! (n2 + 1) for every n, thereby showing that 3 | (n2 + 1) is false and
that the desired implication is true. We consider three cases.
Case 1. n = 3q for some integer q. Then
n2 + 1 = (3q)2 + 1 = 3(3q 2 ) + 1.
Since 3q 2 is an integer 3 ! (n2 + 1).
Case 2. n = 3q + 1 for some integer q. Then
n2 + 1
= (3q + 1)2 + 1 = 9q 2 + 6q + 1 + 1
= 9q 2 + 6q + 2 = 3(3q 2 + 2q) + 2.
Since 3q 2 + 2q is an integer, 3 ! (n2 + 1).
Case 3. n = 3q + 2 for some integer q. Then
n2 + 1
= (3q + 2)2 + 1 = 9q 2 + 12q + 4 + 1
= 9q 2 + 12q + 5 = 3(3q 2 + 4q + 1) + 2.
Since 3q 2 + 4q + 1 is an integer, 3 ! (n2 + 1).
Exercises for Section 7.4. Congruence
1. (a) 47 ≡ 23 (mod 8)
(d) 12 ≡ 12 (mod 13)
(b) 18 ≡ 38 (mod 5)
(e) 37 ≡ 35 (mod 2)
2. (a) True, since 7 | (24 − 3)
(c) 20 ̸≡ 10 (mod 3)
(b) False, since 8 ! (−17 − 9)
(c) True, since 4 | [(−5) − (−5)]
(d) True, since 3 | [24 − (−3)]
3. −9, 4, 17, 30
4. (a) Yes
(b) No
(c) No
(d) No.
5. Proof. First, we prove that if a ≡ b (mod n), then b = a + ℓn for some integer ℓ. Assume
that a ≡ b (mod n). By Theorem 7.25, a = b + kn for some integer k. Then b = a − kn. Thus
b = a + ℓn, where ℓ = −k.
We now turn to the converse and prove that if b = a+ℓn for some integer ℓ, then a ≡ b (mod n).
Assume that b = a + ℓn for some integer ℓ. Thus a = b − ℓn. Therefore, a = b + kn, where
k = −ℓ. By Theorem 7.25, a ≡ b (mod n).
121
6. Proof. Assume that a ≡ b (mod n) and b ≡ c (mod n). Then n | (a − b) and n | (b − c).
Therefore, a − b = nx and b − c = ny for some integers x and y. Adding these, we get
(a − b) + (b − c) = nx + ny. So a − c = n(x + y). Since x + y is an integer, n | (a − c). Therefore,
a ≡ c (mod n).
7. Proof. Since m | n, it follows that n = mx for some integer x. Assume that a ≡ b (mod n).
Thus n | (a − b) and so a − b = ny for some integer y. Hence
a − b = ny = (mx)y = m(xy).
Since xy is an integer, m | (a − b) and so a ≡ b (mod m).
8. Proof. Assume that a ≡ b (mod n) and c ≡ d (mod n). By Theorem 7.25, a = b + nx and
c = d + ny for some integers x and y. Hence
a + c = (b + nx) + (d + ny) = (b + d) + n(x + y).
Since x + y is an integer, it follows by Theorem 7.25 that a + c ≡ b + d (mod n).
9. Proof. Assume that a ≡ b (mod n) and c ≡ d (mod n). By Theorem 7.25, a = b + nx and
c = d + ny for some integers x and y. Hence
a − c = (b − d) + (nx − ny) = (b − d) + n(x − y).
Since x − y is an integer, a − c ≡ b − d (mod n) by Theorem 7.25.
10. Proof. Assume that a ≡ b (mod n) and c ≡ d (mod n). By Theorem 7.25, a = b + nx and
c = d + ny for some integers x and y. Hence
ac = (b + nx)(d + ny) = bd + bny + dnx + n2 xy = bd + n(by + dx + nxy).
Since by + dx + nxy is an integer, it follows by Theorem 7.25 that ac ≡ bd (mod n).
11. Proof. We proceed by induction. By Exercise 10, the statement is true for r = 2. Assume
that if a ≡ b (mod n), then ak ≡ bk (mod n) for an integer k ≥ 2. Again, it then follows
by Exercise 10 that ak+1 ≡ bk+1 (mod n). By the Principle of Mathematical Induction, if
a ≡ b (mod n), then ar ≡ br (mod n) for every integer r ≥ 2.
12. (a) Proof. Assume that a ≡ b (mod n). By Theorem 7.25, a = b + nx for some integer x.
Thus
ak = (b + nx)k = bk + n(xk).
Since xk is an integer, it follows by Theorem 7.25 that ka ≡ kb (mod n).
(b) Let k = 0, a = 3, b = 2 and n = 2. Thus ak ≡ bk (mod n) but a ̸≡ b (mod n).
13. Proof. Assume that a ≡ 0 (mod 5) and b ≡ 2 (mod 5). Then a = 5x and b = 5y + 2 for
integers x and y. Observe that
a2 + b 2
= (5x)2 + (5y + 2)2 = 25x2 + 25y 2 + 20y + 4
= 5(5x2 + 5y 2 + 2y) + 4.
Since 5x2 + 5y 2 + 2y is an integer, a2 + b2 ≡ 4 (mod 5).
14. Proof. Assume that a ≡ 0 (mod 3) or a ≡ 1 (mod 3). We consider these two cases.
Case 1. a ≡ 0 (mod 3). Then a = 3k for some integer k. Thus a2 − a = (3k)2 − 3k =
9k 2 − 3k = 3(3k 2 − k). Since 3k 2 − k is an integer, 3 | (a2 − a) and so a2 ≡ a (mod 3).
122
Case 2. a ≡ 1 (mod 3). Then a = 3ℓ + 1 for some integer ℓ. Thus
a2 − a
=
=
(3ℓ + 1)2 − (3ℓ + 1) = 9ℓ2 + 6ℓ + 1 − 3ℓ − 1
9ℓ2 + 3ℓ = 3(3ℓ2 + ℓ).
Since 3ℓ2 + ℓ is an integer, 3 | (a2 − a) and so a2 ≡ a (mod 3).
15. Proof. Assume that one of a and b is congruent to 0 modulo 3 and that the other is not
congruent to 0 modulo 3. We show that a2 + 2b2 ̸≡ 0 (mod 3). We consider two cases.
Case 1. a ≡ 0 (mod 3) and b ̸≡ 0 (mod 3). Since a ≡ 0 (mod 3), it follows that a = 3p for
some integer p. Since b ̸≡ 0 (mod 3), either b = 3q + 1 or b = 3q + 2 for some integer q. There
are two subcases.
Subcase 1.1. b = 3q + 1. Then
a2 + 2b2
= (3p)2 + 2(3q + 1)2 = 9p2 + 2(9q 2 + 6q + 1)
= 9p2 + 18q 2 + 12q + 2 = 3(3p2 + 6q 2 + 4q) + 2.
Since 3p2 + 6q 2 + 4q is an integer, 3 ̸ | (a2 + 2b2 ) and so a2 + 2b2 ̸≡ 0 (mod 3).
Subcase 1.2. b = 3q + 2. (The proof is similar to that of Subcase 1.1.)
Case 2. a ̸≡ 0 (mod 3) and b ≡ 0 (mod 3). Since a ≡
̸ 0 (mod 3), it follows that a = 3p + 1
or a = 3p + 2 for some integer p. Since b ≡ 0 (mod 3), it follows that b = 3q, where q ∈ Z.
There are two subcases.
Subcase 2.1. a = 3p + 1.
Subcase 2.2. a = 3p + 2.
(The proof of each subcase is similar to that of Subcase 1.1.)
16. Proof. Assume that an even number of a, b and c are congruent to 1 modulo 3. We consider
two cases.
Case 1. None of a, b and c is congruent to 1 modulo 3. We consider two subcases.
Subcase 1.1. At least one of a, b and c is congruent to 0 modulo 3, say a ≡ 0 (mod 3).
Then a = 3q for some integer q. Thus abc = 3qbc. Since qbc ∈ Z, it follows that 3 | abc and
abc ≡ 0 (mod 3). Hence abc ̸≡ 1 (mod 3).
Subcase 1.2. None of a, b and c is congruent to 0 modulo 3. Then all of a, b and c are congruent
to 2 modulo 3. Therefore, a = 3q1 + 2, b = 3q2 + 2 and c = 3q3 + 2, where qi ∈ Z for 1 ≤ i ≤ 3.
Hence
abc
= (3q1 + 2)(3q2 + 2)(3q3 + 2)
= 27q1 q2 q3 + 18q1 q2 + 18q1 q3 + 18q2 q3 + 12q1 + 12q2 + 12q3 + 8
= 3(9q1 q2 q3 + 6q1 q2 + 6q1 q3 + 6q2 q3 + 4q1 + 4q2 + 4q3 + 2) + 2.
Thus abc ≡ 2 (mod 3) and so abc ̸≡ 1 (mod 3).
Case 2. Exactly two of a, b and c are congruent to 1 modulo 3, say a and b are congruent to
1 modulo 3 and c is not congruent to 1 modulo 3. (The proof is similar to that of Case 1.)
17. (a) 38 mod 8 = 6
14 mod 8 = 6
(b) 31 mod 6 = 1
43 mod 6 = 1
(c) 27 mod 7 = 6
−15 mod 7 = 6
(d) 35 mod 12 = 11
(e) 0 mod 2 = 0
38 ≡ 14 (mod 8).
31 ≡ 43 (mod 6).
27 ≡ −15 (mod 7).
−11 mod 12 = 1
−2 mod 2 = 0
35 ̸≡ −11 (mod 12).
0 ≡ −2 (mod 2).
123
(f) 43 mod 9 = 7
43 ̸≡ 29 (mod 9).
29 mod 9 = 2
18. The statement is false. Let max{a, b, c} = c. Then 0 < |a − b| < c and c ! (a − b). So
a ̸≡ b (mod c).
Exercises for Section 7.5. Introduction to Cryptography
1. DTZ
FWJ
HTWWJHY
XNW.
2. SOS RADAR!
3. The likely message is
HELP IS HERE.
(One possible approach is to begin with MW, which is clearly a word. Since M corresponds to
12 and W to 22, we are looking for two letters α and β, where αβ is a word and β follows α
by 10 letters. The logical choice appears to be α = I and β = S. So f (x) = (x − 4) mod 26.)
4. HIGH
NOON.
5. (a) SIK
(b) TWIN
(c) DAN.
6. (a) f −1 (x) = 15x. Observe that
(f ◦ f −1 )(x) = f (f −1 (x)) = f (15x) = 7 · 15x = 105x = x
since 105 ≡ 1 (mod 26).
(b) WED
(c) POT
7. Both A and N are transformed into the same letter A, for example. Since this function is not
one-to-one, two different words can be transformed into the same word.
8. The cryptosystem in which the integer x associated with a letter is transformed into f (x) =
(27 − x) mod 26 has this property. In this case, the word BIN is transformed into ATE.
9. (a) ABOVE
10. (a) SUM
(b) f −1 (x) = f (x) = x + (−1)x .
(b) f −1 (x) = f (x).
11. Possible values for a and b are a = 5 and b = 0. In this case, the word WING would correspond
to the actual word GONE.
Exercises for Section 7.6. Greatest Common Divisors
1. (a) 2
(b) 1
(c) 10
(d) 2
(e) 17.
2. (a) 714 mod 558 = 156, 558 mod 156 = 90, 156 mod 90 = 66,
90 mod 66 = 24, 66 mod 24 = 18, 24 mod 18 = 6,
18 mod 6 = 0. So gcd(558, 714) = 6
(b) gcd(418, 648) = 2
3. (a) gcd(4, 5) = 1 = 4 · (−1) + 5 · 1.
(c) gcd(12, 36) = 12 = 12 · 1 + 36 · 0.
(b) gcd(15, 35) = 5 = 15 · (−2) + 35 · 1.
(e) gcd(30, 42) = 6 = 3 · 30 + (−2) · 42.
(d) gcd(9, 12) = 3 = 9 · (−1) + 12 · 1.