Discrete Mathematics for CS Fall 2003 Wagner MT2 Soln

Similar documents
Name: Mathematics 1C03

Solution to Midterm Examination

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

Discrete Mathematics and Probability Theory Summer 2014 James Cook Midterm 1

CS2800 Questions selected for fall 2017

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

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

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:

Ma/CS 6a Class 4: Primality Testing

ECE596C: Handout #11

Cryptography. Course 1: Remainder: RSA. Jean-Sébastien Coron. September 21, Université du Luxembourg

Lecture 22: RSA Encryption. RSA Encryption

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

Lemma 1.2. (1) If p is prime, then ϕ(p) = p 1. (2) If p q are two primes, then ϕ(pq) = (p 1)(q 1).

Slides by Kent Seamons and Tim van der Horst Last Updated: Oct 1, 2013

Ma/CS 6a Class 4: Primality Testing

Prob. 1 Prob. 2 Prob. 3 Total

Prob. 1 Prob. 2 Prob. 3 Total

Math.3336: Discrete Mathematics. Mathematical Induction

Algorithmic Number Theory and Public-key Cryptography

Ma/CS 6a Class 2: Congruences

CS280, Spring 2004: Final

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

Encryption: The RSA Public Key Cipher

RSA. Ramki Thurimella

Number theory (Chapter 4)

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!

Introduction to Public-Key Cryptosystems:

Mathematical Foundations of Public-Key Cryptography

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

Candidates must show on each answer book the type of calculator used. Only calculators permitted under UEA Regulations may be used.

4. What is the probability that the two values differ by 4 or more in absolute value? There are only six

Midterm 1 for CS 170

Lecture 1: Introduction to Public key cryptography

NAME: Be clear and concise. You may use the number of points assigned toeach problem as a rough

The security of RSA (part 1) The security of RSA (part 1)

Question: Total Points: Score:

Ma/CS 6a Class 2: Congruences

HOMEWORK 11 MATH 4753

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

Number Theory A focused introduction

CPSC 467b: Cryptography and Computer Security

Introduction to Cybersecurity Cryptography (Part 5)

Overview. Background / Context. CSC 580 Cryptography and Computer Security. March 21, 2017

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

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

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

Iterated Encryption and Wiener s attack on RSA

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

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

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

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

Ma/CS 6a Class 3: The RSA Algorithm

Cryptography. pieces from work by Gordon Royle

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

Cryptography and Security Midterm Exam

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

Public-Key Cryptosystems CHAPTER 4

MATH 158 FINAL EXAM 20 DECEMBER 2016

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

Public Key Algorithms

Public Key Cryptography

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

CS 170 Algorithms Spring 2009 David Wagner Final

Attacks on RSA & Using Asymmetric Crypto

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

Elementary Number Theory MARUCO. Summer, 2018

MODULAR ARITHMETIC KEITH CONRAD

1 Number Theory Basics

MATH3302 Cryptography Problem Set 2

Carmen s Core Concepts (Math 135)

Network Security Technology Spring, 2018 Tutorial 3, Week 4 (March 23) Due Date: March 30

The RSA public encryption scheme: How I learned to stop worrying and love buying stuff online

Solutions to the Midterm Test (March 5, 2011)

1 What are Physical Attacks. 2 Physical Attacks on RSA. Today:

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

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

Addition. Ch1 - Algorithms with numbers. Multiplication. al-khwārizmī. al-khwārizmī. Division 53+35=88. Cost? (n number of bits) 13x11=143. Cost?

ICS141: Discrete Mathematics for Computer Science I

Week 7 An Application to Cryptography

OWO Lecture: Modular Arithmetic with Algorithmic Applications

Notes 10: Public-key cryptography

Number Theory Notes Spring 2011

Powers in Modular Arithmetic, and RSA Public Key Cryptography

dit-upm RSA Cybersecurity Cryptography

EXAM IN. TDA352 (Chalmers) - DIT250 (GU) 18 January 2019, 08:

Admin. ! Will post sample questions soon. 1. Choose a bit-length k. 2. Choose two primes p and q which can be represented with at most k bits

CPSC 467b: Cryptography and Computer Security

LECTURE 5: APPLICATIONS TO CRYPTOGRAPHY AND COMPUTATIONS

IRREDUCIBILITY TESTS IN F p [T ]

CRYPTOGRAPHY AND NUMBER THEORY

CS1800 Discrete Structures Final Version A

Mathematics of Cryptography

YALE UNIVERSITY DEPARTMENT OF COMPUTER SCIENCE

Pseudo-random Number Generation. Qiuliang Tang

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

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

Solutions to the Mathematics Masters Examination

Definition: For a positive integer n, if 0<a<n and gcd(a,n)=1, a is relatively prime to n. Ahmet Burak Can Hacettepe University

Logic gates. Quantum logic gates. α β 0 1 X = 1 0. Quantum NOT gate (X gate) Classical NOT gate NOT A. Matrix form representation

Transcription:

CS 70 Discrete Mathematics for CS Fall 2003 Wagner MT2 Soln PRINT your name:, (last) SIGN your name: (first) PRINT your username on cory.eecs: WRITE your section number (101 or 102): This exam is open-book, open-notes. No calculators are permitted. Do all your work on the pages of this examination. If you need more space, you may use the reverse side of the page, but try to use the reverse of the same page where the problem is stated. You have 80 minutes. There are 4 questions, worth from 20 to 30 points each (100 points total). The questions are of varying difficulty, so avoid spending too long on any one question. Do not turn this page until the instructor tells you to do so. Problem 1 Problem 2 Problem 3 Problem 4 Total CS 70, Fall 2003, MT2 Soln 1

Problem 1. [True or false] (20 points) Circle TRUE or FALSE. You do not need to justify your answers on this problem. N denotes the set of natural numbers, {0,1,2,...}. (a) TRUE or False : Let p be prime; then we re guaranteed that x p 1 1 (mod p) for all x N. [Counterexample: x 0 (mod p).] (b) TRUE or False : Let p N be such that x p 1 1 (mod p) holds for every x N with gcd(x, p) = 1; then p is guaranteed to be prime. [Counterexample: p = any Carmichael number.] (c) True or FALSE: Let p be prime and suppose x N satisfies x 0 (mod p); then we re guaranteed that x p2 p 1 (mod p 2 ). [Proof: ϕ(p 2 ) = p 2 p, since there are p multiples of p less than p 2. If x 0 (mod p), then gcd(x, p 2 ) = 1, and the result then follows from Euler s theorem.] (d) TRUE or False : Let S, T be arbitrary sets; then we re guaranteed that S T = S + T. [Counterexample: S = T = {0}.] (e) TRUE or False : Let A,B be events; then we re guaranteed that Pr[B A] = Pr[A and B]/Pr[B]. [Counterexample: any events where Pr[A] Pr[B].] CS 70, Fall 2003, MT2 Soln 2

Problem 2. [Short answer] (30 points) Show your work on these problems. Circle your final answer. (a) You ve been hired by the local phone company. They re concerned, because all the local taxi companies have started demanding phone numbers made up of exactly 2 different digits. (For instance, 555-5556 and 811-1881 are acceptable, but 111-1111 and 123-4567 are not.) Your job is to help the phone company figure out how long they ve got before they run out of acceptable phone numbers. How many 7-digit numbers are there that contain exactly 2 different digits? ( ) 10 (2 7 2) = 5670. 2 ( 10 ) 2 counts the number of ways to pick two digits to be part of the phone number (e.g., 8 and 1). 2 7 counts the number of phone numbers you can make from those two digits (e.g., 811-1881, 888-8881, 888-8888), since in each of the 7 positions we can choose either of the two available digits. Finally, we have to subtract 2 for the one-digit phone numbers (888-8888, 111-1111) which were counted in the 2 7 but which shouldn t be included in the final answer. (b) What is 70 2003 mod 11? Simplify your answer to an integer between 0 and 10. (Reminder: no calculators allowed! You should be able to do this in your head, in any case.) 70 2003 4 2003 4 2003 mod 10 4 3 64 9 (mod 11). Answer: 9 mod 11. CS 70, Fall 2003, MT2 Soln 3

(c) What is 70 2003 mod 77? Simplify your answer to an integer between 0 and 76. 70 2003 0 2003 0 (mod 7). By part (b), 70 2003 9 (mod 11). By the Chinese remainder theorem, we see 70 2003 42 (mod 77). Answer: 42 mod 77. Douglas Adams, eat your heart out! (d) Suppose events A, B are independent, and moreover events B,C are independent. Are we guaranteed that events A,C are independent? Why or why not? No. Counterexample: Suppose we pick a card from a randomly shuffled deck. Let A = the card is a spade, B = the card is a queen, C = the card is a red card (a heart or diamond). Then A,B are independent. Also, B,C are independent. Yet, A,C are not independent, since Pr[A C] = 0 Pr[A]. CS 70, Fall 2003, MT2 Soln 4

Problem 3. [An Insecure RSA Variant] (20 points) After briefly toying with the idea of outlawing magic markers and the SHIFT key, Hapless Copy Protection, Inc. has decided that they are instead going to pursue a technical solution to the problem of MP3 sharing: they re going invent a new encryption algorithm. For maximum speed, their Cryptographer-In-Chief proposes a variant on RSA, where the modulus n is chosen to be a product of just one prime (i.e., n = p). In other words, Bob s public key is (n,e), where n is prime and e is an encryption exponent satisfying 1 < e < n. Bob s private key is d, the decryption exponent, satisfying 1 < d < n. To encrypt a message m, Alice computes c = m e mod n. To decrypt, Bob computes c d mod n. (a) To make this work, this variant needs a key generation procedure. How can Bob choose e and d so that the decryption algorithm will correctly recover the message that Alice encrypted? Pick a random prime n. Choose any e that is relatively prime to n 1 and that is in the range 1 < e < n. Let d e 1 (mod n 1). (Notice that e is guaranteed to have an inverse, with this choice of e.) It s easy to check that c d (m e ) d m ed m ed mod n 1 m 1 1 (mod n), where we applied Fermat s little theorem and used the fact that n is prime. Consequently, decryption is the inverse of encryption, and the scheme works. (b) This scheme is insecure. Explain why. Given only the public key, we can efficiently learn the private key. In particular, given (n,e), any eavesdropper can efficiently compute d e 1 (mod n 1) (use the extended Euclidean algorithm), and this is all an eavesdropper would need to know to decrypt traffic that was encrypted with this scheme. CS 70, Fall 2003, MT2 Soln 5

Problem 4. [Counting] (30 points) Call a ternary string lovely if every 0 is immediately followed by a 1 and every 1 is immediately followed by a 2. For instance, the strings 0120120120, 01212, and 222201 are all lovely, but 0120112 is not lovely. Let a n denote the number of ternary strings of length n that are lovely. (a) Find a recurrence relation that defines the sequence a 0,a 1,a 2,... a n = a n 1 + a n 2 + a n 3. a 0 = 1,a 1 = 3,a 2 = 5,a 3 = 9. Where did this come from? Any lovely string of length n 3 must fall into one of these three cases: It starts with 012, and then is followed by any lovely string of length n 3. (a n 3 ways) It starts with 12, and then is followed by any lovely string of length n 2. (a n 2 ways) It starts with 2, and then is followed by any lovely string of length n 1. (a n 1 ways) These three cases are disjoint and exhaust all the possibilities, so the total number of lovely strings of length n must be the sum of the number of ways to get each of the three cases. Alternatively, you could have drawn a tree diagram. (b) Prove that a n ( 3 3) n holds for all n N. Hint: ( 3 3) 2 + 3 3 + 1 ( 3 3) 3. Proof by strong induction: Base cases: a 0 = 1 ( 3 3) 0, a 1 = 3 ( 3 3) 1 1.44, a 2 = 5 ( 3 3) 2 2.08. Inductive step: Assume that a k ( 3 3) k holds for k = 0,1,...,n 1. Then a n = a n 1 + a n 2 + a n 3 ( 3 3) n 1 + ( 3 3) n 2 + ( 3 3) n 3 [( 3 3) 2 + 3 3 + 1] ( 3 3) n 3 ( 3 3) 3 ( 3 3) n 3 ( 3 3) n. (by the recurrence relation) (by the inductive hypothesis) (since ( 3 3) 2 + 3 3 + 1 ( 3 3) 3 ) The result follows by the axiom of strong induction. Alternate proof: If S is any lovely string of length n 3, then 012 S, 122 S, and 222 S are lovely strings of length n. Hence a n 3a n 3. The desired result then follows by an easy induction, similar to that above but a little simpler. CS 70, Fall 2003, MT2 Soln 6

The chocolate challenge. For any interested, here s an optional bonus problem for you to try. The first to email me a valid solution to this problem will receive a bar of excellent chocolate, not to mention fame and the regard of all your colleagues. We say that f,...,x n ) is a symmetric function if the parameters may be permuted (re-ordered) without changing the value of the function. For instance, a symmetric function on two variables is any function f satisfying f ) = f (x 2 ) for all x 1. For three variables, a symmetric function is one satisfying f ) = f ) = f (x 2 ) = f (x 2 ) = f (x 3 ) = f (x 3 ) for all x 1. And so on. A symmetric polynomial is a polynomial that is a symmetric function. The elementary symmetric functions are defined as follows. e 1,...,x n ) is just the sum of its inputs: The first elementary symmetric function, e 1,...,x n ) = x 1 + x 2 + + x n. Obviously this is a symmetric function. The second elementary symmetric function is e 2,...,x n ) = x 1 x 2 + x 1 x 3 + + x 1 x n + x 2 x 3 + x 2 x 4 +...x n 1 x n = The third elementary symmetric function is e 3,...,x n ) = 1 i< j<k n x i x j x k. 1 i< j n x i x j. And so on. In general, the k-th elementary symmetric function (for 1 k n) is given by e k,...,x n ) = I {1,...,n}, I =k x i. i I With that background, prove the following result: Theorem. Let p be a prime, and let e k,...,x p 1 ) be the k-th elementary symmetric polynomial for some k p 2. Then e k (1,2,..., p 1) 0 (mod p). CS 70, Fall 2003, MT2 Soln 7