Discrete Mathematics and Probability Theory Summer 2015 Chung-Wei Lin Midterm 1

Similar documents
Discrete Mathematics and Probability Theory Summer 2015 Chung-Wei Lin Midterm 2

Prob. 1 Prob. 2 Prob. 3 Total

CS 70 Discrete Mathematics and Probability Theory Fall 2016 Seshia and Walrand Midterm 1 Solutions

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

Midterm 1. Your Exam Room: Name of Person Sitting on Your Left: Name of Person Sitting on Your Right: Name of Person Sitting in Front of You:

EECS 70 Discrete Mathematics and Probability Theory Fall 2015 Walrand/Rao Final

Discrete Mathematics and Probability Theory Summer 2014 James Cook Midterm 1 (Version B)

Discrete Mathematics and Probability Theory Summer 2014 James Cook Midterm 1

Prob. 1 Prob. 2 Prob. 3 Total

Midterm 1. Total. CS70 Discrete Mathematics and Probability Theory, Spring :00-9:00pm, 1 March. Instructions:

Midterm 2. Your Exam Room: Name of Person Sitting on Your Left: Name of Person Sitting on Your Right: Name of Person Sitting in Front of You:

Discrete Mathematics and Probability Theory Fall 2017 Ramchandran and Rao Midterm 2 Solutions

University of New Mexico Department of Computer Science. Midterm Examination. CS 261 Mathematical Foundations of Computer Science Spring, 2010

Discrete Mathematics and Probability Theory Fall 2014 Anant Sahai Midterm 1

Discrete Mathematics and Probability Theory Spring 2015 Vazirani Midterm #2 Solution

Discrete Mathematics and Probability Theory Spring 2014 Anant Sahai Midterm 1

CS 70 Discrete Mathematics and Probability Theory Summer 2016 Dinh, Psomas, and Ye Final Exam

Name: Mathematics 1C03

Assignment 3 Logic and Reasoning KEY

MATH 341, Section 001 FALL 2014 Introduction to the Language and Practice of Mathematics

Discrete Mathematics and Probability Theory Fall 2014 Anant Sahai Midterm 2

Discrete Mathematics for CS Fall 2003 Wagner MT2 Soln

Part I: Discrete Math.

MATH UN Midterm 2 November 10, 2016 (75 minutes)

Coding for Digital Communication and Beyond Fall 2013 Anant Sahai MT 1

Discrete Mathematics and Probability Theory Spring 2017 Rao Midterm 2 Solutions

Practice Exam Winter 2018, CS 485/585 Crypto March 14, 2018

Discrete Math I Exam II (2/9/12) Page 1

1 Recommended Reading 1. 2 Public Key/Private Key Cryptography Overview RSA Algorithm... 2

Math 223, Spring 2009 Final Exam Solutions

CSC 344 Algorithms and Complexity. Proof by Mathematical Induction

a 2 = ab a 2 b 2 = ab b 2 (a + b)(a b) = b(a b) a + b = b

MAT246H1S - Concepts In Abstract Mathematics. Solutions to Term Test 1 - February 1, 2018

1/ 17 2/20 3/19 4/12 5/14 6/13 7/10 Total /105. Please do not write in the spaces above.

Math 230 Final Exam, Spring 2009

Ma/CS 6a Class 1. Course Details

MATH 158 FINAL EXAM 20 DECEMBER 2016

Designing Information Devices and Systems I Spring 2018 Midterm 1. Exam Location: 155 Dwinelle Last Name: Cheng - Lazich

Math 51 First Exam October 19, 2017

University of Ottawa CSI 2101 Midterm Test Instructor: Lucia Moura. March 1, :00 pm Duration: 1:15 hs

First Midterm Examination

CS 360, Winter Morphology of Proof: An introduction to rigorous proof techniques

Lecture 21: Midterm 2 Review.

Solutions to the Midterm Test (March 5, 2011)

Designing Information Devices and Systems I Fall 2016 Babak Ayazifar, Vladimir Stojanovic Midterm 1. Exam location: 2050 VLSB, Last Name: Tong-Zzz

then the hard copy will not be correct whenever your instructor modifies the assignments.

Modular Arithmetic Inverses and GCD

Homework 1 Submission

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

2. Polynomials. 19 points. 3/3/3/3/3/4 Clearly indicate your correctly formatted answer: this is what is to be graded. No need to justify!

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

Show Your Work! Point values are in square brackets. There are 35 points possible. Tables of tautologies and contradictions are on the last page.

CS 170 Algorithms Spring 2009 David Wagner Final

Lecture 5: Arithmetic Modulo m, Primes and Greatest Common Divisors Lecturer: Lale Özkahya

Math 106: Calculus I, Spring 2018: Midterm Exam II Monday, April Give your name, TA and section number:

CS 170 Algorithms Fall 2014 David Wagner MT2

SUMMER MATH PACKET. Geometry A COURSE 227

Exam Security January 19, :30 11:30

Number theory (Chapter 4)

Math 13, Spring 2013, Lecture B: Midterm

Ma/CS 6a Class 3: The RSA Algorithm

Practice Final Exam Winter 2017, CS 485/585 Crypto March 14, 2017

Math 51 Midterm 1 July 6, 2016

CS 70 Discrete Mathematics and Probability Theory Spring 2018 Ayazifar and Rao Final

Designing Information Devices and Systems II Spring 2016 Anant Sahai and Michel Maharbiz Midterm 1. Exam location: 1 Pimentel (Odd SID + 61C)

Seunghee Ye Ma 8: Week 1 Notes September 29, 2016

Fall 2017 Test II review problems

Computer Science Foundation Exam

Math 261 Spring 2014 Final Exam May 5, 2014

Course 2BA1: Trinity 2006 Section 9: Introduction to Number Theory and Cryptography

All variables a, b, n, etc are integers unless otherwise stated. Each part of a problem is worth 5 points.

CS1800 Discrete Structures Fall 2017 October, CS1800 Discrete Structures Midterm Version A

Johns Hopkins Math Tournament 2018 Proof Round: Sequences

Course MA2C02, Hilary Term 2013 Section 9: Introduction to Number Theory and Cryptography

Midterm. CS265/CME309, Fall Instructor: Gregory Valiant. Name: SUID Number:

and problem sheet 1

Mathematics 220 Midterm Practice problems from old exams Page 1 of 8

Ma/CS 6a Class 2: Congruences

Proof by Contradiction

Designing Information Devices and Systems I Fall 2017 Midterm 1. Exam Location: 155 Dwinelle

Private Key Cryptography. Fermat s Little Theorem. One Time Pads. Public Key Cryptography

Fermat's Little Theorem

Do not start until you are given the green signal

University of Regina Department of Mathematics & Statistics Final Examination (April 21, 2009)

Math 299 Supplement: Modular Arithmetic Nov 8, 2013

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

CSC 125 :: Final Exam May 3 & 5, 2010

Ma/CS 6a Class 2: Congruences

Math 230 Final Exam, Spring 2008

Fall 2014 CMSC250/250H Midterm II

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

Attempt QUESTIONS 1 and 2, and THREE other questions. penalised if you attempt additional questions.

Today. Couple of more induction proofs. Stable Marriage.

CS1800 Discrete Structures Fall 2016 Profs. Gold & Schnyder April 25, CS1800 Discrete Structures Final

Midterm 2 Sample Introduction to Higher Math Fall 2018 Instructor: Linh Truong

Calculator Exam 2009 University of Houston Math Contest. Name: School: There is no penalty for guessing.

ECS 189A Final Cryptography Spring 2011

Math 55 Second Midterm Exam, Prof. Srivastava April 5, 2016, 3:40pm 5:00pm, F295 Haas Auditorium.

Contribution of Problems

CS 70 Final 9 August NAME (1 pt): SID (1 pt): TA (1 pt): Name of Neighbor to your left (1 pt): Name of Neighbor to your right (1 pt):

Transcription:

CS 70 Discrete Mathematics and Probability Theory Summer 2015 Chung-Wei Lin Midterm 1 PRINT Your Name:, last) first) SIGN Your Name: PRINT Your Student ID: CIRCLE your exam room: 2050 VLSB 10 EVANS OTHER Name of the person sitting to your left: Name of the person sitting to your right: After the exam starts, please write your student ID or name) on every odd page we will remove the staple when scanning your exam). We will not grade anything on the extra pages Pages 14 16) or outside of the space provided for a problem unless we are clearly told in the space provided for the question to look there. Except special notices, you must show your work to get credits. You may consult one single-sided sheet of notes. Apart from that, you may not look at books, notes, etc. Calculators, phones, and computers are not permitted. You have 110 minutes. There are 9 questions for a total of 100 points plus 15 bonus points. Use the number of points as a rough guide for the amount of time to allocate to that question. Note that the last two questions 8 and 9) are harder than the rest, so you should attempt it only after you take a good shot at the rest and don t feel bad if you cannot get them). There are 16 pages sides) on the exam. Notify a proctor immediately if a page is missing. Do not turn this page until your instructor tells you to do so. CS 70, Summer 2015, Midterm 1 1

1. TRUE or FALSE First Round 8 points, 1 point for each part) For any proposition P,Q,R and x,y R, determine whether the following statements are true or false. Just circle the correct choice. No explanation is required. No partial credit will be given. T F P Q) Q P). T F P P). T F P Q) P Q). T F P Q) Q R)) P R). T F x P) x P). T F y x P x y P. T F x 0 y 0) is true means there exists exactly one of x and y being 0. T F In R, 2015 points can determine a unique polynomial of degree 2014. Answer: F,T,T,T,T,F,F,F. 2. Counting Minions and Bananas 6 points, 3 points for each part) For the following two parts, just write down your answers. You do not need to calculate the exact value of a ) b or a!. No explanation is required. No partial credit will be given. Figure 1: They are Kevin, Bob, Stuart,... [http://scifi.stackexchange.com/]. a) There are 7 different minions in the figure. Three of them are going to form a team and find their new master. How many different ways to form the team, where one member has exactly one eye and the other two members have two eyes? Answer: 2 5 1) 2) or 20. b) How many different anagrams of BANANA are there? 6! Answer: 3!2! or 60. 2

3. Conceptual Questions 10 points, 1/1/2/3/3 points for each part) a) Kevin and Bob decide to apply the RSA cryptography so that Kevin can send a secret message to Bob. There are several important variables, p,q,n,e,d, defined in the RSA cryptography. Which of them are public? No explanation is required. No partial credit will be given.) Answer: N and e you can also answer N and d with appropriate explanation). b) Following Part a), let s switch to private variables. Are those private variables kept by Kevin only, Bob only, or both Kevin and Bob? No explanation is required. No partial credit will be given.) Answer: Bob. c) Explain why it is difficult for an attacker to break the RSA cryptography. We are expecting only one sentence.) Answer: Factoring N is very difficult. d) Explain why the two primes in RSA must be different. We are expecting two reasons.) Answer: If p q, the correctness is not guaranteed because x e ) d x mod N) is not always true. Besides, the security level is lowered because taking square root of N can easily get the prime. e) Explain why p must be prime in the polynomial secret sharing with mod p. We are expecting two reasons.) Answer: If p is not prime, the correctness is not guaranteed because d + 1 points cannot always determine a unique polynomial of degree at most d. Besides, the security level is lowered because some information about the secret may be revealed, even if there are no sufficient points. 3

4. Stable Marriage 8 points, 3/5 points for each part) a) Is the pairing {1,A),2,B),3,C)} stable for the following case? Why? Men Preference Lists Women Preference Lists 1 C > A > B A 2 > 1 > 3 2 B > C > A B 3 > 1 > 2 3 B > C > A C 3 > 2 > 1 Answer: No. 3,B) is a rogue couple because 3 prefers B to C and B prefers 3 to 2. Note: It is the only rogue couple in the pairing. b) Find a stable pairing for the following case. Answer: Run the men-proposing SMA: Men Preference Lists Women Preference Lists 1 D > B > A > C A 1 > 4 > 2 > 3 2 A > D > B > C B 4 > 3 > 2 > 1 3 D > C > B > A C 1 > 3 > 2 > 4 4 D > A > B > C D 3 > 1 > 2 > 4 Day 1 Day 2 Day 3 Day 4 Day 5 Day 6 Day 7 A 2 2,4 4 4 1,4 1 1 B 1 1 1,2 2 2,4 4 C 2 D 1,3,4 3 2,3 3 3 3 3 The stable pairing: {1,A),2,C),3,D),4,B)}. Note 1: If you run the women-proposing SMA, you will get the same stable pairing. Note 2: You can ignore 3,D) first because they must be paired together each of them is the favorite partner of the other). 4

5. Minions Using RSA 8 points, 5/3 points for each part) Kevin and Bob decide to apply the RSA cryptography so that Kevin can send a secret message to Bob. a) Assuming p 3, q 11, and e 7, what is d? Calculate the exact value. Answer: 3 1)11 1) 20, so d is the multiplicative inverse of 7 mod 20. Run egcd20,7) and get 1 1) 20 + 3) 7, so d 3. Note: You can also try d 1,2,3,... and get d 3. b) Following Part a), what is the original message if Bob receives 4? Calculate the exact value. Answer: N 3 11 33. 4 d 4 3 64 31 mod 33). 5

6. Minions Using Error Correction Codes 10 points, 5 points for each part) a) Kevin wants to send a message of 4 packets to Stuart and guard against 1 lost packet. Working over GF7), he finds the unique polynomial Px) that passes through the points he wants to send, and sends Stuart 5 packets: 0,P0)), 1,P1)), 2,P2)), 3,P3)), 4,P4)). Stuart receives the following packets: 0,3), 1,0), 2,0), 4,0). What is the value of the missing packet? Calculate the exact value. Answer: 0 x) x 1)x 2)x 4) 1) 2) 4) x 1)x 2)x 4) 8 x 1)x 2)x 4) mod 7); Px) 3 0 x) 3x 1)x 2)x 4) 4x 1)x 2)x 4) mod 7); P3) 42)1) 1) 6 mod 7). Note: You do not need to calculate 1 x), 2 x), or 4 x) as they will be multiplied by 0. 6

Figure 2: Minions using error correction codes [http://despicableme.wikia.com/wiki/despicable_me_wiki]. b) Kevin wants to send a message of 60 ordered packets to Stuart. Those packets will first go through a hungry dragon who will eat at most 1 of all packets do not ask why the dragon loves eating packets). 5 The remaining packets will then go through a powerful but malicious witch who will change the data of at most 1 of all packets. Given this scenario, how many packets should Kevin send so that Stuart can 8 recover the message? Answer: We observe that the worst case is when 1/5 packets are missing and then 1/8 packets are corrupted. Assume m is the number of all packets, m must satisfy )) )) 7 4 1 4 8 5 m) 8 5 m) 60. Solving the inequality can get m 100. Note: Students can get bonus points by trying to minimize the number of packets and answering 97. This is true because the more precise inequality is 7 8 4 5 m) 1 8 4 5 m) 60. Note: Students can also solve the problem by interpreting at most 1 8 of all packets as at most 1 8 of all original packets. This will result in 4 5 m) 1 ) ) 1 8 m) 8 m) 60. Solving the inequality can get m 110. The optimal solution for this is 107. 7

7. TRUE or FALSE Second Round 40 points, 10 points for each part) For any of the following statements, claim TRUE or FALSE first. If you claim TRUE, prove it. If you claim FALSE, disprove it e.g., provide a counterexample). a) a is an odd number if and only if a 2 is an odd number. TRUE FALSE Answer: TRUE or FALSE, see Note below). It is an if and only if statement, so proving two directions is required. Use direct proof to prove if a is an odd number, then a 2 is an odd number. If a is an odd number, a 2k + 1 for some integer k. Then, a 2 2k + 1) 2 4k 2 + 4k + 1 22k 2 + 2k) + 1, which is an odd number. Use proof by contraposition to prove if a 2 is an odd number, then a is an odd number. If a is not an odd number, a 2k for some integer k. Then, a 2 2k) 2 4k 2 22k 2 ), which is not an odd number. We prove the claim by proving its contrapositive. After proving the two directions, the statement is proved. Note: Students can get bonus points by answering FALSE with counterexample a 3. 8

b) If a 0 0; a 1 1; then a n 2 n 1 for any integer n 0. a n a n 1 + 2a n 2 + 2 for any integer n 2, TRUE FALSE Answer: TRUE. Use strong induction with two base cases to prove the statement. Base case n 0 and n 1): a 0 0 2 0 1; a 1 1 2 1 1. Inductive hypothesis: assume a i 2 i 1 for all i, 0 i k. Inductive step: a k+1 a k + 2a k 1 + 2 2 k 1 + 22 k 1 1) + 2 2 k 1 + 2 k 2 + 2 2 k+1 1. By the principle of induction, the statement is proved. 9

c) For all integers a,b,c where c > 0, if a has no multiplicative inverse mod c, then ax b mod c) has no solution. TRUE FALSE Answer: FALSE. Let a 2, b 0, c 4. 2 has no multiplicative inverse mod 4 because gcd2, 4) 2 1, but 2x 0 mod 4) has two solutions, 0 and 2. 10

d) Given n n 1) integers x 1,x 2,...,x n and a prime p, x 1 + x 2 +... + x n ) p x p 1 + xp 2 +... + xp n mod p). TRUE FALSE Answer: TRUE. First, to prove, for any integer a, a p a mod p). If a 0 mod p), then a p 0 p 0 a mod p). If a 0 mod p), then, by the Fermat s Little Theorem, a p a p 1 a 1 a a mod p). As a result, LHS x 1 + x 2 +... + x n ) p x 1 + x 2 +... + x n mod p); RHS x p 1 + xp 2 +... + xp n x 1 + x 2 +... + x n mod p). Therefore, LHS RHS mod p). 11

8. Simple But Not Easy 10 points) Prove that, for any positive integer n, 3 + ) n 5 + 3 n is divisible by 2 n. Answer: Use strong induction with two base cases to prove the statement. Base case n 1 and n 2): 3 + ) 1 5 + 3 1 6 is divisible by 2 1 2; 28 is divisible by 2 2 4. Inductive hypothesis: assume Inductive step: 3 + ) i 5 + 3 i is divisible by 2 i for all i, 1 i k. 3 + ) 2 5 + 3 2 3 + ) k+1 5 + 3 ) k+1 5 3 + k + 3 ) k 3 + ) 5 + 3 )) 5 3 ) 5 3 + ) k 5 3 + ) 5 3 ) k 5 ) 2 k a 6) 3 ) 5 3 + ) 5 3 + ) k 1 5 3 + ) 5 3 ) 5 3 k 1 for some integer a 2 k+1) 3a) 4 3 + ) k 1 5 4 3 k 1 for some integer a 2 k+1) 3a) 4 3 + ) k 1 5 + 3 ) ) k 1 5 for some integer a 2 k+1) ) 3a) 4 2 k 1 b for some integers a,b 2 k+1) 3a) 2 k+1) b) for some integers a,b 2 k+1) 3a b) for some integers a,b. By the principle of induction, the statement is proved. 12

9. TRUE or FALSE Ultimate and Bonus Round 15 bonus points) For the following statement, claim TRUE or FALSE first. If you claim TRUE, prove it. If you claim FALSE, disprove it. For any preference lists of 3 men and 3 women, it is impossible to have 5 or more stable pairings in the stable marriage problem. TRUE FALSE Answer: TRUE. There are total 3! 6 possible pairings. We will use proof by contradiction to prove the statement. Assume there are 5 or more stable pairings. Given the assumption, we first claim that, for any pair of a man and a woman, it must be in at least one stable pairing. We can prove this claim by another proof by contradiction: Assume the pair is not in any stable pairing. Then, there are only 4 possible pairings remaining 2 possible pairings are canceled out). For example, if 1,A) is not in any stable pairing, then there are only 4 possible pairings {1,A),2,B),3,C)} and {1,A),2,C),3,B)} are canceled out). It is a contradiction, so the claim is proved given the original assumption). By the claim, a man is paired with each woman in at least one stable pairing, so his optimal woman is the first woman in his preference list, and his pessimal woman is the last woman in his preference list. Without loss of generality we can switch the labels between 1,2,3 or between A,B,C), we can assign the preference lists left) and determine the rest preference lists right) as follows: Men Preference Lists Men Preference Lists 1 A >? > B 1 A > C > B 2 B >? >? 2 B > A > C 3 C >? >? 3 C > B > A Similarly, by the claim, a woman is paired with each man in at least one stable pairing, so her optimal man is the first man in her preference list, and her pessimal man is the last man in her preference list. To match preference lists of men, we can determine the preference lists as follows: Women Preference Lists A 3 > 2 > 1 B 1 > 3 > 2 C 2 > 1 > 3 However, {1,A),2,C),3,B)}, {1,B),2,A),3,C)}, and {1,C),2,B),3,A)} are not stable pairings because 2,A), 1,C), and 3,B) are rogue couples, respectively. As a result, it is a contradiction, so it is impossible to have 5 or more stable pairings. 13