



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




Fall 2009 CMSC 250: Homework 8 Solutions Perlis
Due at the start of discussion section Wednesday, November 4, 2009.
Please staple your homeworks together if you use more than one page.
Problem 1. (1 point) Print your name , section number , and your TA’s name.
Problem 2. (1 point) When is the second exam? |
Problem 3. (30 points) For each of the following statements either (1) write TRUE and explain why, or (2) write FALSE and give a counterexample.
a. ∅ = 𝒫 ∅
FALSE. ∅ ≠ ∅ = 𝒫 ∅
b. If 𝐴 ⊆ 𝐶 and 𝐵 ⊆ 𝐶, then 𝐴 ∪ 𝐵 = 𝐶.
FALSE. Let 𝐴 = 1 , 𝐵 = 2 , and 𝐶 = 1,2,.
c. If 𝐴 ⊆ 𝐶 and 𝐵 ⊆ 𝐶, then 𝐴 ∩ 𝐵 ⊆ 𝐶.
TRUE. 𝐴 ∩ 𝐵 ⊆ 𝐴 ⊆ 𝐶.
d. 𝐴 − 𝐵 ∩ 𝐶 = 𝐴 − 𝐵 ∪ 𝐴 − 𝐶
TRUE. 𝐴 − 𝐵 ∪ 𝐴 − 𝐶 = 𝐴 ∩ 𝐵𝑐^ ∪ 𝐴 ∩ 𝐶𝑐^ = 𝐴 ∪ 𝐵𝑐^ ∩ 𝐶𝑐 = 𝐴 ∪ 𝐵 ∪ 𝐶 𝑐^ = 𝐴 − 𝐵 ∩ 𝐶
e. If 𝐴 ⊆ 𝐶, then 𝐶 × 𝐵 ∪ 𝐴 × 𝐵 = 𝐶 × 𝐵.
TRUE. ∀ 𝑥, 𝑦 𝑥 ∈ 𝐶 ∧ 𝑦 ∈ 𝐵 ∨ 𝑥 ∈ 𝐴 ∧ 𝑦 ∈ 𝐵. Since ∀𝑥 𝑥 ∈ 𝐴 → 𝑥 ∈ 𝐶, ∀ 𝑥, 𝑦 𝑥 ∈ 𝐶 ∧ 𝑦 ∈ 𝐵 → 𝑥 ∈ 𝐴 ∧ 𝑦 ∈ 𝐵. This means that the left hand side is just ∀ 𝑥, 𝑦 𝑥 ∈ 𝐶 ∧ 𝑦 ∈ 𝐵.
f. 𝒫 𝐴 × 𝐵 = 𝒫(𝐴) × 𝒫 𝐵
FALSE. Let 𝐴 = ∅, 𝐵 = 1. 𝐴 × 𝐵 = ∅. 𝒫 𝐴 × 𝐵 = ∅. 𝒫 𝐴 = ∅. 𝒫 𝐵 = ∅, 1. 𝒫 𝐴 × 𝒫 𝐵 = ∅ , ∅ , ∅ , 1.
Problem 4. (15 points) Consider the set 𝐷 = 𝐴 ∈ 𝒫 ℤ | ∃𝑦 ∈ ℤ 𝑦 > 1 ∧ ∀𝑥 ∈ 𝐴 𝑦 𝑥. Explain in clear English what 𝐷 is. Does 𝐷 partition ℤ? Explain why or why not.
𝐷 is the set of all subsets of ℤ where all the elements are divisible by a common factor other than 1. This is not a partitioning of ℤ because 6 is in both the set 2,6 and 3,.
Problem 5. (20 points) Consider the following statement about any two sets 𝐴 and 𝐵:
𝐴 − 𝐵 − 𝐵 − 𝐴 = 𝐴 − 𝐵
a. Prove that the equality holds using set identities. Write at each step what identities you used.
𝐴 – 𝐵 − 𝐵 − 𝐴 Premise 𝐴 ∩ 𝐵𝑐^ − 𝐵 ∩ 𝐴𝑐^ Definition of − 𝐴 ∩ 𝐵𝑐^ ∩ 𝐵 ∩ 𝐴𝑐^ 𝑐^ Definition of − 𝐴 ∩ 𝐵𝑐^ ∩ 𝐵𝑐^ ∪ 𝐴𝑐^
𝑐 (^) DeMorgan’s
𝐴 ∩ 𝐵𝑐^ ∩ 𝐵𝑐^ ∪ 𝐴 Double compliment 𝐴 ∩ 𝐵𝑐^ ∩ 𝐴 ∪ 𝐵𝑐^ Commutative laws 𝐴 ∩ 𝐴 ∪ 𝐵𝑐^ ∩ 𝐵𝑐^ ∩ 𝐴 ∪ 𝐵𝑐^ Distributive laws 𝐴 ∪ 𝐵𝑐^ ∩ 𝐴 ∪ 𝐵𝑐^ Absorption Laws 𝐴 ∪ 𝐵𝑐^ Idempotent laws 𝐴 − 𝐵 Definition of^ −
b. Prove that the equality holds using the element method. Write at each step what equivalences you used.
𝑥 ∈ 𝐴 − 𝐵 − 𝐵 − 𝐴 iff (^) 𝑥 ∈ 𝐴 − 𝐵 ∧ ~ 𝑥 ∈ 𝐵 − 𝐴 Definition of − iff (^) 𝑥 ∈ 𝐴 ∧ ~ 𝑥 ∈ 𝐵 ∧ ~ 𝑥 ∈ 𝐵 ∧ ~ 𝑥 ∈ 𝐴 Definition of − iff (^) 𝑥 ∈ 𝐴 ∧ ~ 𝑥 ∈ 𝐵 ∧ ~ 𝑥 ∈ 𝐵 ∨ ~~ 𝑥 ∈ 𝐴 DeMorgan’s iff (^) 𝑥 ∈ 𝐴 ∧ ~ 𝑥 ∈ 𝐵 ∧ ~ 𝑥 ∈ 𝐵 ∨ 𝑥 ∈ 𝐴 Double negation iff (^) 𝑥 ∈ 𝐴 ∧ ~ 𝑥 ∈ 𝐵 ∧ 𝑥 ∈ 𝐴 ∨ ~ 𝑥 ∈ 𝐵 Commutative laws iff (^) 𝑥 ∈ 𝐴 ∧ 𝑥 ∈ 𝐴 ∨ ~ 𝑥 ∈ 𝐵 ∧
~ 𝑥 ∈ 𝐵 ∧ 𝑥 ∈ 𝐴 ∨ ~ 𝑥 ∈ 𝐵
Distributive laws
iff (^) 𝑥 ∈ 𝐴 ∨ ~ 𝑥 ∈ 𝐵 ∧ 𝑥 ∈ 𝐴 ∨ ~ 𝑥 ∈ 𝐵 Absorption laws iff 𝑥 ∈ 𝐴 ∨ ~ 𝑥 ∈ 𝐵 Idempotent laws iff (^) 𝑥 ∈ 𝐴 − 𝐵 Definition of −
c. The four sets 𝐴, 𝐵, and 𝐶:
i. 𝐴 = 𝑥 ∈ ℚ | 𝑥 ∈ ℚ
ii. 𝐵 = 𝑥 ∈ ℚ | 3 𝑥∈ ℚ
iii. 𝐶 = 𝑥 ∈ ℚ | 4 𝑥∈ ℚ
Problem 7. (25 points) An internally complete binary tree is a binary tree where every node either has 2 children or 0 children. Internal nodes have exactly 2 children and leaf nodes have 0 children. For example, 𝑇𝑎 and 𝑇𝑏 below are internally complete binary trees, but 𝑇𝑐 is not because one of its nodes has only 1 child.
Given a tree 𝑇, let 𝑁(𝑇) be the number of internal nodes in 𝑇, and 𝐿 𝑇 be the number of leaves in 𝑇. For example, 𝑁 𝑇𝑎 = 2, 𝑁 𝑇𝑏 = 4, 𝐿 𝑇𝑎 = 3, and 𝐿 𝑇𝑏 = 5. Prove using structural induction that for every internally complete binary tree 𝑇, 𝐿 𝑇 = 𝑁 𝑇 + 1.
𝐴 𝐵
𝐶
Let 𝑃 𝑛 be “for all trees 𝑇 with at most 𝑛 nodes, if it is internally complete, then 𝐿 𝑇 = 𝑁 𝑇 + 1.”
BASE CASE:
𝑃 1 : If the tree has one node then it is not an internal node so, 𝐿 𝑇 = 1 = 0 + 1 = 𝑁 𝑇 + 1.
𝑃(2): There are no internally complete binary trees with 2 nodes.
𝑃(3): There is only one internally complete binary tree with 3 nodes, a single internal node with 2 leaves. 𝐿 𝑇 = 2 = 1 + 1 = 𝑁 𝑇 + 1.
INDUCTIVE STEP: Assume 𝑃 0 , 𝑃 1 , …, 𝑃 𝑘. Prove 𝑃 𝑘 + 1.
Let T be an internal complete binary tree with n=k+1 nodes. Then since 𝑛 > 1 it will have a parent node (the root of 𝑇) with two subtrees 𝑇𝐿 and 𝑇𝑅. Note that 𝑁 𝑇 = 𝑁 𝑇𝐿 + 𝑁 𝑇𝑅 + 1, and 𝐿 𝑇 = 𝐿 𝑇𝐿 + 𝐿 𝑇𝑅.
Since 𝑇 is an internally complete binary tree, all of its nodes have 2 or 0 children. 𝑇𝐿 and 𝑇𝑅 are unmodified subtrees of 𝑇, so 𝑇𝐿 and 𝑇𝑅 , must also have only nodes with 2 or 0 children. Therefore 𝑇𝐿 and 𝑇𝑅 , must also be internally complete binary trees.
By the inductive assumption, 𝐿 𝑇𝐿 = 𝑁 𝑇𝐿 + 1 and 𝐿 𝑇𝑅 = 𝑁 𝑇𝑅 + 1.
Since 𝑁 𝑇 = 𝑁 𝑇𝐿 + 𝑁 𝑇𝑅 + 1, 𝑁 𝑇 = 𝐿 𝑇𝑅 − 1 + 𝐿 𝑇𝐿 − 1 + 1.
This gives, 𝑁 𝑇 = 𝐿 𝑇𝑅 + 𝐿 𝑇𝐿 − 1. Since 𝐿 𝑇 = 𝐿 𝑇𝐿 + 𝐿 𝑇𝑅 , 𝑁 𝑇 = 𝐿 𝑇 − 1. Which is equivalent to 𝐿 𝑇 = 𝑁 𝑇 + 1.