Docsity

Homework 6 in CS 173: Properties of Symmetric Relations and Big O Notation, Assignments of Discrete Structures and Graph Theory

Toggle sidebar
bg1
CS 173 Homework 6 (due 3/06/08 in class) Spring 2008
CS 173: Discrete Mathematical Structures, Spring 2008
Homework 6
Due in class on Thursday, March 6, 2008
1. Prove each of the following statements for a given set A:
(a) (5 points) If R1and R2are symmetric relations on A, then the relation R1∪R2is
symmetric.
(b) (5 points) If R1and R2are symmetric relations on A, then the relation R1∩R2is
symmetric.
(a) Solution: Consider an arbitrary (a, b)∈Awith (a, b)∈R1∪R2. We want to show that
(b, a)∈R1∪R2. If (a, b)∈R1∪R2, then (a, b)must have originally been in either R1
or R2. If (a, b)∈R1, then (b, a)∈R1because R1is symmetric, and so this ordered pair
must also be included in R1∪R2. Similarly, if (a, b)∈R2, then since R2is symmetric,
(b, a)∈R2, so (b, a)∈R1∪R2.¥
(b) Solution: Consider an arbitrary (a, b)∈Awith (a, b)∈R1∩R2. We want to show that
(b, a)∈R1∩R2. If (a, b)∈R1∩R2, then (a, b)must have originally been in both R1and
R2. Since (a, b)∈R1, then (b, a)∈R1because R1is symmetric, and since (a, b)∈R2,
(b, a)∈R2. Therefore, (b, a)∈R1and (b, a)∈R2, so (b, a)∈R1∩R2.¥
Grading rubric: 10 points total, 5 for each correct part.
2. Which of the following relations on the set of all functions from Zto Zare equivalence
relations? For those that are, prove it. Determine the properties of an equivalence relation
that the others lack.
Solution: (a) R={(f, g)|f(1) = g(1)}
i. Reflexive? : Yes. For any function f,f(1) = f(1), so (f, f )∈R.
ii. Symmetric? : Yes. Consider any two functions fand g. If (f , g)∈R, then f(1) =
g(1). Thus g(1) = f(1), so (g , f)∈R.
iii. Transitive? : Yes. Consider any three functions f , g, h. If (f, g )∈Rand (g, h)∈R,
then f(1) = g(1) and g(1) = h(1), so f(1) = h(1) and (f, h)∈R.
iv. Equivalence Relation? : Yes.
(b) R={(f, g)|f(0) = g(0) or f(1) = g(1)}
i. Reflexive? : Yes. For any function f,f(0) = f(0), so (f, f )∈R.
ii. Symmetric? : Yes. Consider any two functions fand g. If (f , g)∈R, then f(0) =
g(0) or f(1) = g(1). Thus, either g(0) = f(0) or g(1) = f(1), so (g , f)∈R.
iii. Transitive? : No. For example, take functions f,gand hwith f(0) = g(0) and
g(1) = h(1), but f(1) 6=g(1) and g(0) 6=h(0). Then (f , g)∈Rand (g, h)∈R, but
(f, h)is not in R.
iv. Equivalence Relation? : No, since it is not transitive.
(c) R={(f, g)|f(x)−g(x) = 1 for all x∈Z}
1
pf3
pf4
pf5

Partial preview of the text

Download Homework 6 in CS 173: Properties of Symmetric Relations and Big O Notation and more Assignments Discrete Structures and Graph Theory in PDF only on Docsity!

CS 173: Discrete Mathematical Structures, Spring 2008

Homework 6

Due in class on Thursday, March 6, 2008

  1. Prove each of the following statements for a given set A:

(a) (5 points) If R 1 and R 2 are symmetric relations on A, then the relation R 1 ∪ R 2 is symmetric. (b) (5 points) If R 1 and R 2 are symmetric relations on A, then the relation R 1 ∩ R 2 is symmetric.

(a) Solution: Consider an arbitrary (a, b) ∈ A with (a, b) ∈ R 1 ∪ R 2. We want to show that (b, a) ∈ R 1 ∪ R 2. If (a, b) ∈ R 1 ∪ R 2 , then (a, b) must have originally been in either R 1 or R 2. If (a, b) ∈ R 1 , then (b, a) ∈ R 1 because R 1 is symmetric, and so this ordered pair must also be included in R 1 ∪ R 2. Similarly, if (a, b) ∈ R 2 , then since R 2 is symmetric, (b, a) ∈ R 2 , so (b, a) ∈ R 1 ∪ R 2. • (b) Solution: Consider an arbitrary (a, b) ∈ A with (a, b) ∈ R 1 ∩ R 2. We want to show that (b, a) ∈ R 1 ∩ R 2. If (a, b) ∈ R 1 ∩ R 2 , then (a, b) must have originally been in both R 1 and R 2. Since (a, b) ∈ R 1 , then (b, a) ∈ R 1 because R 1 is symmetric, and since (a, b) ∈ R 2 , (b, a) ∈ R 2. Therefore, (b, a) ∈ R 1 and (b, a) ∈ R 2 , so (b, a) ∈ R 1 ∩ R 2. •

Grading rubric: 10 points total, 5 for each correct part.

  1. Which of the following relations on the set of all functions from Z to Z are equivalence relations? For those that are, prove it. Determine the properties of an equivalence relation that the others lack.

Solution: (a) R = {(f, g) | f (1) = g(1)} i. Reflexive? : Yes. For any function f , f (1) = f (1), so (f, f ) ∈ R. ii. Symmetric? : Yes. Consider any two functions f and g. If (f, g) ∈ R, then f (1) = g(1). Thus g(1) = f (1), so (g, f ) ∈ R. iii. Transitive? : Yes. Consider any three functions f, g, h. If (f, g) ∈ R and (g, h) ∈ R, then f (1) = g(1) and g(1) = h(1), so f (1) = h(1) and (f, h) ∈ R. iv. Equivalence Relation? : Yes. (b) R = {(f, g) | f (0) = g(0) or f (1) = g(1)} i. Reflexive? : Yes. For any function f , f (0) = f (0), so (f, f ) ∈ R. ii. Symmetric? : Yes. Consider any two functions f and g. If (f, g) ∈ R, then f (0) = g(0) or f (1) = g(1). Thus, either g(0) = f (0) or g(1) = f (1), so (g, f ) ∈ R. iii. Transitive? : No. For example, take functions f , g and h with f (0) = g(0) and g(1) = h(1), but f (1) 6 = g(1) and g(0) 6 = h(0). Then (f, g) ∈ R and (g, h) ∈ R, but (f, h) is not in R. iv. Equivalence Relation? : No, since it is not transitive. (c) R = {(f, g) | f (x) − g(x) = 1 for all x ∈ Z}

i. Reflexive? : No. For every function f , f (x) − f (x) = 0, so (f, f ) 6 ∈ R. ii. Symmetric? : No. Consider two functions f and g. If (f, g) ∈ R then f (x)−g(x) = 1. But then g(x) − f (x) = − 1 , so (g, f ) 6 ∈ R. iii. Transitive? : No. Consider three functions f ,g, and h. If (f, g) ∈ R and (g, h) ∈ R, then f (x)−g(x) = 1 and g(x)−h(x) = 1. But then f (x)−h(x) = 1+g(x)+1−g(x) = 2 , so (f, h) 6 ∈ R. iv. Equivalence Relation? : No. (d) {(f, g) | f (0) = g(1) and f (1) = g(0)} i. Reflexive? : No. Consider a function f with f (0) 6 = f (1), so (f, f ) is not in R. ii. Symmetric? : Yes. Consider any two functions f and g. If (f, g) ∈ R, then f (0) = g(1) and f (1) = g(0). Thus, g(0) = f (1) and g(1) = f (0), so (g, f ) ∈ R. iii. Transitive? : No. If (f, g) ∈ R and (g, h) ∈ R, then we know that f (0) = g(1), f (1) = g(0), g(0) = h(1), and g(1) = h(0). However, we cannot conclude that f (0) must equal h(1) nor that f (1) must equal h(0), so (f, h) is not necessarily in R. iv. Equivalence Relation? : No.

Grading rubric: 24 points total, 6 for each part. Give 2 points per correct proof of reflexive, symmetric, or transitive.

  1. (20 points total) Sort the following functions from asymptotically smallest to asymptotically largest. Include a proof for each relationship. To simplify your answers, write f (n) ø g(n) to mean f (n) = O(g(n)), and write f (n) ≡ g(n) to mean f (n) = Θ(g(n)). For example, the functions n^3 , 2 n, and 2 log^2 n^ could be sorted as 2 n ≡ 2 lg^ n^ ø n^3 or as 2 lg^ n^ ≡ 2 n ø n^3. Further, you would need to include three proofs: that 2 n = O(2lg^ n), that 2 lg^ n^ = O(2n), and that 2 n = O(n^3 ).

Solution: n n! ø^2 log 8 n (^) ø n lg n ø^ n^ lg(n (^4) ) ø 8 n (^3) + 10n + 1, 024

  • (^) nn! = O(2log^8 n): We first note that 2 log^8 n^ = nlog^8 2 = n^1 /^3. We want to find constants N and c such that ∀n > N, (^) nn! ≤ c · n^1 /^3. Working from left to right, we get the following chain of equalities and inequalities: n n!

(n − 1)! ≤ 1 ≤ n^1 /^3 = 1 · n^1 /^3

These equalities and inequalities hold for all n > 0. Thus, we used N = 0 and c = 1 to show that (^) nn! = O(2log^8 n).

Solution: If f (n) = O(n^2 ), then there exists N 1 > 0 and c 1 > 0 such that ∀n > N 1 , f (n) ≤ c 1 · n^2 ; similarly, if g(n) = O(n^3 ), then there exists N 2 > 0 and c 2 > 0 such that ∀n > N 2 , g(n) ≤ c 2 · n^3. We want to find constants N and c such that ∀n > N, f (n) + g(n) ≤ c · n^3. Working from left to right,

f (n) + g(n) ≤ c 1 · n^2 + c 2 · n^3 ≤ c 1 · n^3 + c 2 · n^3 ≤ (c 1 + c 2 )n^3

That is, let c = c 1 + c 2. Also, we want to let N = max(N 1 , N 2 ) so that all our inequalities hold. Thus, f (n) + g(n) = O(n^3 ). •

Grading rubric: 10 points total, 5 for a correct proof on each part.

  1. (a) (15 points) Show that if f (x) = anxn+an− 1 xn−^1 +· · ·+a 1 x 1 +a 0 , where a 0 , a 1 ,... , an− 1 , an are non-negative real numbers and an > 0 , then f (x) is Θ(xn). Solution: If we want to show that f (x) = Θ(xn), we need to show that f (x) = O(xn) and f (x) = Ω(xn). - f (x) = O(xn): Pick N = 1. Then note that all of the following inequalities hold:

anxn^ ≤ anxn an− 1 xn−^1 ≤ an− 1 xn

... a 1 ≤ a 1 xn a 0 ≤ a 0 xn Let ai be the maximum value among a 0 , a 1 ,... , an. Then we can bound f (x) as follows:

f (x) = anxn^ + an− 1 xn−^1 + · · · + a 1 x^1 + a 0 ≤ anxn^ + an− 1 xn^ + · · · + a 1 xn^ + a 0 xn ≤ aixn^ + aixn^ + · · · + aixn^ + aixn = (n + 1)aixn Therefore, we can let N = 0 and c = (n + 1)ai to show that f (x) = O(xn).

  • f (x) = Ω(xn): This side is easier. Pick N = 1. Then note that all of the following inequalities hold:

anxn^ ≥ anxn an− 1 xn−^1 ≥ 0

... a 1 x^1 ≥ 0 a 0 ≥ 0 Thus, we can bound f (x) as follows:

f (x) = anxn^ + an− 1 xn−^1 + · · · + a 1 x^1 + a 0 ≥ anxn^ + 0 + · · · + 0 + 0 = anxn Therefore, we can let N = 0 and c = an to show that f (x) = Ω(xn).

(b) (5 points) Use part (a) to bound the asymptotic complexity of the following function:

f (x) = (π + (e10!))^7 +

∑^10

n=

e

  • n

xn

Solution: Note that (π +e(10!))^7 is just some constant, say c. Further, so is each ( (^1) e +n)^25 , for 0 ≤ n ≤ 10 ; call them c 0 through c 10. So in fact, f (x) is of the form as in part (a). That is, f (x) = c 10 x^10 + c 9 x^9 + c 8 x^8 + · · · + c 1 x^1 + c 0 + c

Therefore, by part (a), f (x) = Θ(x^10 ). •

Grading rubric: For part a, give 8 points for a correct big-O proof, and 7 for a correct big-omega proof. In part b, 5 points for any (correct, of course) argument of the correct bound.

  1. (10 points) Suppose that f (x) is O(g(x)). Does it follow that 2 f^ (x)^ = O(2g(x))? Prove your answer.

Solution: No, this is not true. We will disprove by counterexample. Let f (x) = x and let g(x) = 12 x. Indeed x = O( 12 x) (you should be able to show this!). Assume towards a contradiction that 2 f^ (x)^ = O(2g(x)), that is, that 2 x^ = O(2x/^2 ). Then there would need to exist constants N > 0 and c > 0 such that ∀x > N, 2 x^ ≤ c · 2 x/^2. Divide both sides of this inequality by 2 x/^2. This gives us:

2 x 2 x/^2 ≤^ c^

2 x/^2 2 x/^2 2 x/^2 ≤ c

However, this means that our constant c must be greater than an expression involving x, contradicting the fact that it’s constant! Therefore, no such c can exist, and we have found a counterexample to the statement. •

Grading rubric: 5 points for giving a counterexample, and 5 points for a correct proof that the counterexample actually works.

our constructed antichain from minimal elements gives us one more antichain, giving us h − 1 + 1 = h antichains, as desired. It’s clear by construction that this forms a partition of U. • (d) (5 points) Prove that if |U | = mn + 1, then P either contains a chain of size m + 1 or an antichain of size n + 1. Solution: If we can find any chain of size m+1 then we’re done, so assume no such chain exists. That is, every chain has height at most m. Now, suppose towards a contradiction that we could not find any antichain of size n + 1; that is, every antichain has size at most n. Then we must have at most mn elements total, but this is a contradiction, as we know that we have mn + 1 elements. • (e) (5 points) Use part (d) to give another solution to the honors problem from HW2: A list of numbers a 1 , a 2 ,... , ar is nondecreasing if aj ≤ aj+1 for each 1 ≤ j < r; it is nonincreasing if aj ≥ aj+1 for each 1 ≤ j < r. Prove that every list of mn + 1 numbers contains either a nondecreasing subsequence of length at least m + 1 or a nonincreasing subsequence of length at least n + 1. With m = 4 and n = 3, the problem claims that every list of 3 · 4 + 1 = 13 numbers contains either a nondecreasing subsequence of length m + 1 = 5 or a nonincreasing subsequence of length n + 1 = 4. For example, the list 9 , 5 , 10 , 3 , 12 , 6 , 8 , 13 , 4 , 1 , 11 , 7 , 2 contains the nonincreasing subsequence 12 , 8 , 4 , 2. Solution: (This problem probably seems a lot easier now!) Let U = {a 1 ,... , ar}. We define a relation on U as follows: {(ai, aj ) | ai ≤ aj and i ≤ j}. You should be able to verify that this relation is reflexive, anti-symmetric, and transitive and therefore a poset. Then, by part (d) above, we must be able to find either a chain of size m + 1, which corresponds to an increasing sequence of m + 1 numbers, or an antichain of size n + 1, which corresponds to a non-increasing sequence of n + 1 numbers.

Grading rubric: Total 25 points. Part a gets 2 points, and b is 3 points. For part c, 1 point for stating what the induction is on, 2 for the correct base case, and 7 for a correct inductive step. For parts d and e, give 5 points for a correct answer.