Discrete Math Solutions
Discrete Math Solutions
Discrete Math Solutions
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.)
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
g) ∀a, b, c : (a | b ∧ a | c) ⇐⇒ ∃n, m ∈ Z : an = b ∧ am = c ⇐⇒ b + c =
a(n + m) =⇒ a | b + c
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.
b − a = m(t − k) =⇒ m | b − a
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
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)
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
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?
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. 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