CmSc 365 Theory of Computation Homework 02 due 01/27 - SOLUTIONS 1. Prove that if S is any collection of sets, then RS = {(A,B): A, B S and A B} is a partial order (18 pts) Reflexivity: Let A S By definition of subsets, A A, Therefore (A,A) RS Anti-symmetric: Let (A,B) RS and A B By def of Rs, A B. Since A B, B A, therefore (B,A) RS Transitivity: Let (A,B) RS and (B,C) RS A B , and B C Therefore A C (by definition of subsets) Therefore (A,C) RS 2. Under what circumstances does a directed graph represent a function? (5 pts) Each vertex has only one outgoing arc 3. Show that if A and B are any finite sets, then there are |B| |A| functions from A to B A function maps elements from one set to another set so that each and every element in the first set is mapped to only one element in the second set Thus there are |B| possible mappings for each element in set A. there are |A| elements in set A, therefore there are |B| |A| functions from A to B 4. Prove that the set of all finite strings of the letter a is countable. Let w be a finite string consisting of the letter “a”. Consider the function f(w) = k, where k is the number of the letters in the string. This function is a bijection to the set N, therefore the set of all finite strings of the letter “a” is countable. 1 5. Prove that the set S of all finite strings of 0 and 1 is countable. Let w be a string of 0 and 1. It is specified by a) its length, and b) by the decimal number corresponding to the binary representation. S can be represented as S = S1 S2 S3 …. Sk …. Where the sets Si are pairwise disjoint and finite. S1 contains all strings of length 1, S2 contains all strings of length 2, etc. Since the strings are finite, each Si will be finite and therefore countable. The union of countable sets is countable if the set containing the countable sets is countable. Consider the set R = {S1, S2, …. Sk, …. } There is a bijection f(Si) = i between R and N. Therefore R is countable. Therefore S is countable. 6. Prove that the set of all points P in 3D space with integer coordinates is countable. Let Z be the set of all integers – negative, positive, and 0. There is a bijection between f(P) : P Z x Z x Z, which maps each point to its coordinates. We have to show that the set Z x Z x Z is countably infinite. We have proved that the Cartesian product of countably infinite sets is countably infinite. Therefore we have to prove that the set Z is countably infinite. There is a bijection between Z and N, the set of natural numbers: Z: 0, -1, 1, -2, 2, -3, 3, -4, 4, …. N: 1, 2, 3, 4, 5, 6, 7, 8, 9, … F(z) = 2z +1, if z ≥ 0 F(z) = -2z, if z < 0 Therefore the set of all points P with integer coordinates is countably infinite Another way to prove that Z is countably infinite: Z can be represented as the union of 3 sets: {0} {1, 2, 3, …} {-1, -2, -3, …} The first set is finite and therefore countable. The other two sets are countably infinite. We have proved that the union of countable sets is countable. Therefore Z is a countably infinite set. 2