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

Similar documents
Discrete Mathematics and Probability Theory Summer 2014 James Cook Midterm 1

Discrete Mathematics and Probability Theory Summer 2014 James Cook Final Exam

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

Prob. 1 Prob. 2 Prob. 3 Total

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

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:

Discrete Mathematics and Probability Theory Spring 2014 Anant Sahai Midterm 1

Prob. 1 Prob. 2 Prob. 3 Total

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 Summer 2014 James Cook Final Exam

Discrete Mathematics and Probability Theory Fall 2014 Anant Sahai Midterm 1

Discrete Mathematics and Probability Theory Fall 2014 Anant Sahai Midterm 2

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

Do not start until you are given the green signal

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

8. Given a rational number r, prove that there exist coprime integers p and q, with q 0, so that r = p q. . For all n N, f n = an b n 2

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

1. Given the public RSA encryption key (e, n) = (5, 35), find the corresponding decryption key (d, n).

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

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

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

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

Simple Math: Cryptography

Name: Mathematics 1C03

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

Discrete Mathematics and Probability Theory Fall 2017 Ramchandran and Rao Final Solutions

Math 430 Exam 1, Fall 2006

Designing Information Devices and Systems I Spring 2016 Elad Alon, Babak Ayazifar Midterm 1

Designing Information Devices and Systems I Fall 2016 Babak Ayazifar, Vladimir Stojanovic Midterm 1. Exam location: 145 Dwinelle, last SID# 2

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

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

MTH 310, Section 001 Abstract Algebra I and Number Theory. Sample Midterm 1

Math 430 Final Exam, Fall 2008

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

Assignment 3 Logic and Reasoning KEY

Math 13, Spring 2013, Lecture B: Midterm

2k n. k=0. 3x 2 7 (mod 11) 5 4x 1 (mod 9) 2 r r +1 = r (2 r )

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

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

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

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

CS1800 Discrete Structures Fall 2016 Profs. Aslam, Gold, Ossowski, Pavlu, & Sprague 27 October, CS1800 Discrete Structures Midterm Version A

Practice Midterm Exam Solutions

LECTURE 5: APPLICATIONS TO CRYPTOGRAPHY AND COMPUTATIONS

Ma/CS 6a Class 2: Congruences

Designing Information Devices and Systems II Spring 2016 Anant Sahai and Michel Maharbiz Midterm 2

CS1800 Discrete Structures Spring 2018 February CS1800 Discrete Structures Midterm Version A

Math 407: Probability Theory 5/10/ Final exam (11am - 1pm)

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

Fall 2014 CMSC250/250H Midterm II

Designing Information Devices and Systems I Fall 2015 Anant Sahai, Ali Niknejad Midterm 1. Exam location: 60 Evans, last digit SID= 6

Designing Information Devices and Systems I Fall 2015 Anant Sahai, Ali Niknejad Final Exam. Exam location: RSF Fieldhouse, Back Left, last SID 6, 8, 9

McGill University Faculty of Science. Solutions to Practice Final Examination Math 240 Discrete Structures 1. Time: 3 hours Marked out of 60

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

15-251: Great Theoretical Ideas In Computer Science Recitation 9 : Randomized Algorithms and Communication Complexity Solutions

CS 70 Discrete Mathematics and Probability Theory Summer 2016 Dinh, Psomas, and Ye Discussion 8A Sol

2 Elementary number theory

Discrete Mathematics and Probability Theory Spring 2016 Rao and Walrand Discussion 6A Solution

Math 223, Spring 2009 Final Exam Solutions

MATH 114 Fall 2004 Solutions to practice problems for Final Exam

Solutions to the Midterm Test (March 5, 2011)

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

Mat Week 8. Week 8. gcd() Mat Bases. Integers & Computers. Linear Combos. Week 8. Induction Proofs. Fall 2013

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

Lecture Notes on DISCRETE MATHEMATICS. Eusebius Doedel

Review Sheet for the Final Exam of MATH Fall 2009

Student Responsibilities Week 8. Mat Section 3.6 Integers and Algorithms. Algorithm to Find gcd()

Designing Information Devices and Systems I Fall 2017 Midterm 2. Exam Location: 150 Wheeler, Last Name: Nguyen - ZZZ

University of Ottawa CSI 2101 Midterm Test Instructor: Lucia Moura. February 9, :30 pm Duration: 1:50 hs. Closed book, no calculators

1 Overview and revision

University of California, San Diego Department of Computer Science and Engineering CSE 20. Solutions to Midterm Exam Winter 2018

Discrete Mathematics and Probability Theory Spring 2016 Rao and Walrand Note 8

Introduction to Cryptography Lecture 13

University of Regina Department of Mathematics and Statistics Math (Fall 2013) Final Exam December 10, 2013

452 FINAL- VERSION E Do not open this exam until you are told. Read these instructions:

Solutions to Practice Final 3

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!

Discrete Mathematics and Probability Theory Fall 2012 Vazirani Note 1

Designing Information Devices and Systems I Spring 2016 Elad Alon, Babak Ayazifar Midterm 1

Ma/CS 6a Class 2: Congruences

PLEASE DO ANY 6 of the following 8 problems. Work carefully

Propositional Logic Not Enough

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

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

CRYPTOGRAPHY AND NUMBER THEORY

Designing Information Devices and Systems I Summer 2017 D. Aranki, F. Maksimovic, V. Swamy Midterm 1. Exam Location: 2050 VLSB

Announcements. Exam 1 Review

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. Some facts about sets are on the last page.

Discrete Mathematics and Probability Theory Summer 2014 James Cook Note 5

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

Discrete Mathematics and Probability Theory Fall 2014 Anant Sahai Homework 5. This homework is due October 6, 2014, at 12:00 noon.

CS2800 Questions selected for fall 2017

Solutions to 2015 Entrance Examination for BSc Programmes at CMI. Part A Solutions

Inference and Proofs (1.6 & 1.7)

CS70 is a course about on Discrete Mathematics for Computer Scientists. The purpose of the course is to teach you about:

Designing Information Devices and Systems I Spring 2017 Babak Ayazifar, Vladimir Stojanovic Midterm 1

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

Number theory. Myrto Arapinis School of Informatics University of Edinburgh. October 9, /29

Math 230 Final Exam, Spring 2008

Transcription:

CS 70 Discrete Mathematics and Probability Theory Summer 2014 James Cook Midterm 1 (Version B) Instructions: Do not turn over this page until the proctor tells you to. Don t write any answers on the backs of pages (we won t be scanning those). There is an extra page at the end in case you run out of space. The exam has 11 pages (the last two are mostly blank). PRINT your student ID: PRINT AND SIGN your name:, (last) (first) (signature) PRINT your discussion section and GSI (the one you attend): Name of the person to your left: Name of the person to your right: Name of someone in front of you: Name of someone behind you: CS 70, Summer 2014, Midterm 1 (Version B) 1

True/False 1. (16 pts.) For each of the following statements, circle T if it is true and F otherwise. You do not need to justify or explain your answers. T F One way to prove a statement P is to assume P and conclude P. T F Solution: False. This is not a valid proof method. For example, it would allow us to prove 0 = 1, as follows: Proof. Assume 0 = 1. Clearly it is true that (0 = 1). We should not be able to prove 0 = 1, so this is not a valid proof method. To prove P(n) is true for all negative integers n, it s enough to prove P( 1) and ( n Z)(P(n + 1) P(n)). Solution: True. Proof: Let Q(n) be the proposition P( n) is true. Then we are given that Q(1) and that ( m Z)(Q(m 1) Q(m)) (substituting m for n in P(n + 1) P(n)). So by induction, Q(n) is true for every positive integer n, which is what we wanted to prove. T F P (Q R) ( P (Q R)) Solution: False. For example, if P and Q are false but R is true, then the left-hand side is true but the right-hand side is false. T F (P Q) R R (P Q) Solution: True. This can be verified with a truth table, or the following reasoning using the simpler logical equivalences A B A B, A B B A, (A B ) A B and A A: (P Q) R R (P Q) R ( P Q) R ( P Q) R (P Q) T F ( x R)( y R)(x > 0 x 2 y) T F T F Solution: False. Indeed, we can prove (( x R)( y R)(x > 0 x 2 y)), which is logically equivalent (using De Morgan s laws) to ( x R)( y R)( (x > 0 x 2 y)). Proof. Let x R be any number. Case 1: x 0. In this case, take y = 0 (or any real number, for that matter), and it will be the case that (x > 0 x 2 y). Case 2: x > 0. Then take y = x 2 /2, and again, it will be the case that (x > 0 x 2 y). If p and q are prime numbers and p q, then there exists a number x such that x p 1 (mod q). Solution: True. Every number coprime to q has an inverse mod q, and distinct prime numbers are always coprime. For every degree-5 polynomial P(x), there are at least two real numbers x,y R such that x y and P(x) = 0 and P(y) = 0. CS 70, Summer 2014, Midterm 1 (Version B) 2

Solution: False. For example, consider P(x) = x 5. There is only one root, x = 0. T F In every instance of the stable marriage problem, if a man M is optimal for a woman W, then W is not optimal for M. Solution: False. For example, consider two men and two women with the following preferences: Woman Prefs Man Prefs A 1 2 1 A B Then 1 is optimal for A and A is optimal for B 2 1 2 B A 1. CS 70, Summer 2014, Midterm 1 (Version B) 3

Short Answer 2. (4 pts.) Find a stable matching for the following instance of the stable marriage problem: Woman Prefs Man Prefs A 1 2 3 4 1 A B C D B 1 3 2 4 2 B D A C C 1 4 2 3 3 C A B D D 4 2 3 1 4 C A B D Solution: Let s run the propose and reject algorithm. Day 1: 1 proposes to A, 2 proposes to B, 3 and 4 propose to C. Night 1: C rejects 3. Day 2: 3 proposes to A. Night 2: A rejects 3. Day 3: 3 proposes to B. Night 3: B rejects 2. Day 4: 2 proposes to D Now each woman has a proposal from a different man, so we have a stable matching: (A, 1), (B, 3), (C, 4), (D, 2). 3. (4 pts.) Compute 2 63 + 3 14 (mod 7). Solution: Using Fermat s Little Theorem, 2 6 3 6 1 (mod 7), so 2 63 2 3 1 (mod 7) and 3 14 3 2 2 (mod 7). So 2 63 + 3 14 3 (mod 7). CS 70, Summer 2014, Midterm 1 (Version B) 4

4. (3 pts.) Suppose Alice wants to send Bob a message over an unreliable channel. Her message consists of 5 pieces, and each piece is a number in the range 0,1,...,18. The channel might change up to 3 of the pieces of her message. Bob will not know which pieces were changed. If Alice decides to use the error correcting code we learned in class, how many pieces (numbers) must she send? Solution: The error correcting code for general errors requires sending n + 2k pieces, where n = 5 is the length of the original message and k = 3 is the maximum number of errors. So Alice must send 11 pieces. 5. (4 pts.) Compute 6 122 (mod 55). Solution: Recall that x (p 1)(q 1) 1 (mod pq) if p and q are prime and x is coprime to pq. Since pq = 55, we deduce that p = 5 and q = 11, so (p 1)(q 1) = 40. So for any k, 6 40k 1 (mod 55). So 6 122 6 120 6 2 1 36 36 (mod 55). 6. (4 pts.) Prove that ( x N)( y N)(y > 1 gcd(x,y) = 1). Solution: Given any x N, take y = x + 1. Then x and y cannot have any common divisors greater than 1. CS 70, Summer 2014, Midterm 1 (Version B) 5

Induction 7. (12 pts.) Prove using induction that for every integer n > 0, there exist integers a, b and c such that a > 0, b > 0, c > 0 and a 2 + b 2 = c n. Hint: You will probably want to use strong induction, and prove the statement for n = 1 and n = 2 first. For n = 2, one possible solution is a = 3,b = 4,c = 5. Solution: Proof by strong induction. Induction hypothesis: let n be a positive integer and assume that for every 0 < k < n, there is a solution to a 2 + b 2 = c k. If n = 1, set a = 1, b = 1, c = 2. If n = 2, set a = 3, b = 4, c = 5 as suggested. In both cases, you can verify that a 2 + b 2 = c n. The last case is that n > 2. Then find any solution a,b,c to the equation (a ) 2 + (b ) 2 = c n 2. Then set a = ca and b = ca. Then a 2 + b 2 = c 2 ((a ) 2 + (b ) 2 ) = c 2 (c n 2 ) = c n. CS 70, Summer 2014, Midterm 1 (Version B) 6

Modular Arithmetic 8. (12 pts.) Find integers x and y in the range 0,1,...,42 satisfying the following two equastions: 12x y + 3 (mod 43) and x + y 1 (mod 43). Solution: The second equation implies Substituting into the first equation, we have so so y x + 1 (mod 43) 12x x + 4 (mod 43) 13x 4 (mod 43) x 13 1 4 (mod 43). We ll use the extended Euclidean algorithm to find 13 1 (mod 43): gcd(43,13) 1 = 1 13 3 (43 3 13) = 3 43 + 10 13 = gcd(13,4) 1 = 0 4 + 1 (13 3 4) = 1 13 3 4 = gcd(4,1) 1 = 0 4 + 1 1 = 1 So 13 1 10 (mod 43). Continuing, and substituting back for y, we have x 10 4 40 (mod 43) y x + 1 39 4 (mod 43). Indeed, we can check that x = 40,y = 4 satisfies the two equations. CS 70, Summer 2014, Midterm 1 (Version B) 7

Secret Sharing 9. (12 pts.) Alice decides to share a secret with 12 people so that any 3 of them can get together to find out the secret. Her secret is an integer s which is between 0 and 12. Following the secret-sharing protocol from class, she finds a polynomial P(x) with the appropriate degree, such that P(0) s (mod 13). Three of her friends decide to get together to learn the secret. Their combined knowledge is: P(1) 2 (mod 13), P(2) 1 (mod 13), and P(8) 1 (mod 13). What is the secret P(0)? Express your answer as a number between 0 and 12. Solution: According to the secret-sharing protocol from class, P(x) should have degree 2 in order for any three people to be able to discover the secret. We ll use Lagrange interpolation to find P(x). 1 (x) 2 (x) 3 (x) (x 2)(x 8) (1 2)(1 8) x2 10x + 3 2(x 2 10x + 3) 2x 2 + 6x + 6 7 (x 1)(x 8) (2 1)(2 8) x2 9x + 8 2(x 2 9x + 8) 2x 2 + 8x + 3 6 (x 1)(x 2) (8 1)(8 2) x2 3x + 2 9(x 2 3x + 2) 9x 2 + 12x + 5 42 Noting that 7 1 2 (mod 13), ( 6) 1 7 1 2 (mod 13) and 42 1 3 1 9 (mod 13). We construct our polynomial: P(x) = 2 1 (x) + 2 (x) + 3 (x) 2x 2 + 6x + 7 (mod 13). The secret then is P(0) 7 (mod 13). (Note that we could have saved some work by only computing the constant terms.) CS 70, Summer 2014, Midterm 1 (Version B) 8

Polynomials 10. (6 pts.) Suppose p is a prime number, P(x) is a polynomial with degree d, and 0 < d < p/2. Prove that there are less than 2d + 1 distinct values of x such that P(x) 2 P(x) + 1 0 (mod p). Solution: Suppose for a contradiction that there are at least 2d + 1 distinct values of x such that P(x) 2 P(x) + 1 0 (mod p). Then for each of those x-values, we have P(x) 2 + 1 P(x) (mod p). So P(x) and P(x) 2 + 1 are two polynomials of degree at most 2d that match at 2d + 1 points: so they are the same polynomial. But this is impossible, since they have different degrees. CS 70, Summer 2014, Midterm 1 (Version B) 9

[Extra page. If you want the work on this page to be graded, make sure you tell us on the problem s main page.] CS 70, Summer 2014, Midterm 1 (Version B) 10

[Doodle page! Draw us something if you want or give us suggestions or complaints.] CS 70, Summer 2014, Midterm 1 (Version B) 11