



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 for homework 7 of the discrete mathematical structures course at the university of illinois. It includes proofs related to big-o notation, induction, recursive definitions, and structural induction.
Typology: Assignments
1 / 5
This page cannot be seen from the preview
Don't miss anything!




(a) x (^2) +x x+1 is^ O(x
Solution: Note that x (^2) +x x+1 =^ x^ for^ x^ ≥^0. Certainly^ x^ ≤^ x
(^2) for x > 0 , so if we choose k = 0 and C = 1, it is easy to see that x (^2) +x x+ is O(x^2 ). (b) x^3 is O(x^4 ), but x^4 is not O(x^3 )
Solution: x^3 ≤ x^4 when x > 0 , so choosing k = 0 and C = 1 show that x^3 is O(x^4 ). Now, imagine that x^4 was O(x^3 ). Then there would exist some k and C such that x^4 ≤ Cx^3 for all x > k. Dividing through by x^3 gives x ≤ C. But C is a constant, while x can be arbitrarily large, so no such C and k exist, and x^4 is not O(x^3 ). (c) 10 x + 100 is Θ(x)
Solution: We must show that 10 x + 100 is O(x) and Ω(x). First, clearly for x > 0 it is the case that 10 x + 100 ≥ x, so choosing k = 0 and C = 1 shows that 10 x + 100 is Ω(x). Secondly, if x > 100 then 10 x + 100 ≤ 11 x, so choosing k = 100 and C = 11 shows that 10 x + 100 is O(x). Thus, 10 x + 100 is Θ(x). (d) log 10 x is Θ(log 2 x)
Solution: Note that by the change-of-base formula, log 10 x = log 2 x log 2 10 , so choosing^ k^ = 0^ and^ C^ =^
1 log 2 10 shows that^ log^10 x^ is both O(log 2 x) and Ω(log 2 x) – in other words, it is Θ(log 2 x).
Define the function f on the natural numbers by:
(1) f (0) = 0 (2) For every k > 0 , f (k) = k + f (b k 3 c) + f (b k 5 c) + f (b k 7 c)
Use strong induction to prove that f (k) < 4 k for every k > 0. Solution: Base case: f (1) = 1 + 3f (0) = 1 < 4. Inductive step: Assume f (j) < 4 j for all 0 < j < k. We must show that f (k) < 4 k. First, consider the case where k < 3. Then b k 3 c, b k 5 c, and b k 7 c are all equal to 0 , and f (k) = k which is less than 4 k (since k > 0 ). Next, consider the case where k ≥ 3. Then b k 3 c > 0 , so we can apply the inductive hypothesis to get f (b k 3 c) < 4 b k 3 c. Since bkc ≤ k, this implies that f (b k 3 c) < 43 k. Now, b k 5 c is either greater than or equal to 0. In the former case, following the above line of reasoning for b k 3 c, we find that f (b k 5 c) < 4 k
k 5 c)^ < 4 k
k 7 c)^ <^
4 k
Adding the terms together gives f (k) < k + 43 k + 45 k + 47 k = 389105 k , which is less than 4 k for k > 0. Thus, for all k > 0 , f (k) < 4 k. Alternate solution: Alternatively, we can simplify the inductive step by proving more base cases. Base cases: f (1) = 1 + 3f (0) = 1 < 4. f (2) = 2 + 3f (0) = 2 < 8. f (3) = 3 + f (1) + 2f (0) = 4 < 12. f (4) = 4 + f (1) + 2f (0) = 5 < 16. f (5) = 5 + f (1) + f (1) + f (0) = 7 < 20. f (6) = 6 + f (2) + f (1) + f (0) = 9 < 24. Inductive step: Assume f (j) < 4 j for all 0 < j < k, where k ≥ 7. We must show that f (k) < 4 k. Since k ≥ 7 , b k 3 c, b k 5 c, and b k 7 c are all at least 1 , and so we can apply our inductive hypothesis to get f (k) = k + f (b k 3 c) + f (b k 5 c) + f (b k 7 c) < k + 4b k 3 c + 4b k 5 c + 4b k 7 c. Since bxc ≤ x, we know that f (k) < k + 43 k + 45 k + 47 k = 389105 k , which is less than 4 k for k > 0. Thus, for all k > 0 , f (k) < 4 k.
(a) Suppose that A = (x, y) and B = (p, q) are 2D points with real coordinates. Here is the definition of a simple, familiar geomet- rical object based on A and B. Name it!
X(A, B) = {(αx + (1 − α)p, αy + (1 − α)q) : α ∈ [0, 1]}
Remember that [0, 1] is the set of real numbers between 0 and 1, inclusive. Solution: X(A, B) is the line segment between (x, y) and (p, q). (b) The set T ∈ R^2 is defined by (1) (1, 0), (1, 3), (4, 0) ∈ T (2) If (x, y) ∈ T , then (−x, y) ∈ T. (3) If (x, y) ∈ T and (p, q) ∈ T , then (αx + (1 − α)p, αy + (1 − α)q) ∈ T , for every α ∈ [0, 1], Describe the contents of T in words, draw a picture of the set, and briefly justify your answer. Solution: Given the result from part a, rule 3 says that for any two points in T , all the points on the line segment between them are also in T. What are the implications of this rule? First, it is certainly the case that the line segments between the three points in rule 1 are in T – in other words, the edges of the triangle whose corners are (1, 0), (1, 3), and (4, 0) are in T. Let’s call this triangle R. Furthermore, we can apply rule 3 to the points added in this way, so the line segment between any two points on the edge of the triangle is also in T. Thus, the entire interior of the triangle R is in T. Now, applying rule 2 adds the reflection of the triangle R over the y-axis. So our set T now contains two triangles. Applying rule 3 again, T must also contain all the line segments between points in the triangle R and points in the reflection of R. So T also contains the rectangular area between the two triangles. In short, T contains the trapezoid with corners at (1, 3), (4, 0), (− 1 , 3), and (− 4 , 0). The graph of T is:
A clarification on terminology – for clarity, I’ve said that a line segment is in T if all the points on the line segment are in T , and an area is in T if all the points in the area are in T. T does not actually contain any line segments or areas, only points on or in them.
Define a set M ∈ Z^2 is defined by
(1) (0, 1) ∈ M (2) If (x, y) ∈ M , then (x + 1, y + 2x + 3) ∈ M
(a) Starting with (0, 1), write out the six pairs with the smallest first coordinates. Solution: (0, 1), (1, 4), (2, 9), (3, 16), (4, 25), (5, 36) (b) State the (simple) relationship that holds between the first and second coordinates of all pairs in M. Solution: If the pair (x, y) is in M , then y = (x + 1)^2. (c) Use structural induction to prove that your answer to (b) is cor- rect. Solution: Base case: (0 + 1)^2 = 1. So the relationship holds for (0, 1). Inductive step: Assume that for some (x, y) ∈ M , y = (x+1)^2. We must show that the property holds for (x + 1, y + 2x + 3), in other words, that y+2x+3 = ((x+1)+1)^2. That is, y+2x+3 = (x+2)^2. We know from the inductive hypothesis that y = (x + 1)^2. So y +2x+3 = (x+1)^2 +2x+3 = x^2 +2x+1+2x+3 = x^2 +4x+4 = (x + 2)^2. Thus, for any pair (x, y) in M , y = (x + 1)^2 , by structural induc- tion.