PROBLEM SET # 1 SOLUTIONS C HAPTER 1: E UCLIDEAN A LGORITHM 1.1 Euclidean Algorithm. 1. Use the Euclidean algorithm to find the greatest common divisors of: a) 1084 and 412 Solution. Running the Euclidean algorithm, we find 1084 = 2 · 412 + 260 412 = 1 · 260 + 152 260 = 1 · 152 + 108 152 = 1 · 108 + 44 108 = 2 · 44 + 20 44 = 2 · 20 + 4 20 = 5 · 4. Thus, the greatest common divisor of 1084 and 412 is 4. b) 1979 and 531 Solution. Running the Euclidean algorithm, we find 1979 = 3 · 531 + 386 531 = 1 · 386 + 145 386 = 2 · 145 + 96 145 = 1 · 96 + 49 96 = 1 · 49 + 47 49 = 1 · 47 + 2 47 = 23 · 2 + 1 2 = 2 · 1. Thus, the greatest common divisor of 1979 and 531 is 1. c) 305 and 185 1 Solution. Running the Euclidean algorithm, we find 305 = 1 · 185 + 120 185 = 1 · 120 + 65 120 = 1 · 65 + 55 65 = 1 · 55 + 10 55 = 5 · 10 + 5 10 = 2 · 5. Thus, the greatest common divisor of 305 and 185 is 5. 2. Use the calculations from the previous exercise to express the following in continued fraction form: 1084 a) 412 Solution. Using the calculations above, we see that 1 1084 =2+ . 1 412 1 1+ 1+ 1 1+ 2+ 1 1 2+ 1 5 b) 1979 531 Solution. Using the calculations above, we see that 1979 1 =3+ . 1 185 1 + 2+ 1 1+ 1 1+ 1+ 1 1 23+ 1 2 c) 305 185 Solution. Using the calculations above, we see that 305 1 =1+ . 185 1 + 1+ 1 1 1+ 1 5+ 1 2 3. If a | b and b | c, show a | c. Solution. Since a | b, we have b = ma for some m ∈ Z. Since b | c, we have c = nb for some n ∈ Z. We then have c = nb = n(ma) = (nm)a, and hence a | c. √ 4. Use the continued fraction algorithm to show 3 is irrational. 2 √ √ Solution. We begin with√α0 = 3 ≈ 1.7. Then bα c = 1 and so β = 3 − 1. 0 0 √ We then √ bα1 c = 1. Therefore √ have α1 = 1/(√ 3 − 1) = ( 3 + 1)/2 ≈√1.4, and so β1 = (√3 + 1)/2 − 1 =√( 3 − 1)/2, and so α2 = 2/( 3 − 1) = 3 + 1 ≈ 2.7. Therefore β2 = ( 3 + 1) − 2 = 3 − 1 = β0 , and so α3 = α1 , and we see √ the process will now loop forever. √ Thus, the continued fraction algorithm for 3 repeats indefinitely, and hence 3 cannot be rational. √ 3. Note 5. Compute the fourth convergent of the continued fraction expansion of √ how well it approximates 3. Solution. By our calculations above, the continued fraction algorithm for duces the following data: √ 3 pro- i bαi c √ βi √ αi+1 0 1 ( √3 + 1)/2 √ 3−1 1 1 ( √3 − 1)/2 √ 3 + 1 2 2 ( √3 + 1)/2 √ 3−1 3 1 ( √3 − 1)/2 √ 3 + 1 4 2 3−1 ( 3 + 1)/2 .. .. .. .. . . . . Thus, the fourth convergent in the continued fraction algorithm for 7 1 = = 1.75. 1+ 1 4 1 + 2+ 1 1 √ Since 3 ≈ 1.732050808 . . ., this quite a good approximation. 1.2 √ 3 is Fundamental Theorem of Arithmetic. 1. Find all integer solutions of 13853x + 6951y = gcd(13853, 6951). Solution. We first compute the required gcd, using the Euclidean algorithm: 13853 = 1 · 6951 + 6902 6951 = 1 · 6902 + 49 6902 = 140 · 49 + 42 49 = 1 · 42 + 7 42 = 6 · 7. Thus, gcd(13853, 6951) = 7. Moreover, the second-to-last convergent in the continued fraction algorithm for 13853/6951 is 1 283 1+ = . 1 142 1 + 140+ 1 1 Observe that 13853 · 142 = 1967126 and 6951 · 283 = 1967133, and so 13853 · (−142) + 6951 · (283) = 7 = gcd(13853, 6951). 3 One integer solution to the given equation is therefore x = −142, y = 283. By Theorem 2, all integer solutions to this equation are then of the form x = −142 + 993k, y = 283 − 1979k for k ∈ Z. 2. Find all integer solutions of 15750x + 9150y = gcd(15750, 9150). Solution. We first compute the required gcd, using the Euclidean algorithm: 15750 = 1 · 9150 + 6600 9150 = 1 · 6600 + 2550 6600 = 2 · 2550 + 1500 2550 = 1 · 1500 + 1050 1500 = 1 · 1050 + 450 1050 = 2 · 450 + 150 450 = 3 · 150. Thus, gcd(15750, 9150) = 150. Moreover, the second-to-last convergent in the continued fraction algorithm for 15750/9150 is 1+ 1 1+ = 1 2+ 1+ 1 1 1+ 1 2 31 . 18 Observe that 15750 · 18 = 283500 and 9150 · 31 = 283650, and so 15750 · (−18) + 9150 · (31) = 150 = gcd(15750, 9150). One integer solution to the given equation is therefore x = −18, y = 31. By Theorem 2, all integer solutions to this equation are then of the form x = −18 + 61k, y = 31 − 105k for k ∈ Z. 3. Show that 427x + 259y = 13 has no integer solutions. Solution. We compute gcd(427, 259) using the Euclidean algorithm: 427 = 1 · 259 + 160 259 = 1 · 168 + 91 168 = 1 · 91 + 77 91 = 1 · 77 + 14 77 = 5 · 14 + 7 14 = 2 · 7. Thus, gcd(427, 259) = 7, and since 7 - 13, the given equation cannot have any integer solutions. 4. Let a and b be two integers. Use the Fundamental Theorem of Arithmetic to show that any common divisor of a and b divides gcd(a, b). 4 Solution. Let d be any common divisor of a and b. Then a = md and b = nd for some m, n ∈ Z. By the Fundamental Theorem of Arithmetic, there exist integers x, y ∈ Z such that ax + by = gcd(a, b). Combining this equation with our previous statement, we see that (md)x + (nd)y = gcd(a, b), or equivalently d(mx + ny) = gcd(a, b). Thus, d divides gcd(a, b). 5. Let a, b and d be any integers. Use the Fundamental Theorem of Arithmetic to show gcd(ad, bd) = gcd(a, b)d. Solution. First observe that we automatically have gcd(a, b)d | ad and gcd(a, b)d | bd, so by the previous exercise gcd(a, b)d | gcd(ad, bd). Conversely, by the Fundamental Theorem of Arithmetic we can write ax + by = gcd(a, b) for some integers x, y ∈ Z. It follows that (ad)x+(bd)y = gcd(a, b)d, and hence gcd(ad, bd) | gcd(a, b)d. Thus, the numbers gcd(ad, bd) and gcd(a, b)d are the same up to sign, and since they are both positive, they must therefore be equal. 1.4 Efficiency of the Euclidean Algorithm. 1. Let √ √ 5)n − (1 − 5)n √ fn = . 2n 5 Show that fn+2 = fn+1 +fn . In other words, show that fn satisfy the same recursion relation as the Fibonacci numbers. What else do you need to check in order to verify that fn are indeed the Fibonacci numbers? (1 + Solution. We first directly compute √ √ √ √ (1 + 5)n+1 − (1 − 5)n+1 (1 + 5)n − (1 − 5)n √ √ fn+1 + fn = + 2n+1 5 2n 5 √ √ √ √ (1 + 5)n+1 − (1 − 5)n+1 + 2(1 + 5)n − 2(1 − 5)n √ = 2n+1 5 √ √ √ √ (1 + 5)n ((1 + 5) + 2) − (1 − 5)n ((1 − 5) + 2) √ = 2n+1 5 √ √ √ √ (1 + 5)n (3 + 5) − (1 − 5)n (3 − 5) √ = . 2n+1 5 √ √ √ √ Now observe that (1 + 5)2 = 2(3 + 5) and (1 − 5)2 = 2(3 − 5). Substituting these into the above expression then gives √ 2 √ 2 √ √ (1 + 5)n · (1+2 5) − (1 − 5)n · (1−2 5) √ fn+1 + fn = 2n+1 5 √ √ (1 + 5)n+2 − (1 − 5)n+2 √ = 2n+2 5 = fn+2 . 5 Finally, to verify fn really does agree with the Fibonacci sequence, simply observe that f0 = 0 and f1 = 1 (by simply plugging in n = 0 and n = 1 into the given formula). 6