Homework 7 Solutions, Math 55 5..36. (a) Since a is a positive integer, a = a 1 + b 0 is a positive integer of the form as + bt for some integers s and t, so a S. Thus S is nonempty. (b) Since S is nonempty, it has a least element c by the well-ordering principle. (c) Let d be a common divisor of a and b. Then a = dk and b = dl for some k, l Z. We know that c = ax + by for some x, y Z since c is an element of S. Since we see that d is also a divisor of c. c = ax + by = dkx + dly = d(kx + ly), (d) If c a, then by the division algorithm there exists a unique integer r such that a = qc+r and 0 < r < c. We know that c = ax + by since c is an element of S, so r = a qc = a q(ax + by) = a(1 qx) + b( qy) is an element of S also. But r < c, and c was supposed to be the smallest element of S. This is a contradiction. Thus c a. The proof that c b is identical. (e) The integer c must be the greatest common divisor of a and b. Indeed, it is a common divisor of a and b by part (d). Every other common divisor d is a divisor of c, so d c, which means that c is the greatest common divisor. If c were another common divisor that was at least as large as all other divisors, then by part (c) we would have c c, but c is maximal amongst common divisors so we must have c = c. 5.3.. (c) 5.3.4. (d) 5.3.6. f(1) = f(0) f(0) = 9 6 = 1. f() = f(1) f(1) = 1 = 3. f(3) = f() f() = 9 + 6 = 13. f(4) = f(3) f(3) = 169 6 = 141. f() = f(1)/f(0) = 1. f(3) = f()/f(1) = 1. f(4) = f(3)/f() = 1. f(5) = f(4)/f(3) = 1. (a) This is well-defined, and f(n) = ( 1) n. We prove this by induction. Let P (n) be the statement that f(n) = ( 1) n. The base case P (0) is given to us. If P (k) is true for some k, then we know that f(k) = ( 1) k, which means that f(k + 1) = f(k) = ( 1) k = ( 1) k+1, so P (k + 1) is true too. Thus P (n) is true for all n. 1
(b) This is well-defined, and n/3 if n 0 mod 3 f(n) = 0 if n 1 mod 3 (n+1)/3 if n mod 3. We prove this by strong induction. The base cases n = 0, 1, are given to us. Suppose that we know this formula for all nonnegative integers up to some integer k. We have three cases. If k + 1 0 mod 3, then k 0 mod 3 also, so f(k + 1) = f(k ) = (k )/3 = (k+1)/3. If k + 1 1 mod 3, then k 0 mod 3 also, so f(k + 1) = f(k ) = 0. If k + 1 mod 3, then k mod 3 also, so This completes the induction. (c) This is not well-defiend. f(k + 1) = f(k ) = (k 1)/3 = (k+)/3. (d) This is well-defined, and we have f(n) = n 1 for all n 1. We prove this by induction. The base case n = 1 is given to us, and if f(k) = k 1 for some k 1, then completing the induction. f(k + 1) = f(k) = k 1 = k (e) This is well-defined, and we have f(n) = n/ +1. We prove this by strong induction. The base case is given to us, so suppose that, for some k, we have f(j) = j/ +1 for all 0 j k. If k + 1 is even, then k 1 = (k + 1) is even also, and which means that k 1 + 1 = k 1 + = k + 1, 5.3.8. f(k + 1) = f(k 1) = (k 1)/ +1 = (k+1)/ = (k+1)/ +1. If, on the other hand, k +1 is odd, then we need to verify that f(k) = f(k 1) and that both of these quantities are equal to (k+1)/ +1. Since k+1 is odd, we see that k is even and (k + 1)/ = k/. Moreover k 1 is odd and (k 1)/ = (k )/ = (k/) 1, so f(k) = k/ +1 = k/ = (k/) 1 = (k 1)/ +1 = f(k 1). Moreover, completing the induction. (a) a 1 = and a n+1 = a n + 4 for all n 1. (b) a 1 = and a n+1 = a n. (c) a 1 = and a n+1 = a n + (n + 1). f(k + 1) = f(k) = k/ +1 = (k+1)/ +1
(d) a 1 = 1 and a n+1 = a n + n + 1. 5.3.1. We prove that f 1 + + f n = f n f n+1 for all n 1 by induction. When n = 1, this just says that f 1 = 1 is equal to f 1 f = 1, which is true. Suppose that f 1 + +f k = f kf k+1 for some k. Then f 1 + + f k + f k+1 = f k f k+1 + f k+1 = f k+1 (f k + f k+1 ) = f k+1 f k+ and this completes the induction. 5.3.14. Note that f f 0 f 1 = 1 0 1 = 1 = ( 1) 1, so that kicks off the induction. Suppose f k+1 f k f k = ( 1)k for some positive integer k. Then and that completes the induction. f k+ f k f k+1 = (f k + f k+1 f k f k+1 = f k + f k f k+1 f k+1 = f k + f k+1 (f k f k+1 ) = f k + f k+1 ( f k 1 ) = (f k 1 f k+1 f k ) = ( 1) k = ( 1) k+1 5.3.16. Note that f 0 f 1 + f = 0 1 + 1 = 0 and f 1 1 1 = f 1 1 = 0 also, so this kicks off the induction. If f 0 + f k = f k 1 1 for some positive integer k, then f 0 + f k f k+1 + f k+ = (f k 1 1) f k+1 + f k+ = (f k 1 1) f k+1 + (f k + f k+1 ) and that completes the induction. = (f k 1 1) + f k = f k+1 1 5.3.0. We define and then max{a, b} := { a if a b b if b > a. max{a 1,..., a n } := max{a 1, max{a,..., a n }} for all n. Similar definitions work for min also. 5.3.. First, we show that Z + S by usual induction. Let P (n) be the statement that n S. Then P (1) is the statement that 1 S, which we know is true. If P (k) is true for some k, then we know that k S. We know that 1 S, so then k + 1 S also, proving that P (k + 1) is also true. Thus P (n) is true for all n, which means that Z + S. Next, we show that S Z + by structural induction. Notice that 1 Z +. Moreover, if s, t Z +, then s + t Z + also clearly. This shows that S Z +, which proves that S = Z +. 5.3.4. (a) 1 S and if s S, then s + S. (b) 3 S and if s S, then 3s S. 3
(c) 1, x S, and if p, q S then p + q S, p q S and pq S. 5.3.6. (a) First step: (, 3), (3, ). Second step: (4, 6), (5, 5), (6, 4). Third step: (6, 9), (7, 8), (8, 7), (9, 6). Fourth step: (8, 1), (9, 11), (10, 10), (11, 9), (1, 8). (b) Let P (n) be the statement that, if (a, b) S is obtained from (0, 0) after n applications of the recursive definition, then 5 a+b. Then P (0) is clear, so suppose P (0),..., P (k) are all true. If (a, b) S is obtained using k +1 applications of the recursive definition, then either (a, b) = (a +, b + 3) for some (a, b ) S that is obtained using k applications, or (a, b) = (a + 3, b + ) for some (a, b ) S that is obtained using k applications. In either case, a + b = (a + b ) + 5 so a + b is divisible by 5 because a + b is. This completes the induction. (c) Clearly 5 (0 + 0). Inductively, if 5 (a + b), then 5 ((a + ) + (b + 3)) and also 5 ((a + 3) + (b + )). 5.3.35. The reversal of the empty string is the empty string. If w is a string of length n+1, then we can write w as xy where x has length n and y is just a single character. Then we define w R := yx R. 5.3.46. Notice that (1+1)+1 = 5, so we have a m,n = (m+n)+1 for (m, n) = 1. Suppose that for some (m, n) (1, 1) we have a m,n = (m + n ) + 1 for all (m, n ) < (m, n), where means the lexicographic order on Z + Z +. If n = 1, then (m 1, 1) < (m, 1), so a m,n = a m 1,n + = (((m 1) + n) + 1) + = (m + n) +. If n > 1, then (m, n 1) < (m, n) also, so again 6.1.3. (a) 4 10. (b) 5 10. 6.1.8. 6 5 4. a m,n = a m,n 1 + = ((m + (n 1)) + 1) + = (m + n) +. 6.1.1. ( 6 ) n 1 = ( 7 1) 1 = 7. n=0 6.1.14. If n = 1, there is only one such string. If n, we get to choose all but the first and last bits freely, so we have n options. 6.1.16. There are 6 4 total strings, and 5 4 strings that do not have x in them, so the number of strings that do have an x in them is 6 4 5 4. 6.1.. (b) 999/7 of them are divisible by 7. Of those, the ones that are also divisible by 11 are the ones that are multiples of 77, and there are 999/77 of those. So the number that are divisible by 7 but not 11 is 999/7 999/77. 4
(f) 1000 999/7 999/11 + 999/77. (g) There are 9 ways of choosing a 1-digit positive integer, 9 9 ways of choosing a -digit positive integer with distinct digits, and 9 9 8 ways of choosing a 3-digit positive integer with distinct digits. So we just add these numbers up. (h) There are 4 ways of choosing a 1-digit positive integer that is even. There are 5 5 ways of choosing a -digit integer where the first (tens) digit is odd and the second digit is even (the first can be 1,3,5,7,9 and the second can be 0,,4,6,8, and notice that the end result will necessarily have two distinct digits and will be even). Also, there are 4 4 ways of choosing a -digit integer where both digits are even and distinct (the first digit can be,4,6,8 and the second can 0,,4,6,8 except whatever the first digit was). Similarly, there are 5 4 5 + 5 5 4 + 4 5 4 + 4 4 3 ways of choosing 3-digit numbers. 6.1.4. (a) There are 9999/9 = 1111 integers less than or equal to 9999 that are divisible by 9, and of those 999/9 = 111 of them are less than 1000. So there are 1000 such integers. (b) There are 9999 1000 + 1 = 9000 total integers in this range, and half of them will be even, so 4500. (g) There are 9999/5 integers that are divisible by 5 less than or equal to 9999, and of them 999/5 are less than 1000. Also, a multiple of 5 is also a multiple of 7 if and only if its a multiple of 35, and there are 9999/35 integers less than or equal to 9999 that are divisible by 35, and of them 999/35 are less than 1000. So we get ( 9999/5 999/5 ) ( 9999/35 999/35 ). (h) An integer is divisible by 5 and 7 if and only if it is divisible by 35. 9999/35 999/35, like we saw above. 6.1.3. (d) 1 5 4 (6 7). So we have (e) 1 6 6 1. 6.1.34. (d) 5 10. 6.1.40. There are 100 total subsets. Of them, 1 has no elements and 100 have 1 element. So 100 100 1 have more than 1 element. 6.1.44. There are 6! ways of arranging the people around the table, but each arrangement is being considered equivalent to 6 arrangements, so we get (6!)/6 = 5!. 6.1.46. (a) There are 10 9 5 = (10!)/4! ways of choosing some permutation of 6 people out of the 10. There are 9!/3! ways where the bride is excluded. So there are 10!/4! 9!/3! ways. (b) Using the same idea as above, 10!/4! 8!/!. (c) We can count the ways of choosing a permutation of 6 people of of the 9 non-groom people that include the bride using the idea above. We then repeat the idea for the 9 non-bride people. These two sets of permutations are disjoint, so we get a total of (9!/3! 8!/!) + (9!/3! 8!/!). 5
6.1.50. It s sufficient to calculate the number N of bit strings with 5 consecutive 0 s. Indeed, the number of bit strings with 5 consecutive 1 s is also N since the bijection which swaps 1 s for 0 s and conversely maps the set of bit strings with 5 consecutive 0 s to the set of bit strings with 5 consecutive 1 s. Notice that there are bit strings that have both 5 consecutive 0 s and 5 consecutive 1 s, so the total number we re looking for is N. The bit strings with 5 consecutive 0 s are all of one the following possible forms, where x stands for an arbitrary bit. (i) 00000xxxxx. (ii) 100000xxxx. (iii) x100000xxx. (iv) xx100000xx. (v) xxx100000x. (vi) xxxx100000. Notice that a string cannot simultaneously be of two of these types. There are 5 strings of type (i), and 4 strings of types (ii)-(vi). So N = 5 + 5 4. 6.1.5. There are 38 + 3 7 students in the class. 6