Page 3.1 Problem Set #3 Solutions 1. Epp #3.1.: a. Yes: 4rs = (rs) and rs is an integer because r and s are integers and products of integers are integers b. Yes: 6r + 4s + 3 = (3r + s + 1) + 1 and 3r + s + 1 is an integer because r and s are integers and the sums and products of integers are integers c. Yes: r + rs + s = (r + s) and r + s is an integer that is greater than or equal to because both r and s are positive integers, and so each is greater than or equal to 1.. Epp #3..3: This incorrect proof begs the question (assumes the hypothesis that it is supposed to prove). The second sentence asserts that a certain conclusion follows if r + s is rational, and the rest of the proof used that conclusion to deduce that r + s is rational. 3. Pseudo-code for the factorization algorithm: Input: n [a positive integer] r [a vector that contains all the primes less than or equal to n in ascending order, so that r(1) =, r() = 3, r(3) = 5, and so on. This vector has length s,] Other Algorithm Variables: p [a vector that contains the factorization primes for n in ascending order. It has length q s n.] e [a vector of length q that indicates how many times each element of p appears in the factorization of n. We note: 1 e(i) < n, 1 i q.] continued on next page
Page 3. Problem 3 continued Algorithm Body: n res := n [the factorization remainder] l := 1 [the counter for the elements in r] i := 0 [the counter for the elements in p and e] i flag := FALSE [A flag that indicates whether a prime in r is a factor of n.] while (n res 1) if n res mod r(l) 0 then do l := l + 1 i flag := FALSE end do else do if i flag = FALSE then do i := i + 1 p(i) := r(l) e(i) := 1 n res := n res /r(l) i flag := TRUE end do else do e(i) := e(i) + 1 n res := n res /r(l) end do end do end while Output: p, e end Algorithm 4. Epp #3.4.15: a. A 69 19 9 q d 1 n 1 p 4 b. A 83 8 8 q 3 d 0 n 1 p 3
Page 3.3 5. Epp #3.5.0 3.5.: 3.5.0 Counterexample: Let x = y = 1.1. Then, x y = (1.1) (1.1) = 1.01 =. On the other hand, we find x y = 1.1 1.1 = = 4. 3.5.1 Proof: Let n be any odd integer, then we must show that n/ = (n + 1)/. By definition, n = k + 1 for some integer k. Substituting into the left-hand side of the equation to be proved gives Similarly, we find n k + 1 = = n + 1 = (k + 1) + 1 k + 1 = k + 1. (1) = k + 1. () The equality that we wish to prove follows from the equality of (1) and (). 3.5. Counterexample: Let x = y = 1.9. Then, we find x y = (1.9) (1.9) = 3.61 = 4. By, contrast, we find 1.9 1.9 = 1 =. 6. Epp #3.6.3 3.6.4: 3.6.3 Suppose the negation. Suppose that there is a greatest negative real number a. In that case, we must have a < 0 and a x for every negative real number x. Let b = a/. We then find that b is real, that b < 0, and b > a. Hence, we have a contradiction, and the original statement is true. 3.6.4 Suppose the negation. Suppose that there is a least positive rational number r. We first note that s = r/ is also rational because if r = a/b, where a and b are integers, then s = a/b and both a and b are integers. We also find that s < r and s > 0. The contradiction follows, and the original statement is proved.
Page 3.4 7. Epp #3.7.14: The answer is no. Proof: Let a, b, and c be any odd integers, and suppose ax +bx+c = 0 has a rational solution. Then, there exist integers r and s with s 0 such that or, equivalently, By the partity theorem, either r is even or r is odd. ( r ) ( r a + b + c = 0, (1) s s) ar + brs + cs = 0. () Case 1, r is even: In this case, we solve () for cs to obtain cs = ar brs = r( ar bs). Since r is even, it equals k, where k is some integer. It follows that cs = k( ar bs), and, since ar bs is an integer, cs equals twice the integer k( ar bs) and cs is even. Since c is odd, it follows that s is even, which implies that s is even. In that case, both r and s have a common factor of two which contradicts the assumption that they have no common factor. Case, r is odd: In this case, we solve () for ar to obtain ar = brs cs. Since both a and r are odd, the combination ar must be odd. To show that, we consider the product of any two odd numbers. This product is expressible as (k + 1)(l + 1), where k and l are integers, which is also expressible as (kl + k + l) + 1, which is twice an integer plus one. By induction, it follows that any number of odd numbers multiplied together produces an odd number. We now consider two subcases of case. Suppose first that s is even. In that case ar = s( br cs), and it follows that ar is even. Suppose next that s is odd. In that brs and cs are both odd. Since the sum of two odd numbers is even, it follows that ar must be even. Thus, we always find that ar must be even, which contradicts our earlier result that ar must be odd. Both case 1 and case produce contradictions. Thus, the hypothesis is false, and if a, b, and c are odd integers, then all solutions to ax + bx + c must be irrational. Q.E.D.
Page 3.5 8. Implementation of algorithm to calculate π: The algorithm is implemented in MatLab. The code and output are below: The MATLAB Script: PI-APPROX This routine calculates an approximation to pi by summing the series for arctan(1), which equals pi/4. INPUTS Nmax = 100; This is the total length of the sum N1 = 10; This is the first value that is printed N = 30; This is the second value that is printed N3 = 100; ALGORITHM BODY k = 1:Nmax; This is the third value that is printed This initializes a vector of length Nmax filled with 1,,...Nmax x = 8.0./((4.0*k - 1).*(4.0*k + 1)); This calculates the vector elements to be summed x = cumsum(x); This calculates the cumulative sum x = 4.0 - x; This calculates the final result OUTPUT ROUTINES fprintf('\n For N = d, ',N1) fprintf('the approximate value of pi is 0.7f\n',x(N1)) fprintf('\n For N = d, ',N) fprintf('the approximate value of pi is 0.7f\n',x(N)) fprintf('\n For N = d, ',N3) fprintf('the approximate value of pi is 0.7f\n\n',x(N3)) The MATLAB output >> PI_APPROX For N = 10, the approximate value of pi is 3.1891848 For N = 30, the approximate value of pi is 3.1579850 For N = 100, the approximate value of pi is 3.1465677