Uploaded by Mohamed

Number Theory Practice Assignment with Solutions

advertisement
The German University in Cairo (GUC)
Faculty of Media Engineering and Technology (MET)
Dr. Ahmed Ashry, Eng. Passant Abbassi, Eng. Mai Ebrahim, Eng. Esraa Gibreen, Eng. Ahmed El-Refaii
;
Winter 2024 (WS24)
Discrete Mathematics
MATH 501 (MET) / MATH 305 (BI)
<
PA08 (and solutions) : Number Theory (Full Version)
Practice Assignment PA08 (and solutions)
Number Theory (Full Version)
Part (I)
Exercise 8–1
Does 41 divide 7 × 320 + 6. Show your workout.
Solution:
We want to find out whether 7 × 320 + 6 ≡ 0 ( mod 41).
Note that 34 = 81 ≡ −1( mod 41). So 320 ≡ (−1)5 ≡ −1( mod 41). Thus 7 × 320 + 6 ≡ 7 × (−1) + 6 ≡ −1(
mod 41). Since −1 ̸≡ 0( mod 41), then 41 does not divide 7 × 320 + 6.
Exercise 8–2
(From a Previous Exam)
Prove that: A number is divisible by 3 if its sum of digits is divisible by 3.
Solution:
Since we need to prove something about the digits, let’s represent the integer in hand as digits. Let n ∈ Z be any number whose
representation in decimal is given by X
the digits am · · · a1 a0 . The value of n is obtained by multiplying each decimal digit ai
by its position weight 10i , or n =
10i ai .
0≤i≤m
By applying the congruence “ (mod 3)” to both sides, we get n (mod 3) ≡
X
10i ai (mod 3).
0≤i≤m
Since 10i ≡ 1 (mod 3)P
for any i, thus 10i ai ≡ ai (mod 3)
(why?).
Thus, n (mod 3) ≡
ai (mod 3). From that last “equivalence/congruence”, and if 3 | n, we must have n ≡ 0
0≤i≤m
(mod 3), which means that the sum of n’s digits must also be divisible by 3.
Exercise 8–3
Use congruence to find the last digit of 4100
Hint: 6k ≡ 6 (mod 10)
Solution:
42 ≡ 6
(mod 10)
raise the power of both sides
(42 )50 ≡ 650
(mod 10)
4100 ≡ 650
(mod 10)
(1)
given that 6k ≡ 6 mod 10, thus
650 ≡ 6
Practice Assignment PA08 (and solutions)
(mod 10)
(Updated Version:
2024-11-20 11:52:09Z)
(2)
Page 1 (of 17)
The German University in Cairo (GUC)
Faculty of Media Engineering and Technology (MET)
Dr. Ahmed Ashry, Eng. Passant Abbassi, Eng. Mai Ebrahim, Eng. Esraa Gibreen, Eng. Ahmed El-Refaii
;
PA08 (and solutions) : Number Theory (Full Version)
Winter 2024 (WS24)
Discrete Mathematics
MATH 501 (MET) / MATH 305 (BI)
<
From (1) and (2)
4100 ≡ 6
(mod 10)
Last digit of 4100 is 6.
Exercise 8–4
(1) Compute 7111 (mod 9).
Solution:
73 ≡ 1( mod 9). Thus, 73∗37 ≡ 137 ≡ 1( mod 9), and the remainder is 1.
(2) Prove that 7m − 1 is divisible by 6 for all positive integers m in two different ways.
Solution:
(a) Direct Proof using the congruence rules. We want to prove that 7m − 1 ≡ 0( mod 6).
This is the same as 7m ≡ 1( mod 6)
It is clear that 7 ≡ 1( mod 6) thus
7m ≡ 1m ≡ 1( mod 6).
(b) By Mathematical Induction. Let P (n) be the statement 6 | 7n − 1, then prove that ∀n ∈ Z P (n) is true. The
basis is trivial, as 71 − 1 = 6 ≡ 0 (mod 6). Now, assume that 7k ≡ 1 (mod 6) for some k ≥ 1, then show
that 7k+1 ≡ 1 (mod 6). The last step is straightforward too, as 7k+1 = 7 × 7k ≡ 7 × 1 (mod 6) (from the
hypothesis). Finally, 7k+1 ≡ 1 (mod 6), and the statement is true for all n ≥ 1.
Exercise 8–5
Prove that if 0 ̸= a ∈ Z (i.e., a is an integer other than 0), then
(1) 1 | a.
Solution:
1 | a since a = 1 · a.
(2) a | 0.
Solution:
a | 0 since 0 = a · 0 and a ̸= 0.
Exercise 8–6
Show that if a | b and b | a, where a and b are integers, then a = b or a = −b.
Solution:
If a | b and b | a, there are integers c and d such that b = ac and a = bd. Hence, a = acd. Because a ̸= 0, and it follows
that cd = 1. Thus, either c = d = 1 or c = d = −1. Hence, either a = b or a = −b.
Practice Assignment PA08 (and solutions)
(Updated Version:
2024-11-20 11:52:09Z)
Page 2 (of 17)
The German University in Cairo (GUC)
Faculty of Media Engineering and Technology (MET)
Dr. Ahmed Ashry, Eng. Passant Abbassi, Eng. Mai Ebrahim, Eng. Esraa Gibreen, Eng. Ahmed El-Refaii
;
PA08 (and solutions) : Number Theory (Full Version)
Winter 2024 (WS24)
Discrete Mathematics
MATH 501 (MET) / MATH 305 (BI)
<
Exercise 8–7
Prove or disprove that if a | bc , where a, b, and c are positive integers such that a ̸= 0, then a | b or a | c.
Solution:
A simple counterexample is provided by a = 4 and b = c = 2.
Exercise 8–8
Prove that if a and b are integers and a | b, then a is odd or b is even.
Solution:
It is given that b = m · a for some integer m. Assume a is not odd, then a = 2k for some integer k, whence b = 2km. This
means by definition that b is even.
Exercise 8–9
(You must apply the Division Algorithm!)
What are the quotient and remainder when
(1) 19 is divided by 7?
Solution:
Quotient = 2, Remainder=5
(2) −111 is divided by 11?
Solution:
Quotient =-11, Remainder=10
(3) 789 is divided by 23?
Solution:
Quotient =34, Remainder=7
(4) 1001 is divided by 13?
Solution:
Quotient =77, Remainder=0
(5) 0 is divided by 19?
Solution:
Quotient =0, Remainder=0
(6) 3 is divided by 5?
Solution:
Quotient =0, Remainder=3
Practice Assignment PA08 (and solutions)
(Updated Version:
2024-11-20 11:52:09Z)
Page 3 (of 17)
The German University in Cairo (GUC)
Faculty of Media Engineering and Technology (MET)
Dr. Ahmed Ashry, Eng. Passant Abbassi, Eng. Mai Ebrahim, Eng. Esraa Gibreen, Eng. Ahmed El-Refaii
;
PA08 (and solutions) : Number Theory (Full Version)
Winter 2024 (WS24)
Discrete Mathematics
MATH 501 (MET) / MATH 305 (BI)
<
(7) −1 is divided by 3?
Solution:
Quotient =-1, Remainder=2
(8) 4 is divided by 1?
Solution:
Quotient =4, Remainder=0
Exercise 8–10
(Modular Arithmetic and the Division Algorithm)
Evaluate these quantities.
(1) -17 mod 2
Solution:
In each case we just apply the division algorithm (carry out the division) to obtain the quotient and remainder, as in
elementary school. However, if the dividend is negative, we must make sure to make the remainder positive, which may
involve a quotient 1 less (or more?) than might be expected. Since −17 = 2 · (−9) + 1, the remainder is 1. That is,
−17 mod 2 = 1. Note that we do not write −17 = 2 · (−8) − 1 because: −17 mod 2 ̸= −1 according to the
division algorithm.
(2) 144 mod 7
Solution:
Since 144 = 7 · 20 + 4, the remainder is 4. That is, 144 mod 7 = 4.
(3) -101 mod 13
Solution:
Since −101 = 13 · (−8) + 3, the remainder is 3. That is, -101 mod 13 = 3. Note that we do not write −101 =
13 · (−7) − 10; we can’t have -101 mod 13 = -10, because a mod b is always nonnegative.
(4) 199 mod 19
Solution:
Since 199 = 19 · 10 + 9, the remainder is 9. That is, 199 mod 19 = 9.
Exercise 8–11
Suppose that a and b are integers, a ≡ 4( mod 13), and b ≡ 9( mod 13). Find the integer c with 0 ⩽ c ⩽ 12 such that
(1) c ≡ 9a( mod 13).
Solution:
c= 10
(2) c ≡ 11b( mod 13).
Solution:
c= 8
Practice Assignment PA08 (and solutions)
(Updated Version:
2024-11-20 11:52:09Z)
Page 4 (of 17)
The German University in Cairo (GUC)
Faculty of Media Engineering and Technology (MET)
Dr. Ahmed Ashry, Eng. Passant Abbassi, Eng. Mai Ebrahim, Eng. Esraa Gibreen, Eng. Ahmed El-Refaii
;
PA08 (and solutions) : Number Theory (Full Version)
Winter 2024 (WS24)
Discrete Mathematics
MATH 501 (MET) / MATH 305 (BI)
<
(3) c ≡ a + b( mod 13).
Solution:
c= 0
(4) c ≡ 2a + 3b( mod 13).
Solution:
c= 9
(5) c ≡ a2 + b2 ( mod 13).
Solution:
c= 6
(6) c ≡ a3 − b3 ( mod 13).
Solution:
c= 11
Exercise 8–12
Suppose that a and b are integers, a ≡ 11( mod 19), and b ≡ 3( mod 19). Find the integer c with 0 ⩽ c ⩽ 18 such
that
(1) c ≡ 13a( mod 19).
Solution:
This problem is equivalent to asking for the right-hand side mod 19. So we just do the arithmetic and compute the
remainder upon division by 19. 13 · 11 = 143 ≡ 10( mod 19)
(2) c ≡ 8b( mod 19).
Solution:
8 · 3 = 24 ≡ 5( mod 19)
(3) c ≡ a − b( mod 19).
Solution:
11 − 3 = 8( mod 19)
(4) c ≡ 7a + 3b( mod 19).
Solution:
7 · 11 + 3 · 3 = 86 ≡ 10( mod 19)
(5) c ≡ 2a2 + 3b2 ( mod 19).
Solution:
2 · 112 + 3 · 32 = 269 ≡ 3( mod 19)
Practice Assignment PA08 (and solutions)
(Updated Version:
2024-11-20 11:52:09Z)
Page 5 (of 17)
The German University in Cairo (GUC)
Faculty of Media Engineering and Technology (MET)
Dr. Ahmed Ashry, Eng. Passant Abbassi, Eng. Mai Ebrahim, Eng. Esraa Gibreen, Eng. Ahmed El-Refaii
;
PA08 (and solutions) : Number Theory (Full Version)
Winter 2024 (WS24)
Discrete Mathematics
MATH 501 (MET) / MATH 305 (BI)
<
(6) c ≡ a3 + 4b3 ( mod 19).
Solution:
113 + 4 · 33 = 1439 ≡ 14( mod 19)
Exercise 8–13
Prove or disprove that if a, b, and d are integers with d > 0, then (a + b) div d = a div d + b div d.
Solution:
The statement is false and here is a Counterexample: (1 + 2) div 3 = 3 div 3 = 1, but 1 div 3 + 2 div 3 = 0 + 0 = 0
Exercise 8–14
(complementary to the lectures)
Let m be a positive integer. Show that a mod m = b mod m if a ≡ b( mod m).
Solution:
Assume that a ≡ b( mod m). This means that m | a − b, say a − b = mc, so that a = b + mc. Now let us compute
a mod m. We know that b = qm + r for some nonnegative r < m (namely, r = b mod m). Therefore we can write
a = qm + r + mc = (q + c)m + r. By definition this means that r must also equal amodm. That is what we wanted to
prove.
Exercise 8–15
Find an integer a such that
(1) a ≡ 43( mod 23) and −22 ⩽ a ⩽ 0.
Solution:
a) We can get into the desired range and stay within the same modular equivalence class by subtracting 2 · 23, so the
answer is a = 43 − 46 = −3.
(2) a ≡ 17( mod 29) and −14 ⩽ a ⩽ 14.
Solution:
17 − 29 = −12, so a = -12.
(3) a ≡ −11( mod 21) and 90 ⩽ a ⩽ 110.
Solution:
a = −11 + 5 · 21 = 94
Exercise 8–16
Show that if a ≡ b( mod m) and c ≡ d( mod m), where a, b, c, d, and m are integers with m ⩾ 2, then a−c ≡ b−d(
mod m).
Practice Assignment PA08 (and solutions)
(Updated Version:
2024-11-20 11:52:09Z)
Page 6 (of 17)
The German University in Cairo (GUC)
Faculty of Media Engineering and Technology (MET)
Dr. Ahmed Ashry, Eng. Passant Abbassi, Eng. Mai Ebrahim, Eng. Esraa Gibreen, Eng. Ahmed El-Refaii
;
PA08 (and solutions) : Number Theory (Full Version)
Winter 2024 (WS24)
Discrete Mathematics
MATH 501 (MET) / MATH 305 (BI)
<
Solution:
From a ≡ b( mod m) we know that b = a + sm for some integer s. Similarly, d = c + tm. Subtracting, we have
b − d = (a − c) + (s − t)m, which means that a − c ≡ b − d( mod m).
Exercise 8–17
Find counterexamples to each of these statements about congruences.
(1) If ac ≡ bc( mod m), where a, b, c, and m are integers with m ⩾ 2, then a ≡ b( mod m).
Solution:
Let m = c = 2, a = 0, and b = 1. Then 0 = ac ≡ bc = 2( mod 2), but 0 = a ̸≡ b = 1( mod 2).
(2) If a ≡ b( mod m) and c ≡ d( mod m), where a, b, c, d, and m are integers with c and d being positive and
m ⩾ 2, then ac ≡ bd ( mod m).
Solution:
Let m = 5, a = b = 3, c = 1, and d = 6. Then 3 ≡ 3( mod 5) and 1 ≡ 6( mod 5), but 31 = 3 ̸≡ 4 ≡
729 = 36 ( mod 5).
Exercise 8–18
Show that if n is an integer, then n2 ≡ 0 or 1( mod 4).
Solution:
There are two cases. If n is even, then n = 2k for some integer k, so n2 = 4k2 , which means that n2 ≡ 0( mod 4). If
n is odd, then n = 2k + 1 for some integer k, so n2 = 4k2 + 4k + 1 = 4(k2 + k) + 1, which means that n2 ≡ 1(
mod 4).
Exercise 8–19
Find the prime factorization of 10!.
Solution:
10! = 10 × 9 × 8 × 7 × 6 × 5 × 4 × 3 × 2 × 1
10! = 2 × 5 × 32 × 23 × 7 × 2 × 3 × 5 × 22 × 3 × 2 × 1
10! = 28 · 34 · 52 · 7
Exercise 8–20
How many zeros are there at the end of 100!?
Solution:
A 0 appears at the end of a number for every factor of 10(= 2 · 5) the number has. Now 100! certainly has more factors of
2 than it has factors of 5, so the number of factors of 10 it has is the same as the number of factors of 5. Each of the twenty
Practice Assignment PA08 (and solutions)
(Updated Version:
2024-11-20 11:52:09Z)
Page 7 (of 17)
The German University in Cairo (GUC)
Faculty of Media Engineering and Technology (MET)
Dr. Ahmed Ashry, Eng. Passant Abbassi, Eng. Mai Ebrahim, Eng. Esraa Gibreen, Eng. Ahmed El-Refaii
;
PA08 (and solutions) : Number Theory (Full Version)
Winter 2024 (WS24)
Discrete Mathematics
MATH 501 (MET) / MATH 305 (BI)
<
numbers 5, 10, 15, ... , 100 contributes a factor of 5 to 100!, and in addition the four numbers 25, 50, 75, and 100 contribute one
more factor of 5. Therefore there are 24 factors of 5 in 100!, so 100! ends in exactly 24 0’s.
Exercise 8–21
Prove that for every positive integer n, there are n consecutive composite integers. [Hint: Consider the n consecutive integers
starting with (n + 1)! + 2.]
Solution:
We follow the hint. There are n numbers in the sequence (n + 1)! + 2, (n + 1)! + 3, (n + 1)! + 4, . . . , (n + 1)! + (n + 1).
The first of these is composite because (n + 1)! + 2 is divisible by 2; the second is composite because it is divisible by 3; the
third is composite because it is divisible by 4;. . . ; and the last is composite because it is divisible by n + 1. This gives us the
desired n consecutive composite integers.
This trick appears to have been discovered first, with a problem created later :). Although not typical of engineering exam
problems, this outside-the-box thinking can help with challenging studies or life situations. Be glad you encountered it!
Exercise 8–22
Which positive integers less than 12 are relatively prime to 12?
Solution:
We must find, by inspection with mental arithmetic, the greatest common divisors of the numbers from 1 to 11 with 12, and list
those whose gcd is 1. These are 1, 5, 7, and 11. There are so few since 12 had many factors-in particular, both 2 and 3.
Exercise 8–23
Show that if 2n −1 is prime, then n is prime. [ Hint: Use the identity 2ab −1 = (2a −1).(2a(b−1) +2a(b−2) +...+2a +1).]
Solution:
Suppose that n is not prime, so that n = ab, where a and b are integers greater than 1. Because a > 1, by the identity in
the hint, 2a − 1 is a factor of 2n − 1 that is greater than 1, and the second factor in this identity is also greater than 1. Hence,
2n − 1 is not prime.
Exercise 8–24
Find gcd(1000, 625) and lcm(1000, 625) and verify that gcd(1000, 625) × lcm(1000, 625) = 1000 × 625.
Solution:
We have 1000 = 23 · 53 and 625 = 54 , so gcd(1000, 625) = 53 = 125, and lcm(1000, 625) = 23 · 54 = 5000. As
expected, 125 · 5000 = 625000 = 1000 · 625.
Exercise 8–25
If the product of two integers is 27 38 52 711 and their greatest common divisor is 23 34 5, what is their least common multiple?
Practice Assignment PA08 (and solutions)
(Updated Version:
2024-11-20 11:52:09Z)
Page 8 (of 17)
The German University in Cairo (GUC)
Faculty of Media Engineering and Technology (MET)
Dr. Ahmed Ashry, Eng. Passant Abbassi, Eng. Mai Ebrahim, Eng. Esraa Gibreen, Eng. Ahmed El-Refaii
;
PA08 (and solutions) : Number Theory (Full Version)
Winter 2024 (WS24)
Discrete Mathematics
MATH 501 (MET) / MATH 305 (BI)
<
Solution:
Since the product of the greatest common divisor and the least common multiple of two numbers is the product of the two
numbers. Therefore the answer is (27 · 38 · 52 · 711 )/(23 · 34 · 5) = 24 · 34 · 5 · 711
Exercise 8–26
Show that if a and b are positive integers, then ab = gcd(a, b) × lcm(a, b). [Hint: Use the prime factorizations of a and b
and the formulae for gcd(a, b) and lcm(a, b) in terms of these factorizations.]
Solution:
Because min(x, y) + max(x, y) = x + y, the exponent of pi in the prime factorization of gcd(a, b) · lcm(a, b) is the sum of the
exponents of pi in the prime factorizations of a and b.
Exercise 8–27
Use the Euclidean algorithm to find
(1) gcd(1, 5).
Solution:
To apply the Euclidean algorithm, we divide the larger number by the smaller, replace the larger by the smaller and the
smaller by the remainder of this division, and repeat this process until the remainder is 0. At that point, the smaller number
is the greatest common divisor.
gcd(1, 5) = gcd(1, 0) = 1
(2) gcd(100, 101).
Solution:
gcd(100, 101) = gcd(100, 1) = gcd(1, 0) = 1
(3) gcd(123, 277).
Solution:
gcd(123, 277) = gcd(123, 31) = gcd(31, 30) = gcd(30, 1) = gcd(1, 0) = 1
Exercise 8–28
Use the extended Euclidean algorithm to express the greatest common divisor of each of these pairs of integers as a linear
combination of these integers.
(1) 9, 11
Solution:
In order to find the coefficients s and t such that 9s + 11t = gcd(9, 11), we carry out the steps of the Euclidean algorithm.
11 = 9 + 2
9 = 4 · 2 + 1 Then we work up from the bottom, expressing the greatest common divisor (which we have just seen to
be 1) in terms of the numbers involved in the algorithm, namely 11, 9, and 2. In particular, the last equation tells us that
1 = 9 − 4 · 2, so that we have expressed the gcd as a linear combination of 9 and 2. But now the first equation tells us
Practice Assignment PA08 (and solutions)
(Updated Version:
2024-11-20 11:52:09Z)
Page 9 (of 17)
The German University in Cairo (GUC)
Faculty of Media Engineering and Technology (MET)
Dr. Ahmed Ashry, Eng. Passant Abbassi, Eng. Mai Ebrahim, Eng. Esraa Gibreen, Eng. Ahmed El-Refaii
;
PA08 (and solutions) : Number Theory (Full Version)
Winter 2024 (WS24)
Discrete Mathematics
MATH 501 (MET) / MATH 305 (BI)
<
that 2 = 11 − 9; we plug this into our previous equation and obtain 1 = 9 − 4 · (11 − 9) = 5 · 9 − 4 · 11. Thus we
have expressed 1 as a linear combination (with integer coefficients) of 9 and 11, namely gcd(9, 11) = 5 · 9 − 4 · 11.
(2) 33, 44
Solution:
Again, we carry out the Euclidean algorithm. Since 44 = 33+11, and 11 | 33, we know that gcd(33, 44) =11. From the
equation shown here, we can immediately write 11 = (−1) · 33 + 44.
(3) 35, 78
Solution:
The calculation of the greatest common divisor takes several steps: 78 = 2 · 35 + 8
35 = 4 · 8 + 3
8=2·3+2
3 = 2+1 Then we need to work our way back up, successively plugging in for the remainders determined in this calculation:
1 = 3 − 2 = 3 − (8 − 2 · 3) = 3 · 3 − 8 = 3 · (35 − 4 · 8) − 8 = 3 · 35 − 13 · 8 = 3 · 35 − 13 · (78 − 2 · 35) =
29 · 35 − 13 · 78
(4) 21, 55
Solution:
Here are the two calculations—down to the gcd using the Euclidean algorithm, and then back up by substitution until we
have expressed the gcd as the desired linear combination of the original numbers. 55 = 2 · 21 + 13 21 = 13 + 8 13 =
8 + 5 8 = 5+3 5 = 3+2 3 = 2+1 Thus the greatest common divisor is 1. 1 = 3 − 2 = 3 − (5 − 3) = 2 · 3 − 5 =
2 · (8 − 5) − 5 = 2 · 8 − 3 · 5 = 2 · 8 − 3 · (13 − 8) = 5 · 8 − 3 · 13 = 5 · (21 − 13) − 3 · 13 = 5 · 21 − 8 · 13 =
5 · 21 − 8 · (55 − 2 · 21) = 21 · 21 − 8 · 55
(5) 101, 203
Solution:
We compute the greatest common divisor in one step: 203 = 2 · 101 + 1. Therefore we have 1 = (-2) · 101 + 203.
(6) 124, 323
Solution:
We compute the greatest common divisor using the Euclidean algorithm: 323 = 2 · 124 + 75 124 = 75 + 49 75 = 49 + 26
49 = 26 + 23 26 = 23 + 3 23 = 7 · 3 + 2 3 = 2+1 Thus the greatest common divisor is 1. 1 = 3 − 2 = 3 − (23 − 7 · 3) =
8·3−23 = 8·(26−23)−23 = 8·26−9·23 = 8·26−9·(49−26) = 17·26−9·49 = 17·(75−49)−9·49 =
17·75−26·49 = 17·75−26·(124−75) = 43·75−26·124 = 43·(323−2·124)−26·124 = 43·323−112·124
(7) 2002, 2339
Solution:
Here are the two calculations—down to the gcd using the Euclidean algorithm, and then back up by substitution until we
have expressed the gcd as the desired linear combination of the original numbers. 2339 = 2002+3372002 = 5·337+
317337 = 317 + 20317 = 15 · 20 + 1720 = 17 + 317 = 5 · 3 + 23 = 2 + 1 Thus the greatest common divisor is
1. 1 = 3−2 = 3−(17−5·3) = 6·3−17 = 6·(20−17)−17 = 6·20−7·17 = 6·20−7·(317−15·20) =
111 · 20 − 7 · 317 = 111 · (337 − 317) − 7 · 317 = 111 · 337 − 118 · 317 = 111 · 337 − 118 · (2002 − 5 · 337) =
701 · 337 − 118 · 2002 = 701 · (2339 − 2002) − 118 · 2002 = 701 · 2339 − 819 · 2002
(8) 3457, 4669
Solution:
The procedure is the same: 4669 = 3457 + 12123457 = 2 · 1212 + 10331212 = 1033 + 1791033 =
5 · 179 + 138179 = 138 + 41138 = 3 · 41 + 1541 = 2 · 15 + 1115 = 11 + 411 = 2 · 4 + 34 = 3 + 1
Practice Assignment PA08 (and solutions)
(Updated Version:
2024-11-20 11:52:09Z)
Page 10 (of 17)
The German University in Cairo (GUC)
Faculty of Media Engineering and Technology (MET)
Dr. Ahmed Ashry, Eng. Passant Abbassi, Eng. Mai Ebrahim, Eng. Esraa Gibreen, Eng. Ahmed El-Refaii
;
PA08 (and solutions) : Number Theory (Full Version)
Winter 2024 (WS24)
Discrete Mathematics
MATH 501 (MET) / MATH 305 (BI)
<
Thus the greatest common divisor is 1. 1 = 4 − 3 = 4 − (11 − 2 · 4) = 3 · 4 − 11 = 3 · (15 − 11) − 11 =
3 · 15 − 4 · 11 = 3 · 15 − 4 · (41 − 2 · 15) = 11 · 15 − 4 · 41 = 11 · (138 − 3 · 41) − 4 · 41 = 11 · 138 − 37 · 41 =
11 · 138 − 37 · (179 − 138) = 48 · 138 − 37 · 179 = 48 · (1033 − 5 · 179) − 37 · 179 = 48 · 1033 − 277 · 179 =
48 · 1033 − 277 · (1212 − 1033) = 325 · 1033 − 277 · 1212 = 325 · (3457 − 2 · 1212) − 277 · 1212 =
325 · 3457 − 927 · 1212 = 325 · 3457 − 927 · (4669 − 3457) = 1252 · 3457 − 927 · 4669
(9) 10001, 13422
Solution:
13422 = 10001 + 3421
10001 = 2 · 3421 + 3159
3421 = 3159 + 262
3159 = 12 · 262 + 15
262 = 17 · 15 + 7
15 = 2 · 7 + 1 Thus the greatest common divisor is 1. 1 = 15 − 2 · 7
= 15 − 2 · (262 − 17 · 15) = 35 · 15 − 2 · 262 = 35 · (3159 − 12 · 262) − 2 · 262 = 35 · 3159 − 422 · 262 =
35 · 3159 − 422 · (3421 − 3159) = 457 · 3159 − 422 · 3421 = 457 · (10001 − 2 · 3421) − 422 · 3421 =
457 · 10001 − 1336 · 3421 = 457 · 10001 − 1336 · (13422 − 10001) = 1793 · 10001 − 1336 · 13422
Exercise 8–29
Show that if a, b, and m are integers such that m ⩾ 2 and a ≡ b( mod m) then gcd(a, m) = gcd(b, m).
Solution:
From a ≡ b( mod m) we know that b = a + sm for some integer s. Now if d is a common divisor of a and m, then it
divides the right-hand side of this equation, so it also divides b. We can rewrite the equation as a = b − sm, and then by similar
reasoning, we see that every common divisor of b and m is also a divisor of a. This shows that the set of common divisors of a
and m is equal to the set of common divisors of b and m, so certainly gcd(a,m) = gcd(b,m).
Practice Assignment PA08 (and solutions)
(Updated Version:
2024-11-20 11:52:09Z)
Page 11 (of 17)
The German University in Cairo (GUC)
Faculty of Media Engineering and Technology (MET)
Dr. Ahmed Ashry, Eng. Passant Abbassi, Eng. Mai Ebrahim, Eng. Esraa Gibreen, Eng. Ahmed El-Refaii
;
PA08 (and solutions) : Number Theory (Full Version)
Winter 2024 (WS24)
Discrete Mathematics
MATH 501 (MET) / MATH 305 (BI)
<
Part (II)
Exercise 8–30
Use the Euclidean algorithm to find gcd(7839, 1474) .
Solution:
Euclidean algorithm:
• Divide 7839 by 1474, get quotient=5 , remainder r1 = 7839 - 5 × 1474 = 469.
• Divide 1474 by 469, get quotient=3, remainder r2 = 1474 - 3 × 469 = 67.
• Divide 469 by 67 , get quotient=7, remainder r3 = 469 - 7 × 67 = 0.
Since we have a remainder of zero, the last nonzero remainder is the greatest common divisor, that is, gcd(7839,1474) =
67.
Exercise 8–31
Use the definition of divisibility to prove that if a|b and b|c then a2 |(b2 + 3bc).
Solution:
Suppose that a|b and b|c so b = ka and c = bl = kal for some k and l that are integers. Hence b2 + 3bc = (ak)2 +
3akkal = a2 (k2 + k2 l) where k2 + k2 l is an integer. Thus a2 |(b2 + 3bc).
Exercise 8–32
Find the remainder when
(1) 82002 is divided by 7
Solution:
82002 ≡ 12002 = 1 (mod 7)
∴ The remainder is 1
(2) 32003 is divided by 26
Solution:
32003 = (33 )667 (32 ) = 27667 32 ≡ 1667 32 = 9 (mod 26)
∴ The remainder is 26
(3) 197820 is divided by 125
Solution:
197820 ≡ (−22)20 = 48410 ≡ (−16)10 ≡ 2565 ≡ 65 = 25 35 = 32 ∗ 243 ≡ 32 ∗ (−7) ≡ 26 (mod 125)
∴ The remainder is 26
Practice Assignment PA08 (and solutions)
(Updated Version:
2024-11-20 11:52:09Z)
Page 12 (of 17)
The German University in Cairo (GUC)
Faculty of Media Engineering and Technology (MET)
Dr. Ahmed Ashry, Eng. Passant Abbassi, Eng. Mai Ebrahim, Eng. Esraa Gibreen, Eng. Ahmed El-Refaii
;
PA08 (and solutions) : Number Theory (Full Version)
Winter 2024 (WS24)
Discrete Mathematics
MATH 501 (MET) / MATH 305 (BI)
<
Exercise 8–33
Theorem 1:
Let a, b, and c be integers, where a ̸= 0. Then
(i) if a | b and a | c, then a | (b + c);
(ii) if a | b, then a | bc for all integers c;
(iii) if a | b and b | c, then a | c.
(1) Prove that part (ii ) of Theorem 1 is true.
Solution:
As hinted in the lectures, suppose that a | b. Then there exists an integer k such that ka = b. Because a(ck) = bc it follows
that a | bc.
(2) Prove that part (iii) of Theorem 1 is true.
Solution:
As hinted in the lectures, suppose a | b, so that b = at for some t, and b | c, so that c = bs for some s. Then substituting
the first equation into the second, we obtain c = (at)s = a(ts) . This means that a | c, as desired.
Exercise 8–34
(Congruence modulo 12)
What time does a 12-hour clock read
(1) 80 hours after it reads 11:00?
Solution:
7:00
(2) 40 hours before it reads 12:00?
Solution:
8:00
(3) 100 hours after it reads 6:00?
Solution:
10:00
Exercise 8–35
(Linear Congruences)
(1) Show that 15 is an inverse of 7 modulo 26.
Solution:
15 × 7 = 105 ≡ 1(mod 26).
Practice Assignment PA08 (and solutions)
(Updated Version:
2024-11-20 11:52:09Z)
Page 13 (of 17)
The German University in Cairo (GUC)
Faculty of Media Engineering and Technology (MET)
Dr. Ahmed Ashry, Eng. Passant Abbassi, Eng. Mai Ebrahim, Eng. Esraa Gibreen, Eng. Ahmed El-Refaii
;
Winter 2024 (WS24)
Discrete Mathematics
MATH 501 (MET) / MATH 305 (BI)
PA08 (and solutions) : Number Theory (Full Version)
<
(2) Show that 937 is an inverse of 13 modulo 2436.
Solution:
We need to show that 13 × 937 ≡ 1(mod 2436), or in other words, that 13 × 937 − 1 = 12180 is divisible by 2436.
A calculator shows that it is, since 12180 = 2436 × 5.
(3) By inspection, find an inverse of 4 modulo 9.
Solution:
We need a number that when multiplied by 4 gives a number congruent to 1 modulo 9. Then, we need to solve 4x ≡
1(mod 9).
9 | 4x − 1 by inspection, we found that 9 | 9 , 9 | 18 won’t work, and 9 | 27 will work.
Therefore, 4x − 1 = 27 solving for x,we will get x = 7.
Hence, 7 is an inverse of 4 modulo 9
(4) By inspection, find an inverse of 2 modulo 17
Solution:
We need a number that when multiplied by 2 gives a number congruent to 1 modulo 17. Then, we need to solve 2x ≡
1(mod 17).
Since, 18 ≡ 1(mod 17), and 2 × 9 = 18
therefore, 9 is an inverse of 2 modulo 17
Exercise 8–36
(Linear Congruences)
Find an inverse of a modulo m for each of these pairs of relatively prime integers using Bezout’s Theorem.
(1) a = 2, m = 17.
(3) a = 144, m = 233.
(2) a = 34, m = 89.
(4) a = 200, m = 1001.
Solution:
In this exercise, we need to find s and t such that a×s+m×t = 1. Then s will be the desired inverse, since a.s ≡ 1(mod m)
(i.e., a.s − 1 = m.t is divisible by m).
(1) It can be shown directly that 17 = 8 × 2 + 1. Hence, −8 is an inverse. We can also say that 9 is an inverse, because
−8 ≡ 9(mod 17)
(2) We need to find s and t such that 34s + 89t = 1. Then s will be the desired inverse, since 34.s ≡ 1(mod 89) (i.e.,
34s − 1 = −89t is divisible by 89). First we go through the Euclidean algorithm computation that gcd (34, 89) = 1:
89 = 2 × 34 + 21
34 = 21 + 13
21 = 13 + 8
13 = 8 + 5
8=5+3
5=3+2
3=2+1
Then we reverse our steps and write 1 as the desired linear combination:
1=3−2
= 3 − (5 − 3) = 2.3 − 5
= 2.(8 − 5) − 5 = 2.8 − 3.5
= 2.8 − 3.(13 − 8) = 5.8 − 3.13
Practice Assignment PA08 (and solutions)
(Updated Version:
2024-11-20 11:52:09Z)
Page 14 (of 17)
The German University in Cairo (GUC)
Faculty of Media Engineering and Technology (MET)
Dr. Ahmed Ashry, Eng. Passant Abbassi, Eng. Mai Ebrahim, Eng. Esraa Gibreen, Eng. Ahmed El-Refaii
;
Winter 2024 (WS24)
Discrete Mathematics
MATH 501 (MET) / MATH 305 (BI)
PA08 (and solutions) : Number Theory (Full Version)
<
= 5.(21 − 13) − 3.13 = 5.21 − 8.13
= 5.21 − 8.(34 − 21) = 13.21 − 8.34
= 13.(89 − 2.34) − 8.34 = 13.89 − 34.34
Thus s = −34, so an inverse of 34 modulo 89 is −34, which can also be written as 55.
(3) We need to find s and t such that 144s + 233t = 1. Then s will be the desired inverse, since 144.s ≡ 1(mod 233) (i.e.,
144s − 1 = −233t is divisible by 89). First we go through the Euclidean algorithm computation that gcd (144, 233) =
1:
233 = 144 + 89
144 = 89 + 55
89 = 55 + 34
55 = 34 + 21
34 = 21 + 13
21 = 13 + 8
13 = 8 + 5
8=5+3
5=3+2
3=2+1
Then we reverse our steps and write 1 as the desired linear combination:
1=3−2
= 3 − (5 − 3) = 2.3 − 5
= 2.(8 − 5) − 5 = 2.8 − 3.5
= 2.8 − 3.(13 − 8) = 5.8 − 3.13
= 5.(21 − 13) − 3.13 = 5.21 − 8.13
= 5.21 − 8.(34 − 21) = 13.21 − 8.34
= 13.(55 − 34) − 8.34 = 13.55 − 21.34
= 13.55 − 21.(89 − 55) = 34.55 − 21.89
= 34.(144 − 89) − 21.89 = 34.144 − 55.89
= 34.144 − 55.(233 − 144) = 89.144 − 55.233
Thus s = 89, so an inverse of 144 modulo 233 is 89,144.89 = 12816 ≡ 1(mod 233)
(4) The first step in the Euclidean algorithm calculation is 1001 = 5 × 200 + 1.Thus −5 × 200 + 1001 = 1, and −5
(or 996) is the desired inverse.
Exercise 8–37
(Linear Congruence!)
Show that an inverse of a modulo m, where a is an integer and m > 2 is a positive integer, does not exist if gcd(a, m) > 1
Solution:
If x is an inverse of a modulo m, then by definition ax − 1 = tm for some integer t.
If a and m in this equation both have a common divisor greater than 1, then 1 must also have this same common divisor, since
1 = ax − tm.This is absurd, since the only positive divisor of 1 is 1. Therefore, no such x exists.
Exercise 8–38
(Inverses!)
Solve the congruence 4x ≡ 5(mod 9). using the inverse of 4 modulo 9
Solution:
7 is an inverse of 4 modulo 9. Therefore if we multiply both sides of this equation by 7 we will get
x ≡ 7 × 5(mod 9). Since 35(mod 9) = 8, the solutions are all integers congruent to 8 modulo 9, such as 8, 17, and −1.
Practice Assignment PA08 (and solutions)
(Updated Version:
2024-11-20 11:52:09Z)
Page 15 (of 17)
The German University in Cairo (GUC)
Faculty of Media Engineering and Technology (MET)
Dr. Ahmed Ashry, Eng. Passant Abbassi, Eng. Mai Ebrahim, Eng. Esraa Gibreen, Eng. Ahmed El-Refaii
;
Exercise 8–39
Winter 2024 (WS24)
Discrete Mathematics
MATH 501 (MET) / MATH 305 (BI)
<
PA08 (and solutions) : Number Theory (Full Version)
(Linear Congruence!)
Solve the congruence 2x ≡ 7(mod 17). using the inverse of 2 modulo 17
Solution:
9 is an inverse of 2 modulo 17. Therefore if we multiply both sides of this equation by 9 we will get
x ≡ 9 × 7(mod 17). Since 63(mod 17) = 12, the solutions are all integers congruent to 12 modulo 17, such as 12, 29, and
−5.
We can check, for example, that 2 × 12 = 24 ≡ 7(mod 17)
This answer can also be stated as all integers of the form 12 + 17k for k ∈ Z.
Exercise 8–40
(Linear Congruence!)
Solve each of these congruence using the modular inverses
(1) 34x ≡ 77(mod 89)
(2) 144x ≡ 4(mod 233)
(3) 200x ≡ 13(mod 1001)
Solution:
In each case we multiply both sides of the congruence by the inverse found in Exercise 5 and simplify. Our answers are not
unique, of course—anything in the same congruence class works just as well.
(1) We found that 55 is an inverse of 34 modulo 89,so x ≡ 77 × 55 = 4235 ≡ 52(mod 89)
Check: 34 × 52 = 1768 ≡ 77(mod 89)
(2) We found that 89 is an inverse of 144 modulo 233,so x ≡ 4 × 89 = 356 ≡ 123(mod 233)
Check: 144 × 123 = 17712 ≡ 4(mod 233)
(3) We found that -5 is an inverse of 200 modulo 1001,so x ≡ 13 × −5 = −65 ≡ 936(mod 1001), (We could also leave
the answer as −65.)
Check: 200 × 936 = 187200 ≡ 13(mod 1001)
Exercise 8–41
(1) Show that the positive integers less than 11, except 1 and 10, can be split into pairs of integers such that each pair consists
of integers that are inverses of each other modulo 11.
(2) Use part (a) to show that 10! ≡ −1(mod 11).
Solution:
(1) We can find inverses by inspection, we find that 2 × 6 ≡ 1(mod 11), 3 × 4 ≡ 1(mod 11), 5 × 9 ≡ 1(mod 11) and
7 × 8 ≡ 1(mod 11). Actually, the problem does not ask us to show these pairs explicitly, only to show that they exist.
(2) In this specific case we can compute 10! = 1 × 2 × 3 × 4 × 5 × 6 × 7 × 8 × 9 × 10 = 1 × (2 × 6) × (3 × 4) ×
(5 × 9) × (7 × 8) × 10 ≡ 1 × 1 × 1 × 1 × 10 = 10 ≡ −1(mod 11)
Practice Assignment PA08 (and solutions)
(Updated Version:
2024-11-20 11:52:09Z)
Page 16 (of 17)
The German University in Cairo (GUC)
Faculty of Media Engineering and Technology (MET)
Dr. Ahmed Ashry, Eng. Passant Abbassi, Eng. Mai Ebrahim, Eng. Esraa Gibreen, Eng. Ahmed El-Refaii
;
Exercise 8–42
PA08 (and solutions) : Number Theory (Full Version)
Winter 2024 (WS24)
Discrete Mathematics
MATH 501 (MET) / MATH 305 (BI)
<
(Congruence Equations)
Solve the system of congruence x ≡ 3(mod 6) and x ≡ 4(mod 7) using the method of back substitution.
Solution:
By definition, the first congruence can be written as x = 6t + 3 where t is an integer. Substituting this expression for x into
the second congruence tells us that 6t + 3 ≡ 4(mod 7), which can easily be solved to show that t ≡ 6(mod 7).
From this we can write, t = 7u + 6 for some integer u. Thus, x = 6t + 3 = 6(7u + 6) + 3 = 42u + 39.
Thus, the answer is all numbers congruent to 39 modulo 42.This answer is confirmed as follows 39 ≡ 3(mod 6) and 39 ≡
4(mod 7)
Exercise 8–43
(Chinese Remainder Theorem!)
Which integers are divisible by 5 but leave a remainder of 1 when divided by 3?
Solution:
We are asked to solve x ≡ 0(mod 5) and x ≡ 1(mod 3). It is probably quickest just to look for it by dividing each multiple of
5 by 3, and we see immediately that x = 10 satisfies the condition. Thus the solutions are all integers congruent to 10 modulo 15
Exercise 8–44
Show that (3K + 2) ⊥ (5K + 3), where K ≥ 0.
Solution:
gcd(a, b) = 1 if and only if ∃x ∃y ∈ Z such that ax + by = 1
∵ gcd(a, b) | a and gcd(a, b) | b
∴ gcd(a, b) | ax and gcd(a, b) | by
∴ gcd(a, b) | ax + by = 1
∴ gcd(a, b) = 1
By inspection, find two integers x, y such that (3K + 2)x + (5K + 3)y = 1
by solving, we found that x = 5&y = −3.
Another solution:
Using the property: gcd(n, m) = gcd((max(n, m) − min(n, m)), min(n, m))
gcd(3K + 2, 5K + 3) = gcd(2K + 1, 3K + 2) = gcd(K + 1, 2K + 1)
gcd(K + 1, 2K + 1) = gcd(K, K + 1)
gcd(K, K + 1) = gcd(1, K) = 1
Therefore, 3K + 2 and 5K + 3 are relatively prime.
Practice Assignment PA08 (and solutions)
(Updated Version:
2024-11-20 11:52:09Z)
Page 17 (of 17)
Download