Math 162 PS 7 Solutions Barış Yeşiloğlu December 3, 2023 Exercise 0.1 Prove Theorem 4.11 in Gerstein: Every subset of Nn is finite; and if A ⊂ Nn then #A = m for some m < n. Solution We use mathematical induction, starting with n = 0. If n = 0 the result is true because the set N0 = ∅ has no proper subsets. Now suppose the result is true when n = k, and consider a subset A ⊂ Nk+1 . We must show that #A = m for some m ≤ k. Case (1). Suppose k + 1 ∈ / A. Then A ⊆ Nk . If A = Nk then #A = k; and if A ⊂ Nk the induction hypothesis yields #A = m for some m < k, and we are done. Case (2). Suppose k + 1 ∈ A. Then A = {k + 1} ∪ (A ∩ Nk ), and A ∩ Nk ⊂ Nk (since if A ∩ Nk = Nk we would have A = Nk+1 , contradicting the hypothesis that A ⊂ Nk+1 ). From the induction hypothesis, we know that # (A ∩ Nk ) = s for some s ≤ k − 1; thus there is a bijection f : A ∩ Nk → Ns . Now define a function g : A → Ns+1 by ( f (x) if x ∈ A ∩ Nk g(x) = s + 1 if x = k + 1 Then g is a bijection (why?), and therefore #A = s + 1 ≤ k. Exercise 0.2 Gerstein 4.1.4: Prove the following statements. (a) A × B ≈ B × A (b) If A ≈ C and B ≈ D then A × B ≈ C × D. (c) (A × B) × C ≈ A × (B × C) (d) If w is any element then {w} × A ≈ A. Solution (a) Define the ”flipping map” ϕ : A × B → B × A by ϕ(a, b) = (b, a). This map is injective because if (a, b) ̸= (c, d), then ϕ(a, b) = (b, a) ̸= (d, c) = ϕ(c, d). Also, ϕ is surjective because given (b, a) ∈ B × A, (a, b) ∈ A × B is sent to (b, a) by ϕ. So, ϕ is a bijection. 1 Ü. Işlak (b) Suppose A ≈ C and B ≈ D. Then there exists a bijection between A and C and there exists a bijection between B and D. Let ϕ1 : A → C and ϕ2 : B → D be two such bijections. Define ϕ : A × B → C × D by ϕ(a, b) = (ϕ1 (a), ϕ2 (b)). Now if ϕ(a1 , b1 ) = ϕ(a2 , b2 ), then (ϕ1 (a1 ), ϕ2 (b1 )) = (ϕ1 (a2 ), ϕ2 (b2 )), which can only happen if ϕ1 (a1 ) = ϕ1 (a2 ) and ϕ2 (b1 ) = ϕ2 (b2 ). But since ϕ1 , ϕ2 are injections, we see that a1 = a2 and b1 = b2 , which implies that ϕ is injective. Moreover, given (c, d) ∈ C × D, since ϕ1 , ϕ2 are surjections, we can find a ∈ A and b ∈ B with ϕ1 (a) = c and ϕ2 (b) = d. So, (a, b) ∈ A × B is an element which is sent to (c, d) by ϕ. Therefore, ϕ is a surjection. (c) Define ϕ : (A × B) × C → A × (B × C) by ϕ((a, b), c) = (a, (b, c)). Using similar arguments to part b, check that this is indeed a bijection. (d) Define ϕ : {w} × A → A by ϕ(w, a) = a. This map is injective because if ϕ(w, a1 ) = ϕ(w, a2 ), then a1 = a2 . This map is surjective because given a ∈ A, (w, a) ∈ {w} × A is an element such that ϕ(w, a) = a. Exercise 0.3 Gerstein 4.1.9: 9. If A, B, and C are finite sets, write a formula for the number of elements in A ∪ B ∪ C. Your formula may use addition, subtraction, and intersection, but not union. (Suggestion: A double application of 4.16 will do the job. Alternatively, draw a Venn diagram and think about it.) Solution We know that #(A ∪ B) = #(A) + #(B) − #(A ∩ B). Consider (A ∪ B) ∪ C. Then we have: #(A ∪ B ∪ C) = #((A ∪ B) ∪ C) = #(A ∪ B) + #(C) − #((A ∪ B) ∩ C) = #(A) + #(B) + #(C) − #(A ∩ B) − #((A ∩ C) ∪ (B ∩ C)) = #(A) + #(B) + #(C) − #(A ∩ B) − #(A ∩ C) − #(B ∩ C) + #(A ∩ B ∩ C) Exercise 0.4 Gerstein 4.1.11: Prove that if A1 , A2 , . . . , An are finite sets, then ∪ni=1 Ai is finite and in fact # (∪ni=1 Ai ) ≤ #A1 + · · · + #An . (Use induction on n.) Solution For n = 2, we have #(A1 ∪ A2 ) = #A1 + #A2 − #(A1 ∩ A2 ) ≤ #A1 + #A2 . So, the base case holds. For the inductive step, assume the statement is true for some m ∈ N. We want to show that it is true for m + 1. Note that we have #( m+1 [ i=1 Ai ) = #( m [ Ai ∪ Am+1 ) ≤ #( i=1 m [ Ai ) + #Am+1 ≤ #A1 + · · · + #Am+1 i=1 So, the inductive step is established and we are done. 2 Ü. Işlak Exercise 0.5 Gerstein 4.1.13: For Exercise 13, imagine that you are familiar with the set of nonnegative integers, but that you have never heard of the operations of addition, subtraction, and multiplication. Let m and n be integers with n > m ≥ 0, and define the difference n − m as follows. Take sets A and B such that #A = m, #B = n, and A ⊂ B; then define n − m = #(B − A) (Here the ”minus” sign on the left is the symbol being defined; the ”minus” sign on the right denotes set difference.) Show that with ”-” as defined here and ”+” as in the previous problem, the following equation holds: m + (n − m) = n Solution The previous problem defines ”+” by m + n = #(A ∪ B), where #A = m, #B = n and A and B are disjoint sets. With this construction, m + (n − m) is well defined because n − m = #(B − A), m = #A, and B − A and A are disjoint sets. Moreover, we have m + (n − m) = #(A ∪ (B − A)) = #B = n. Exercise 0.6 Gerstein 4.1.16: Define a codeword of length three to be a three-digit string of 0 s and 1 s. For instance, 011 and 101 are codewords. (a) Show that there are eight codewords of length three. (b) Define the distance between two codewords to be the number of digits in which they differ. For instance, the distance between 011 and 101 is 2 . Show that there does not exist a set of five different codewords of length three, each of which has distance of at least 2 from each of the others. (Do not attempt to list all the five-element sets of codewords and eliminate them one by one. Instead, proceed by contradiction: suppose there is such a set, use the pigeonhole principle to show that at least three of these five codewords have the same first digit, and then go on to consider the second and third digits of these three codewords to deduce a contradiction.) Solution (a) Each digit can be 0 or 1. So, we have 23 = 8 possible codewords of length three. (b) Following the hint, suppose there is such a set. Then, since we have 5 elements (pigeons) in this set and two possible holes, by the pigeonhole principle, at least 3 of these elements must have the same first digit. Now, using the pigeonhole principle again, out of these 3, two of them must have the same second digit. So, we have two elements whose first and second digits are the same. But then, the distance between these elements can be at most 1. =⇒ Contradiction. =⇒ There is no such a set. 3 Ü. Işlak Exercise 0.7 Gerstein 4.1.21b: Let AB denote the set of all functions from B to A. (b) Assuming that #A = m and #B = n, determine the number of injections from B to A. Here you will need to use the fact (to be proved in Chapter 5) that if n ≤ m, the number of n-element subsets of an m-element set is m! n!(m − n)! Solution Since we are working with injections, we first observe that we will send each element of B to a unique element in A. So, we first need to choose which elements of A we will use (that is, which elements will have non-empty pre-image). So, we need to choose n elements from a set with m elements. This is given by m m! . = n!(m − n)! n Now, after picking n elements from A, we need to choose which element of B will be sent to which element in A. There are n! ways to do that. So, the number of injections from B to A m! is (m − n)! Exercise 0.8 Gerstein 4.1.22: (a) Suppose ∼ is an equivalence relation on an infinite set S, and suppose the relation partitions the set into a finite number of equivalence classes. Deduce that some equivalence class must contain an infinite number of elements. (b) Suppose ∼ is an equivalence relation on an infinite set S, with no further conditions. Must some equivalence class be infinite? Solution (a) Let n be the number of equivalence classes. Suppose each equivalence class contains at most m elements. Then we have #(S) ≤ nm. But we assumed that S is an infinite set. =⇒ Contradiction. =⇒ At least 1 equivalence class must contain infinitely many elements. (b) No. The equivalence classes can all be finite. For example, if each equivalence class is given by [s] = {s}, then each class contains 1 element. Exercise 0.9 Suppose n people are at a party. Show that at least two of the people know the same number of people among those present. (We assume that if A knows B, then B knows A.) Solution The number of acquaintances each person has at the party is between 0 and n − 1, for a total of n options. However, 0 acquaintances means there is a person at the party who doesn’t know anybody, which means there cannot be a person there who knows 4 Ü. Işlak everybody (n − 1). So the possible list of acquaintances is a subset of either {0, 1, ..., n − 3, n − 2} or {1, 2, ..., n − 2, n − 1}. Both sets have size n − 1, so by the pigeonhole principle, there are two people who know the same number of people at the party. Exercise 0.10 Suppose 20 distinct integers are chosen from the set {1, 4, 7, . . . , 100} = {n ∈ Z | n = 3k + 1 where 0 ≤ k ≤ 33}. Prove that there exist two distinct integers among the chosen 20 whose sum is 104 . Solution Let S = {1, 4, ...100} and S20 be any subset of S with 20 elements. Note that S has 34 elements. Suppose S20 does not contain two elements whose sum is 104. Consider the pairs (4, 100), (7, 97), ..., (49, 55). Then we see that our desired subset cannot contain any of these pairs, otherwise it would contain two elements whose sum add up to 104. But there are 16 pairs here, which means that #(S20 ) ≤ 34 − 16 = 18. =⇒ Contradiction. =⇒ Any subset of S with 19 or more elements contains two integers whose sum add up to 104. Exercise 0.11 Suppose that p and q are distinct primes. Use the inclusion–exclusion principle to find ϕ(pq), the number of positive integers not exceeding pq that are relatively prime to pq. Solution We will first find the number of integers divisible by p or q. Since p and q are distinct primes, the only positive integer less than or equal to pq that divides both p and q is pq. Now note that the integers q, 2q, ...(p − 1)q, pq are all divisible by q and there are p of them. Similarly, there are q integers less than or equal to pq that are divisible by p. Let P and Q denote the set of positive integers less than or equal to pq that are divisible by p and q, respectively. Then, by inclusion-exclusion principle, we have: #(P ∪ Q) = #P + #Q − #(P ∩ Q) = q + p − 1. Noting that there are pq integers less than or equal to pq, we have ϕ(pq) = pq − (p + q − 1) = pq − p − q + 1 = (p − 1)(q − 1). 5