


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Solutions to four exercises related to discrete structures. The exercises cover topics such as survey data analysis, inclusion-exclusion principle, integer solutions of equations, and permutations. The solutions are presented in a step-by-step manner, with explanations and calculations. useful for students studying discrete structures or related topics in mathematics and computer science.
Typology: Assignments
1 / 4
This page cannot be seen from the preview
Don't miss anything!



Exercise 1 (10 points). In a survey on the gelato preferences of college students, the following data was obtained:
How many students were surveyed?
Solution Let the set of students who like mixed berry be M , those who like tiramisu be T and those who like irish cream be I. Then, by the inclusion-exclusion principle, the number of students who like at least one of the flavours is
|M ∪ T ∪ I| = |M | + |T | + |I| − |M ∩ T | − |T ∩ I| − |M ∩ I| + |M ∩ T ∩ I| = 78 + 32 + 57 − 16 − 21 − 13 + 5 = 122
Now there are an additional 14 who like none of these three flavours, so the total number of students surveyed was 122 + 14 = 136.
Exercise 2 (10 points). In a mathematics contest with three problems, 80% of the participants solved the first problem, 75% solved the second and 70% solved the third. Prove that at least 25% of the participants solved all three problems. (The claim might seem obvious — find a proof.)
Solution Let the total number of participants be n > 0 (if n = 0, the proof is trivial). Denote the set of people who missed the first problem by A, the set of people who missed the second by B, and the set who missed the third by C. We know that |A| = n − 0. 8 n = 0. 2 n, |B| = n − 0. 75 n = 0. 25 n and |C| = n − 0. 7 n = 0. 3 n. We also know, from the lecture notes, that
|A ∪ B ∪ C| ≤ |A| + |B| + |C| = 0. 2 n + 0. 25 n + 0. 3 n = 0. 75 n
The set of people who solved all three problems is the complement of A ∪ B ∪ C (the set who missed at least one problem), so it has size
n − |A ∪ B ∪ C| ≥ n − 0. 75 n = 0. 25 n
Therefore at least 25% of the participants solved all three problems.
Exercise 3 (20 points).
(a) What is the number of integer solutions of the equation x 1 + x 2 + x 3 = 50, such that xi ≥ 0 for each 1 ≤ i ≤ 3? (b) What is the number of integer solutions of the equation x 1 + x 2 + x 3 = 50, such that 0 ≤ xi ≤ 19 for each 1 ≤ i ≤ 3?
Solution
(a) We need to distribute 50 “units” between 3 variables. The situation is equivalent to distributing 50 balls into 3 bins, or analogously, selecting an unordered collection of 50 balls of 3 types, where those of the first type will go in the first bin, those of the second type in the second bin, and those of the third type in the third bin. The number of options for this is
50
50
= 1326. This is also the requested number of solutions. (b) For 1 ≤ i ≤ 3, let Si be the set of solutions in which xi ≥ 20. Then the requested number of solutions is 1326 −
i=
Si
using the result of part (a). For 1 ≤ i < j ≤ 3, define Si,j = Si ∩ Sj. Finally, let S 1 , 2 , 3 = S 1 ∩ S 2 ∩ S 3. The inclusion exclusion principle implies that ∣∣ ∣∣
i=
Si
i=
|Si| − |S 1 , 2 | − |S 2 , 3 | − |S 1 , 3 | + |S 1 , 2 , 3 |.
Let us analyze the summands on the right side in turn. |S 1 | is the number of solutions in which x 1 ≥ 20. This is equivalent to counting solutions to the equation x′ 1 + x 2 + x 3 = 30, where x′ 1 = x 1 − 20, and thus x′ 1 , x 2 , x 3 ≥ 0. The argument in part (a) implies that |S 1 | =
2
The derivation for |S 2 | and |S 3 | is symmetric. Similarly, |S 1 , 2 | is equal to the number of nonnegative solutions to x′ 1 + x′ 2 + x 3 = 10, which is 66 and is also equal to |S 2 , 3 | and |S 1 , 3 |. Finally, |S 1 , 2 , 3 | = 0. Putting all the values together we get ∣∣ ∣ ∣
i=
Si
and the requested number of solutions is 1326 − 1290 = 36.
Exercise 4 (10 points). Let p(1), p(2),... , p(n) be some permutation of the first n positive integers, where n is odd. Prove that the product ∏n
i=
(i − p(i))
is necessarily even. (Assume as usual that an even number need not be positive.) Is the condition that n is odd necessary?
(c) f (x) = Θ(g(x)). Note that g(x) = 1 for all x ∈ N+. We can show that f (x) ≤ 2 for all x ∈ N+: Consider the equation y = f (x) and rearrange to yx^ = x. Since 2x^ ≥ x, y ≤ 2 for all x ∈ N+. Clearly f (x) > 1 for all x ∈ N+. These bounds ensure that g(x) < f (x) ≤ 2 g(x), so f (x) = Θ(g(x)).
Exercise 7 (20 points). Prove or disprove the following properties:
(a) For f, g, p, q : N+^ → R, if f (n) = O(p(n)) and g(n) = O(q(n)), then f (g(n)) = O(p(q(n)).
(b) For f, p : N+^ → R and g, q : N+^ → N+, if f (n) = O(p(n)), g(n) = O(q(n)), and p(n), q(n) > 0 for all n, then (f (n))g(n)^ = O((p(n))q(n)).
Solution
(a) This does not hold for all functions f, g, p, q. A counterexample is f (n) = (^) n^13 , g(n) = n, p(n) = (^) n^12 , and q(n) = n^2. Since a smaller polynomial power is always big-O of a larger one, f (n) = O(p(n)) and g(n) = O(q(n)). The composed functions are f (g(n)) = (^) n^13 and p(q(n)) = (^) n^14. For any positive constant c, f (g(n)) > c(p(q(n))) when n > c, so f (g(n)) 6 = O(p(q(n))). Note that observing that p(q(n)) = O(f (g(n))) is not sufficient to conclude f (g(n)) 6 = O(p(q(n))).
(b) This also does not hold for all functions. For a simple example, take f (n) = p(n) = 2, g(n) = 2n, and q(n) = n. Clearly these fit the given big-O conditions. The combined functions are (f (n))g(n)^ = 22 n^ = 4n^ and (p(n))q(n)^ = 2n. 4n^6 = O(2n) — for any positive constant c, when n > log 2 c, 4n^ > c · 2 n.