Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
21-128 and 15-151 problem sheet 4 Solutions to the following seven exercises and optional bonus problem are to be submitted through blackboard by 8:30AM on Thursday 6th October 2016. There are also some practice problems, not to be turned in, for those seeking more practice and also for review prior to the exam. Problem 1 For each pair below, use the Euclidean algorithm to compute the greatest common divisor, and express the greatest common divisor as an integer combination of the two numbers: (a) 126 and 224; (b) 221 and 299. Solution. (a) What follows is, if you like, the ‘output’ of the extended Euclidean algorithm, working down the left-hand column and then up the right-hand column: 224 = 1 × 126 + 98 ⇒ 14 = 4 × (224 − 1 × 126) − 3 × 126 = 4 × 224 − 7 × 126 126 = 1 × 98 + 28 ⇒ 14 = 98 − 3 × (126 − 98) = 4 × 98 − 3 × 126 98 = 3 × 28 + 14 ⇒ 14 = 98 − 3 × 28 28 = 2 × 14 + 0 So gcd(224, 126) = 14 and 4 × 224 + (−7) × 126 = 14. (b) We proceed as in (a): 299 = 1 × 221 + 78 ⇒ 13 = 3 × (299 − 1 × 221) − 1 × 221 = 3 × 299 − 4 × 221 221 = 2 × 78 + 65 ⇒ 13 = 78 − 1 × (221 − 2 × 78) = 3 × 78 − 1 × 221 78 = 1 × 65 + 13 ⇒ 13 = 78 − 1 × 65 65 = 1 × 13 + 0 So gcd(299, 221) = 13 and 3 × 299 + (−4) × 221 = 13. Problem 2 A cash register contains the same number of dimes and quarters, in total a nonzero whole number of dollars. What is the minimum number of coins? Solution. Let n be the total value in dollars of all the coins in the register, and let x be the number of dimes, which is also the number of quarters. Then 10x + 25x = 100n, that is 35x = 100n. It follows that 7x = 20n. Since 7 and 20 are relatively prime, we must have 20 | x. Thus the least value of x for which such a machine can exist is 20. Since there are x dimes and x quarters, there are 40 coins in total, with a value of $7. Problem 3 Prove that gcd(a + b, a − b) = gcd(2a, a − b) = gcd(a + b, 2b), for all a, b ∈ Z. Solution. (This is a proof from scratch—a result proved in class makes this much easier!) We’ll prove that all three pairs (a + b, a − b), (2a, a − b) and (a + b, 2b) have the same sets of common divisors. Indeed, given d ∈ Z: • Suppose d is a common divisor of a + b and a − b. Then a + b = kd and a − b = `d for some k, ` ∈ Z, so that 2a = (k + `)d. Hence d | 2a, and d is a common divisor of 2a and a − b. • Suppose d is a common divisor of 2a and a − b. Then 2a = kd and a − b = `d for some k, ` ∈ Z. Now a + b = 2a − (a − b) = (k − `)d and 2b = 2a − 2(a − b) = (k − 2`)d so d is a common divisor of a + b and 2b. • Suppose that d is a common divisor of a + b and 2b. Then a + b = kd and 2b = `d for some k, ` ∈ Z, so that a − b = (k − `)d. Hence d | a − b, and d is a common divisor of a + b and a − b. What we’ve just shown is that, letting X, Y and Z be the respective sets of common divisors, we have X ⊆ Y ⊆ Z ⊆ X. Hence X = Y = Z. Since all three pairs of numbers have all the same common divisors, they have the same greatest common divisor. Problem 4 Prove that (2n)!/(2n n!) is an odd integer for every natural number n. 2 SOLUTION 1: For all positive integers n, denote by ν2 (n) the largest positive integer k such that 2k | n. For example, ν2 (12) = 2 since 4 | 12 but 8 - 12. Note that in order for (2n)! 2n n! to be odd, it must be the case that ν2 ((2n)!) = ν2 (2n n!). Since 2n adds n factors of 2 to the prime factorization of 2n n!, this statement is thus equivalent to ν2 ((2n)!) = n + ν2 (n!). Now recall that ν2 ((2n)!) = ν2 2n Y ! i = i=1 2n X ν2 (i). i=1 Note that all odd positive integers m by definition satisfy ν2 (M ) = 0. This means that we can ignore them from our summation. What is left is all the even numbers, and as such we can write the sum as n X ν2 (2k) = k=1 n X [1 + ν2 (k)] = n + k=1 n X ν2 (k) = n + ν2 (n!). k=1 This is exactly what we wanted to prove, and so we are done. SOLUTION 2: The key here is to notice that in fact we can prove something stronger, namely n Y (2n)! = (2k − 1). 2n n! k=1 Let P (n) denote the proposition that the above equality holds. We prove P (n) holds true for all n ≥ 1 by mathematical induction. Note that for the base case of n = 1 we have 1 Y 2! 2 = = 1 = (2k − 1), 21 1! 2 · 1! k=1 so we’re good. Now fix k ≥ 1, and assume P (k) is true. Now note that (2(k + 1))! (2k + 2)(2k + 1)(2k)! = 2k+1 (k + 1)! 2k+1 · (k + 1)k! (2k + 1)(2k)! = 2k k! k k+1 Y Y IH = (2k + 1) (2i − 1) = (2i − 1). i=1 i=1 Hence P (k) =⇒ P (k + 1), and by induction we’re done. 3 Problem 5 A treasury has 500 7-ounce weights, 500 11-ounce weights, and a balance. A foreign dignitary arrives with a gold bar, claiming it to weigh 500 ounces. Can the treasury determine whether the dignitary is telling the truth? If so, how? Solution. There are many ways to solve this problem, but they all amount to solving the equation 7x + 11y = 500 with integers x and y having absolute value less than or equal to 500. This can be done by finding an initial solution, like x = −1500 and y = 1000 and using the result in class to see that any integer solution has the form x = −1500 + 11k and y = 1000 − 7k for some integer k. Then taking k = 140 yields x = 40 and y = 20, and balancing 40 7-ounce bars and 20 11-ounce bars against the suspect bar will determine whether it weighs 500 ounces. A simpler way would be to observe that 7 × 2 + 11 × 1 = 25, so that multiplying by 20 yields the above result. Problem 6 A positive integer is perfect if it is the sum of positive integers less than it which divide it. For example, 6 = 1 + 2 + 3 and 28 = 1 + 2 + 4 + 7 + 14 are perfect. Prove that if 2n − 1 is prime, then 2n−1 (2n − 1) is perfect. (Hint: What are the divisors? You can use geometric series to sum them.) Proof. Let x = 2n−1 (2n − 1). Suppose that 2n − 1 is prime. Note that 2n − 1 must be a prime other than 2. Claim: For 0 < d < x, d | x if and only if d can be written in the form 2i (2n − 1)j where 0 ≤ i ≤ n − 1 and 0 ≤ j ≤ 1. We can show the above claim as follows: ⇐= : Let d = 2i (2n − 1)j . Then if we set k = 2n−1−i (2n − 1)1−j , x = kd. Due to the bounds on i and j, we are guaranteed that k ∈ Z. Thus, d | x. =⇒ : We will prove the contra-positive. From the fundamental theorem of arithmetic, we can express d as pj11 ...pjrr . Suppose that we cannot express d in the form 2i (2n − 1)j . Then there are three cases, either ∃pk ∈ / {2, (2n − 1)}, ∃pk = 2 and jk ≥ n, or ∃pk = (2n − 1) and jk ≥ 2. Suppose d | x. • For the first case, we can write d as d0 pk . By definition of divisibility, we have ∃c ∈ Z, x = c(d0 pk ) =⇒ c = d0xpk . But since pk - x, c ∈ / Z. • For the second case, we can write d as d0 2n−1+i where i ≥ 1. By definition of divisibility, n we have ∃c inZ, 2i (2n − 1) = c(d0 2n−1+i ) =⇒ c = 2d0−1 . But 2 - 2n − 1 so c ∈ / Z. 2i 4 • For the third case, we can write d as d0 p1+i where i ≥ 1. By definition of divisibility, we i have ∃c ∈ Z, 2i (2n − 1) = cd0 (2n − 1)1+i =⇒ c = d0 (2n2−1)1 . But (2n − 1) - 2 so c ∈ / Z. In each case, we have a contradiction so d - x. This completes the proof of the claim. We can then easily sum the positive divisors less than x. Note that either j = 0 or j = 1. X d= n−2 X 2i (2n − 1) + i=0 d = (2n − 1) n−2 X 2i + i=0 n n−1 n n−1 = (2 − 1)(2 n−1 X 2i i=0 n−1 X 2i i=0 n − 1) + (2 − 1) since x X i=0 = (2 − 1)(2 2i = 1 − 2x+1 = 2x+1 − 1 1−2 factoring out a 2n − 1 − 1 + 1) = (2n − 1)2n−1 Thus, 2n−1 (2n − 1) is a perfect number. Problem 7 Five suspicious sailors spend the day gathering a pile of coconuts. Exhausted, they postpone dividing it until the next morning. Suspicious, each decides to take his share during the night. The first sailor divides the pile into five equal portions plus one extra coconut, which he gives to a monkey. He takes one pile and leaves the rest in a single pile. The second sailor later does the same; again the monkey receives one leftover coconut. The third, fourth and fifth sailors all do this; each time, a remainder of one goes to the monkey. In the morning, they split the remaining coconuts into five equal piles, and each sailor gets his “share”. (Each knows some were taken, but none complains, since each is guilty!) What is the smallest number of coconuts in the original pile? Solution. Let n − 4 be the total number of coconuts. The number of coconuts remaining after the first sailor is (4/5)n − 4, the number of coconuts remaining after the second sailor is (4/5)2 n − 4, the number of coconuts remaining after the third sailor is (4/5)3 n − 4, the number of coconuts remaining after the fourth sailor is (4/5)4 n − 4, and the number of coconuts remaining after the fifth sailor is (4/5)5 n − 4. Since 4 and 5 are relatively prime, n must be divisible by 55 = 3125. Hence n ≥ 55 and n − 4 ≥ 3121. An initial number of 3121 coconuts meets the conditions of the problem, since after the sailors take their shares, there will be 2496, 1996, 1596, 1276 and 1020 coconuts remaining, and 1020 is evenly divisible by 5. Thus, the minimum initial number of coconuts meeting the conditions of the problem is 3121. 5 Bonus Problem (2 points) Tanvi has two jars of jelly beans, one with x beans and the other with y beans. Each jar has a lever. When a jar has at least 2 beans, pressing its lever will give Tanvi one bean from it and move one bean from it to the other jar (if there are 1 or 0 beans in the jar, then pressing the lever has no effect). Determine necessary and sufficient conditions on x and y, so that Tanvi can extract all but one of the jelly beans. Solution. Let p(n) = “When there are a total of n jellybeans, then Tanvi can win if and only if the difference between the number of beans in the jars is not divisible by 3.” Note that p(1) and p(2) are true and now assume that n ≥ 2 and that p(n) is true. Assume that there are a total of n + 1 jellybeans in the jars. Since n + 1 > 2, Tanvi can and must press a lever. After Tanvi presses a lever there will be a total of n jellybeans in the jars, and since one jar will lose 2 jellybeans while the other gains 1 jellybean, the difference between the number of jellybeans in the jars has changed by 3, and the original difference is divisible by 3 if and only if the new difference is divisible by 3. By the truth of p(n), Tanvi can win if and only if the new difference is divisible by 3, which happens if and only if the original difference is divisible by 3. By induction, p(n) is true for every positive integer n. Extra Problem 1 Find all integer solutions x, y to the equation 1 60 = x 5 + y 12 . y 1 Solution. First note that 60 = x5 + 12 if and only if 12x + 5y = 1. Now (x0 , y0 ) = (3, −7) is a solution, since 12 × 3 − 5 × 7 = 36 − 35 = 1. Since 5 and 12 are relatively prime, by a theorem from class, (x, y) satisfies only if there exists k ∈ Z such that x = 3 + 5k 1 60 = x 5 + y 12 if and and y = −7 − 12k. Extra Problem 2 Find every integer k ≥ 3 such that k − 2 divides 2k. Solution. Note that 1 | 6, 2 | 8, 3 - 10 and 4 | 8; so k − 2 divides 2k when k = 3, 4, 6 and k − 2 doesn’t divide 2k when k = 5. We’ll prove that k − 2 doesn’t divide 2k when k > 6, so that the only values of k ≥ 3 for which k − 2 divides 2k are 3, 4 and 6. Fix k > 6. Then, given d ∈ Z: 6 • If d ≤ 2 then d(k − 2) ≤ 2k − 4 < 2k; • If d ≥ 3 then d(k − 2) ≥ 3(k − 2) = 2k + (k − 6) > 2k. Hence for all d ∈ Z we have d(k − 2) 6= 2k. Thus k − 2 does not divide 2k. Extra Problem 3 Suppose that gcd(a, b) = 1. Prove that gcd(na, nb) = n. Solution. Suppose d ∈ N with d | na and d | nb. Then na = kd and nb = `d for some k, ` ∈ N. Substituting d = nb ` into the first equation and rearranging yields `na = knb, and hence `a = kb. Since a and b are relatively prime, it follows that a | k; say k = ma. The first equation then yields na = mad, so n = md and d | n. Hence any common divisor of both na and nb is a divisor of n. The greatest divisor of n is n itself, and n | na and n | nb—it follows that n = gcd(na, nb). 7