Discrete Math Solutions

You are on page 1of 6

EXERCISE SET 6,

MS-A0402, FOUNDATIONS OF DISCRETE MATHEMATICS

Explorative exercises
Problem 1. To practice your understanding of the divisibility definition and of
logical symbols, detemine whether the following statements are true or false. (All
quantifiers are taken over the integers Z.)

Solution. Since for a, b, n ∈ Z we have a | b ⇐⇒ ∃n s.t. an = b

a) ∀a : a1 = a =⇒ a | a

b) ∀a : 1n = a ⇐⇒ n = a =⇒ 1 | a

c) This statement is false. Assume that it was true. Then, any integer would
divide the number 1. Take a = 2. Then, there would exist an integer n such that
an = 1, which is a contradiction.

d) This statement is false. However, note that in number theory it may be defined
so that 0 divides 0 so this would hold for a = 0; see e.g. https://wstein.org/ent/ent.pdf
pp. 2

e) ∀a : 0a = 0 =⇒ a | 0

f) This statement is false. ∀a, b : a | b ⇐⇒ ∃n : an = b ⇐⇒ (a = b ∧ n =


1) ∨ (n = b ∧ a = 1) hence taking n 6= 1 and b 6= a contradicts the statement.

g) ∀a, b, c : (a | b ∧ a | c) ⇐⇒ ∃n, m ∈ Z : an = b ∧ am = c ⇐⇒ b + c =
a(n + m) =⇒ a | b + c

h) ∀a, b, c : (a | b ∧ b | c) ⇐⇒ ∃n, m ∈ Z : an = b ∧ bm = c ⇐⇒ anm = c =⇒


ac

i) ∀a, b : (a | b ∧ b | a) ⇐⇒ ∃n, m ∈ Z : an = b ∧ bm = a ⇐⇒ bnm = b ⇐⇒


nm = 1 ⇐⇒ (n = m = 1 ∨ n = m = −1) =⇒ (a = b ∨ a = −b)

Problem 2. List all the integers that divide 98. Do the same with all numbers
that divide 105. What is the greatest common divisor of 98 and 105?

Solution. The divisors of 98 are 1, 2, 7, 14, 49, 98 and the divisors of 105 are 1, 3,
5, 7, 15, 21, 35, 105. The greatest common divisor, gcd, of these two numbers is 7.

Problem 3. The method used in Problem 2 to find the greatest common divisor is
very inefficient if the numbers involved are large. Already computing, for example,
gcd(2331, 2037) with this method seems like a disturbingly slow task. We will now
find an easier algorithm to do this:
1
2 EXERCISE SET 6, MS-A0402, FOUNDATIONS OF DISCRETE MATHEMATICS

Solution.
a) Show that, if a, b, n ∈ Z, then the common divisors of a and b are the same as
the common divisors of a and b − na.

Assume that m ∈ Z is an arbitrary common divisor of a and b. Then ∃k, t ∈ Z


such that km = a and tm = b. But then

b − a = m(t − k) =⇒ m | b − a

Repeating the above n times gives us

m | b − na

b) Clearly the gcd of two numbers has the symmetric property as it is by definition
a divisor of both of the numbers. Hence gcd(a, b) = gcd(b, a). Applying the part
a) result gives us

gcd(2331, 2037) = gcd(2037, 2331) = gcd(2037, 2331 − 2037) = gcd(2037, 294)

c) Repeating the part b) procedure gives

gcd(2037, 294) = gcd(294, 2037 − 6 · 294) = gcd(294, 273) . . .

d) Since by 1a), 1d) and 1e) we know that ∀a : a | 0 and ∀ : a : a | a but ¬(∀a : 0 | a)
we know that gcd(a, 0) = a. (Termination of our algorithm)

e) Apply for gcd(2331, 2037):

gcd(2331, 2037)
= gcd(2037, 2331 − 2037)
= gcd(2037, 294)
= gcd(294, 273)
= gcd(273, 21)
= gcd(21, 273 − 13 · 21) = gcd(21, 0) = 21

Hence gcd(2331, 2037) = 21

Problem 4. Use your computations in Problem 3 backwards, to find an integer


solution to the equation
21 = 2331x + 2037y

Solution. (See ”Bezout’s lemma”).


Applying the algorithm ”backwards” (you might wanna write the previos part out
EXERCISE SET 6, MS-A0402, FOUNDATIONS OF DISCRETE MATHEMATICS 3

with remainders from top to down if it’s hard to follow from this presentation):
21 = 294 − 273
21 = 294 − (2037 − 6 · 294)
21 = 7 · 294 − 2037
21 = 7 · (2331 − 2037) − 2037
21 = 7 · 2331 − 8 · 2037
Hence x = 7, y = −8 is one solution.
Problem 5. Study the equation
3x − 2y = 1
Clearly, it has the integer solution x = 1, y = 1.
Solution.
a) Can you find more integer solutions?

Seems like if we take x = 3 and y = 4 we have


3·3−2·4=9−8=1
which seems to be another solution. Similarly for x = 5 and y = 7 we have
15 − 14 = 1
More generally, it seems like we can give all the solutions as linear combination
of the previous results.

b) Can you find all integer solutions?

It seems like all the integer solutions can be given in a closed form as
x = 2n + 1, y = 3n + 1
where n ∈ Z. To see why all of the solutions must be of this form, assume that
the that you have integers a, b such that they form a solution to the equation
and try to argue why a and b must be of the form above; use problems 3/4 to
your help.
4 EXERCISE SET 6, MS-A0402, FOUNDATIONS OF DISCRETE MATHEMATICS

Homework
The written solutions to the homework problems should be handed in on My-
Courses by Friday 3.4, 18:00. You will then get the homeworks of two fellow stu-
dents sent to you, and should grade those within one week. You are allowed and
encouraged to discuss the exercises with your fellow students, but everyone should
write down their own solutions.

Problem 1. How many integers less than 59400 are relateively prime to 59400?
(Hint: Factorize!)

Solution. Factorize 59400 = 23 · 33 · 52 · 11. The Euler’s ϕ-function counts the


relatively prime integers.
ϕ(59400) = ϕ(23 · 33 · 52 · 11)
= ϕ(23 )ϕ(33 )ϕ(52 )ϕ(11)
= (2 − 1)23−1 (3 − 1)33−1 (5 − 1)52−1 (11 − 1)111−1
= 26 · 32 · 52
= 14400

Problem 2. Is [1849] invertible in Z2020 ? If it is, compute the inverse.

Solution. An element [n] is invertible in Z2020 if and only if gcd(n, 2020) = 1. To


compute gcd(1849, 2020) we can use the Euclidean algorithm:
2020 = 1 · 1849 + 171
1849 = 10 · 171 + 139
171 = 1 · 139 + 32
139 = 4 · 32 + 11
32 = 2 · 11 + 10
11 = 1 · 10 + 1
10 = 10 · 1 + 0
Thus gcd(1849, 2020) = 1 and the element [1849] is invertible.
Next we want to find the inverse of [1849]. For this we will make use of the
Euclidean algorithm again to write
1 = 11 − 10 = 11 − (32 − 11) = 2 · 11 − 32
= 2(139 − 4 · 32) − 32 = 139 − 5 · 32
= 139 − 5 · (171 − 139) = 6 · 139 − 5 · 171
= 6 · (1849 − 10 · 171) − 5 · 171 = 6 · 1849 − 65 · 171
= 6 · 1849 − 65 · (2020 − 1849)
= 71 · 1849 − 65 · 2020
Then computing in modulo 2020
1 ≡ 71 · 1849 − 65 · 2020 ≡ 71 · 1849(mod 2020)
Hence the inverse element of [1849] is [71].

Problem 3. Find all non-negative integer solutions x, y ∈ N to the equation


7x + 11y = 300.
(Hint: First find all solutions in Z, and then investigate which of them are in N!)
EXERCISE SET 6, MS-A0402, FOUNDATIONS OF DISCRETE MATHEMATICS 5

Solution. We first compute all the integer solutions. The greatest common divisor
of 7 and 11 is 1 since both are primes. We have that 1|300 so the equation has integer
solutions. If (x, y) is a particular integer solution to the equation, then all the other
integer solutions are given by (x + 11n, y − 7n) with n ∈ Z. A particular solution
can be obtained either by using the extended Euclidean algorithm, or noting that
7 · 10 = 70, 11 · 10 = 110, 3 · 7 = 21 and 9 · 11 = 99 giving 70 + 110 + 21 + 99 =
300 so x = 13 and y = 19 is a solution. The general solution is of the form
(13 + 11n, 19 − 7n). Now we can find all n that give positive integer solutions. If
n > 2 then 19 − 7n < 0 and if n < −1 then 13 + 11n < 0, therefore the possible
range for n is −1 ≤ n ≤ 2. This gives four nonnegative integer solutions that are
(35, 5), (24, 12), (13, 19) and (2, 26).
Note that if a different particular solution has been chosen, then the exact for-
mula of the general solution differs from the one in this solution.

Additional problems
Exercise 1. How many integers less than 200 are relateively prime to 200?

Solution. The solution has same idea as homework Problem 1, using the Euler’s
ϕ function.
ϕ(200) = ϕ(23 )ϕ(52 ) = 22 · 4 · 5 = 80

Exercise 2. Compute
a) 319 mod 13.
b) 412 mod 27.
c) 1227 mod 15.

Solution.
a) Note that 33 ≡ 27 ≡ 1 mod 13. Then
319 ≡ 3 · 318 ≡ 3 · (33 )6 ≡ 3 · 16 ≡ 3 mod 13.
b) We have that 45 ≡ 52 ≡ −1 mod 27. Then
412 ≡ 42 · (45 )2 ≡ 42 ≡ 16 mod 27.
c) Here we have that 12 ≡ −3 mod 15 and (−3)3 ≡ −27 ≡ 3 mod 15 and 33 ≡ −3
mod 15. Then
1227 ≡ (((−3)3 )3 )3 ≡ (33 )3 ≡ (−3)3 ≡ 3 mod 15

Exercise 3. Compute the last two digits of 22010 .

Solution. Computing the last 2 digits of a number is the same as computing it in


modulo 100. Thus
22010 ≡ (210 )201 ≡ (243 )67 ≡ (1024)67 ≡ 2467 ≡ 24·2412 ≡ 24·24·24 ≡ 24 mod 100

Exercise 4. Show that


144|n8 − 2n6 + n4
for any integer n. (Hint: Factorize!)
6 EXERCISE SET 6, MS-A0402, FOUNDATIONS OF DISCRETE MATHEMATICS

Solution. Factorize n8 − 2n6 + n4 = n4 (n2 − 1)2 = n4 ((n − 1)(n + 1))2 = (n(n −


1)(n + 1))2 and 144 = 16 · 9. Any three consecutive numbers are always divisible
by three and since it is inside a square it is divisible by 9. If n is even n4 in the
first factorization gives that is is divisible by 16. If n is odd then (n − 1)(n + 1) is
product of two even numbers and thus divisible by 4 and again the square will give
the final divisibility by 16.
Exercise 5. Solve the following congruences for x:
a) 7x ≡ 12 mod 13.
b) 84x − 38 ≡ 79 mod 15.
c) 20x ≡ 23 mod 14.
Solution.
a) gcd(7, 13) = 1 so 7 has an inverse. 7−1 = 2 and x ≡ 2 · 12 ≡ −2 mod 13.
b) Rewrite as 9x ≡ −3 mod 15 and solve note that 9 · 3 = 27 ≡ −3, thus we have
solution x ≡ 3 mod 15.
c) no solution
Exercise 6. Find an integer solution to this system of congruences: (Bonus prob-
lem: Find all!)
x≡2 mod 5
x≡3 mod 7
x≡4 mod 11
Solution. Use the Chinese remainder theorem. N = 5 · 7 · 11 = 385. Then we have
yi = nNi , that is y1 = 77, y2 = 55 and y3 = 35. Then we compute the inverses zi of
yi in modulo ni . So z1 = 3, z2 = 6 and z3 = 6 and the solution is
a1 y1 z1 + a2 y2 z2 + a3 y3 z3 = 770 + 990 + 840 ≡ 290 mod 385
.
Exercise 7 (challenging). Let Fn be the n:th Fibonnacci number.
a) What is gcd(Fn , Fn−1 )?
b) How many steps does Euclid’s algorithm take to compute gcd(Fn , Fn−1 )?
c) Show that, if a, b are any numbers with b ≤ a < Fn , then Euclid’s algo-
rithm requires more steps to compute gcd(Fn , Fn−1 ), than to compute gcd(a, b).
(Punchline: The Fibonnacci numbers are the worst possible input for Euclid’s
algorithm.)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy