CS280, Spring 2004: Prelim Solutions

Similar documents
Homework #2 solutions Due: June 15, 2012

MATH 2200 Final Review

INTEGERS. In this section we aim to show the following: Goal. Every natural number can be written uniquely as a product of primes.

Proof 1: Using only ch. 6 results. Since gcd(a, b) = 1, we have

Definitions. Notations. Injective, Surjective and Bijective. Divides. Cartesian Product. Relations. Equivalence Relations

CMSC Discrete Mathematics SOLUTIONS TO SECOND MIDTERM EXAM November, 2005

PRACTICE PROBLEMS: SET 1

Notes on Systems of Linear Congruences

2 Elementary number theory

Number Theory Proof Portfolio

CS2800 Questions selected for fall 2017

WORKSHEET ON NUMBERS, MATH 215 FALL. We start our study of numbers with the integers: N = {1, 2, 3,...}

Solutions to Practice Final

12x + 18y = 50. 2x + v = 12. (x, v) = (6 + k, 2k), k Z.

MAS114: Exercises. October 26, 2018

1 Overview and revision

3 The fundamentals: Algorithms, the integers, and matrices

Final Exam Review. 2. Let A = {, { }}. What is the cardinality of A? Is

PUTNAM TRAINING NUMBER THEORY. Exercises 1. Show that the sum of two consecutive primes is never twice a prime.

Mathematics 220 Homework 4 - Solutions. Solution: We must prove the two statements: (1) if A = B, then A B = A B, and (2) if A B = A B, then A = B.

CS 514, Mathematics for Computer Science Mid-semester Exam, Autumn 2017 Department of Computer Science and Engineering IIT Guwahati

CHAPTER 6. Prime Numbers. Definition and Fundamental Results

PROBLEMS ON CONGRUENCES AND DIVISIBILITY

CS280, Spring 2004: Final

MATH 2112/CSCI 2112, Discrete Structures I Winter 2007 Toby Kenney Homework Sheet 5 Hints & Model Solutions

Department of Computer Science University at Albany, State University of New York Solutions to Sample Discrete Mathematics Examination II (Fall 2007)

Contribution of Problems

Know the Well-ordering principle: Any set of positive integers which has at least one element contains a smallest element.

WORKSHEET MATH 215, FALL 15, WHYTE. We begin our course with the natural numbers:

NOTE: You have 2 hours, please plan your time. Problems are not ordered by difficulty.

Assignment #2 COMP 3200 Spring 2012 Prof. Stucki

Chapter 5. Number Theory. 5.1 Base b representations

Problem 1: Suppose A, B, C and D are finite sets such that A B = C D and C = D. Prove or disprove: A = B.

Chapter 5: The Integers

Theoretical Cryptography, Lecture 13

Basic Proof Examples

Number Theory and Graph Theory. Prime numbers and congruences.

5: The Integers (An introduction to Number Theory)

MATH 13 SAMPLE FINAL EXAM SOLUTIONS

Chapter 5.1: Induction

Solutions to Section 2.1 Homework Problems S. F. Ellermeyer

4 Number Theory and Cryptography

USA Mathematical Talent Search Round 3 Solutions Year 20 Academic Year

CMSC Discrete Mathematics SOLUTIONS TO FIRST MIDTERM EXAM October 18, 2005 posted Nov 2, 2005

This is a recursive algorithm. The procedure is guaranteed to terminate, since the second argument decreases each time.

7.2 Applications of Euler s and Fermat s Theorem.

Number theory (Chapter 4)

Course: CS1050c (Fall '03) Homework2 Solutions Instructor: Prasad Tetali TAs: Kim, Woo Young: Deeparnab Chakrabarty:

2301 Assignment 1 Due Friday 19th March, 2 pm

M381 Number Theory 2004 Page 1

MATH 310: Homework 7

ALGEBRA. 1. Some elementary number theory 1.1. Primes and divisibility. We denote the collection of integers

2 Arithmetic. 2.1 Greatest common divisors. This chapter is about properties of the integers Z = {..., 2, 1, 0, 1, 2,...}.

MATH 215 Final. M4. For all a, b in Z, a b = b a.

Some Facts from Number Theory

SOLUTIONS Math 345 Homework 6 10/11/2017. Exercise 23. (a) Solve the following congruences: (i) x (mod 12) Answer. We have

MATH10040: Numbers and Functions Homework 1: Solutions

Math 230 Final Exam, Spring 2009

Ma/CS 6a Class 2: Congruences

CISC-102 Fall 2017 Week 6

Math 261 Spring 2014 Final Exam May 5, 2014

An integer p is prime if p > 1 and p has exactly two positive divisors, 1 and p.

Prof. Ila Varma HW 8 Solutions MATH 109. A B, h(i) := g(i n) if i > n. h : Z + f((i + 1)/2) if i is odd, g(i/2) if i is even.

MATH 145 Algebra, Solutions to Assignment 4

Math.3336: Discrete Mathematics. Primes and Greatest Common Divisors

Name: Solutions Final Exam

Solution Sheet (i) q = 5, r = 15 (ii) q = 58, r = 15 (iii) q = 3, r = 7 (iv) q = 6, r = (i) gcd (97, 157) = 1 = ,

Name (please print) Mathematics Final Examination December 14, 2005 I. (4)

Fall 2017 Test II review problems

Name: Mathematics 1C03

MATH 55 - HOMEWORK 6 SOLUTIONS. 1. Section = 1 = (n + 1) 3 = 2. + (n + 1) 3. + (n + 1) 3 = n2 (n + 1) 2.

Midterm 1. Name: TA: U.C. Berkeley CS70 : Algorithms Midterm 1 Lecturers: Anant Sahai & Christos Papadimitriou October 15, 2008

MAS114: Solutions to Exercises

Number Theory Math 420 Silverman Exam #1 February 27, 2018

Math 109 HW 9 Solutions

MATH 361: NUMBER THEORY FOURTH LECTURE

Lecture Notes 1 Basic Concepts of Mathematics MATH 352

Solutions to Homework Set 1

Direct Proof MAT231. Fall Transition to Higher Mathematics. MAT231 (Transition to Higher Math) Direct Proof Fall / 24

0 Sets and Induction. Sets

Writing Assignment 2 Student Sample Questions

MATH FINAL EXAM REVIEW HINTS

Math 13, Spring 2013, Lecture B: Midterm

18 Divisibility. and 0 r < d. Lemma Let n,d Z with d 0. If n = qd+r = q d+r with 0 r,r < d, then q = q and r = r.

Slides by Christopher M. Bourke Instructor: Berthe Y. Choueiry. Spring 2006

Name (print): Question 4. exercise 1.24 (compute the union, then the intersection of two sets)

Factoring Algorithms Pollard s p 1 Method. This method discovers a prime factor p of an integer n whenever p 1 has only small prime factors.

MATH 3330 ABSTRACT ALGEBRA SPRING Definition. A statement is a declarative sentence that is either true or false.

Do not open this exam until you are told to begin. You will have 75 minutes for the exam.

Discrete Mathematics and Probability Theory Summer 2014 James Cook Midterm 1

Wednesday, February 21. Today we will begin Course Notes Chapter 5 (Number Theory).

D-MATH Algebra I HS18 Prof. Rahul Pandharipande. Solution 1. Arithmetic, Zorn s Lemma.

Math 110 FOUNDATIONS OF THE REAL NUMBER SYSTEM FOR ELEMENTARY AND MIDDLE SCHOOL TEACHERS

MATH 363: Discrete Mathematics

Definition 6.1 (p.277) A positive integer n is prime when n > 1 and the only positive divisors are 1 and n. Alternatively

Proofs. Methods of Proof Divisibility Floor and Ceiling Contradiction & Contrapositive Euclidean Algorithm. Reading (Epp s textbook)

1. Algebra 1.7. Prime numbers

CPSC 121 Sample Final Examination December 2013

Divisibility in the Fibonacci Numbers. Stefan Erickson Colorado College January 27, 2006

Sums of Squares. Bianca Homberg and Minna Liu

Transcription:

CS280, Spring 2004: Prelim Solutions 1. [3 points] What is the transitive closure of the relation {(1, 2), (2, 3), (3, 1), (3, 4)}? Solution: It is {(1, 2), (2, 3), (3, 1), (3, 4), (1, 1), (2, 2), (3, 3), (1, 3), (1, 4), (2, 4), (2, 1), (3, 2)}. Grading: You lost two points if the transitive closure did not include the original relation. You lost one point for the first missing element (of additional element) in the transitive closure, and.5 for each additional missing/extra element. 2. [4 points] If f is a function from A to B, and S and T are subsets of B, prove that f 1 (S T ) = f 1 (S) f 1 (T ). Solution: Recall that if f is a function from A to B, then f 1 maps B to 2 A. If S B, then f 1 (B) = {x : f(x) B}. We need to show that (a) f 1 (S T ) f 1 (S) f 1 (T ) and (b) f 1 (S T ) f 1 (S) f 1 (T ). For (a), suppose that x f 1 (S T ). Let y = f(x). Then y S T. Since y S, x f 1 (S); similarly x f 1 (T ). Thus, x f 1 (S T ). That proves (a). For (b), suppose that x f 1 (S) f 1 (T ). Let y = f(x). We must have y S, since x f 1 (S), and y T, since x f 1 (T ). Thus, y S T, and x f 1 (S T ). Grading: Two points for each half of the argument (that is, two points for proving and two points for proving ). 3. [6 points] Suppose that R 1 and R 2 are both relations on N, the natural numbers. True or false: (a) if R 1 and R 2 are transitive relations, then so is R 1 R 2. (b) if R 1 and R 2 are reflexive relations, then so is R 1 R 2. In each case, if you think it s true, prove it. If not, give a counterexample. Solution: (a) is false. Here is one of many possible counterexamples: Suppose R 1 = {(1, 2)} and R 2 = {(2, 3)}. Each of R 1 and R 2 is transitive, R 1 R 2 = {(1, 2), (2, 3)} is not transitive. (b) is true (no matter what the domain of R 1 and R 2 are). Recall that a relation is a set of ordered pairs, and a relation R is reflexive if, for every element n in R s domain, the pair (n, n) R. It s OK if the relation has pairs not of the form (n, n). Now on to the proof: If n is in the domain of R 1 R 2, then it is in the domain of R 1 or in the domain of R 2, If it is in the domain of R 1, then (n, n) R 1 (since R 1 is reflexive); if it is in the domain of R 2, then (n, n) R 2 (since R 2 is reflexive. 1

Thus, (n, n) R 1 R 2. Since (n, n) R 1 R 2 for all n in the domain of R 1 R 2, it follows that R 1 R 2 is reflexive. Grading: One point in each case for the right answer. Two points for the counterexample in part (a); two points for the proof in part (b). 4. [8 points] Suppose the sets P 0, P 1, P 2,... of bit strings (that is, strings of 0s and 1s) are defined inductively by taking P 0 = {λ} (where λ denotes the empty string) and P n+1 = P n {x11, x01, x10, x11 : x P n }. Let P = k=1 P k. Let Q be the smallest set such that (a) λ Q; (b) if x Q, then x00, x01, x10, x11 Q. Prove that P = Q. Solution: We need to show that P Q and Q P. Since Q is the smallest set with properties (a) and (b), to show that Q P, it suffices to show that P has properties (a) and (b). Clearly it has property (a), since λ P 0 P. It also has property (b), since if x P, then x P n for some n. Then, by definition, x00, x01, x10, x11 P n+1 P. To prove that P Q, we prove by induction that P n Q. Let P (n) be the statement that P n Q. The base case is immediate, since P 0 = {λ}, and λ Q. Suppose that P n Q. To see that P n+1 Q, suppose that x P n+1. Then there exists some y P n such that x is one of y00, y01, y10, y11. By the inductive hypothesis, each of y Q. By definition of Q, it must be the case that y00, y01, y10, and y11 are all in Q. Thus, x P n+1. Grading: Four points for each half of the proof. For the second half, you got one point for realizing that you had to prove by induction that P n Q for all n, and three points for the induction argument itself. On the whole, people did quite badly on this problem. There was a problem just like this done in class, and another that was assigned for homework. 5. [3 points] Canada has a two-dollar coin known colloquially as a toonie. (The one-dollar coin, which has a picture of a loon on it, is called a loonie.) What is wrong with the following argument, which purports to show that any debt of n > 1 Canadian dollars can be repaid (exactly) using only toonies? We proceed by strong induction. Let P (k) be the statement that a debt of k dollars can be repaid exactly using only toonies. The base case is k = 2. Clearly a debt of $2 Canadidan can be repaid with one toonie. Assume that P (k) is true for k = 2,..., n. We now prove P (n + 1). By the induction hypothesis, a debt of n 1 dollars can be repaid exacatly 2

using toonies, by the induction hypothesis. Using one more toonie, the debt of n + 1 dollars can be repaid. Solution: The problem with this argument is that n 1 is not necessarily in the range 2,..., n. In particular, this is the case if n = 2. That means that there will be a problem proving P (3), (where n = 2 and n + 1 = 3). And, indeed, P (3) is false. 6. [8 points] For n 0, let F n = 2 2n + 1. (Those numbers F n which are prime are called Fermat primes.) (a) [4 points] Prove by induction that n 1 r=0 F r = F n 2 for n 1. (b) [4 points] Prove that gcd(f m, F n ) = 1 for all m, n with m n. (Hint: use part (a) which you can use even if you haven t proved it and some standard facts about divisibility.) Solution: Let P (n) be the statement n 1 r=0 F r = F n 2. We prove P (n) for n 1. For the base case, note that 0 F r = F 0 = 2 20 + 1 = 2 1 + 1 = 3 = F (1) 2, r=0 since F (1) = 2 21 + 1 = 5. Assume P (n). To prove P (n + 1), note that n r=0 F r = ( n 1 r=0 F r) F n = (F n 2)F n [induction hypothesis] = (2 2n 1)(2 2n + 1) = 2 2 2n 1 = 2 2n+1 1 = F n+1 2 For part (b), suppose, by way of contradiction, that gcd(f n, F m ) = k > 1. Without loss of generality, suppose that n > m. By part (a), F n 2 = n 1 r=0 F r. Therefore, F m is a factor of F n 2. Since k F m, it must be the case that k F n 2. Since k F n, it also be the case that k F n (F n 2), that is, k 2. That means k = 2. But clearly 2 2n is even, so F n = 2 2n + 1 must be odd. That means 2 F n. This is a contradiction. Grading: For part (a), you got one point for the base case, and three points for the inductive step. 7. [6 points] 3

[2 points] Find all solutions modulo 11 to the quadratic congruence: x 2 1 (mod 11). [4 points] Find all solutions modulo p to the quadratic congruence: x 2 1 (mod p) when p is prime. (It s not enough to list the solutions; you must prove that you have found them all.) Solution: (a) This part is, of course, a special case of part (b) but it is simple enough to apply brute force. Here is the table of all squares mod 11: (b) x 0 1 2 3 4 5 6 7 8 9 10 x 2 mod 11 0 1 4 9 5 3 3 5 9 4 1 From the table, it is clear that if x 2 1 (mod 11), then x 1 (mod 11) or x 10 (mod 11). (Note for part (b) that 10 1 (mod 11).) x 2 1 (mod p) p x 2 1 But p is prime so p (x 1)(x + 1) p (x 1)(x + 1) p (x 1) or p (x + 1) Finally, note that x 1 (mod p) or x 1 (mod p). 1 1 (mod p) 2 0 (mod p) p 2 p = 2. So for p = 2 the unique solution is x 1 (mod 2) while for p > 2 the two solutions are x 1 (mod p) and x 1 p 1 (mod p). Grading: (a) +1 point for each of the correct solutions. (b) +1 point if you identified both solutions (disregarding the p = 2 subtlety). +0-2 points for providing an incomplete proof that there are no other solutions. Otherwise. +3 points for a complete proof. Solutions of the form 1 + kp got no credit for either parts. 8. [6 points] (a) [2 points] Define gcd and lcm. 4

(b) [4 points] Compute lcm(11413,12827). Solution: a) The gcd of a, b Z is the greatest d N + that divides both a and b. The lcm of a, b Z is the smallest c N + that is an integer multiple of both a and b. b) To find the lcm(a, b) we can use the identity ab = gcd(a, b) lcm(a, b). The first step is to find gcd(11413,12827) using Euclid s algorithm: So, gcd(11413, 12827) = 101 and r i = q i r i + r i+1 12827 = 1 11413 + 1414 11413 = 8 1414 + 101 1414 = 14 101. lcm(11413, 12827) = 11413 12827 101 = 1449451. Grading: For part (a), you got one for each definition. For (b), you got three for computing the gcd, and one more for recognizing how to use that to compute the lcm. 9. [6 points] Suppose A = {a 1,..., a n } and B = {0, 1}. [3 points] Show that there are 2 n functions from A to B. (Hint: you don t need induction!) [3 points] Show that there are 2 n 2 surjective functions from A to B. Solution: For part (a), note that a function must assign to each a i, i = 1,..., n either 0 or 1. Thus, for each a i, there are two choices. By the multiplication rule, there are 2 n such functions. For part (b), note that exactly two of the 2 n functions are not surjective: the function that maps each of a 1,..., a n to 1, and the function that maps each of a 1,..., a n to 0. The remaining 2 n 2 are surjective. 5