CS/MATH 111 Winter 2013 Final Test

Similar documents
Number Theory and Algebra: A Brief Introduction

Math.3336: Discrete Mathematics. Mathematical Induction

Solutions to Practice Final 3

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:

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

Solutions to the Midterm Test (March 5, 2011)

MATH 363: Discrete Mathematics

Midterm 1 for CS 170

Name: Mathematics 1C03

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

AN ALGEBRAIC PROOF OF RSA ENCRYPTION AND DECRYPTION

10 Modular Arithmetic and Cryptography

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).

Homework 1 Submission

HOMEWORK #2 - MATH 3260

ECE596C: Handout #11

Ma/CS 6a Class 3: The RSA Algorithm

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:

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

Solution to Midterm Examination

Cosc 412: Cryptography and complexity Lecture 7 (22/8/2018) Knapsacks and attacks

basics of security/cryptography

The candidates are advised that they must always show their working, otherwise they will not be awarded full marks for their answers.

Solutions to the Mathematics Masters Examination

Practice Final Solutions. 1. Consider the following algorithm. Assume that n 1. line code 1 alg(n) { 2 j = 0 3 if (n = 0) { 4 return j

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

Lecture 1: Introduction to Public key cryptography

Introduction to Public-Key Cryptosystems:

Solutions to Practice Final

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

Mathematics Masters Examination

CSCE 750 Final Exam Answer Key Wednesday December 7, 2005

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

The RSA cryptosystem and primality tests

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

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

Chapter 8 Public-key Cryptography and Digital Signatures

Prob. 1 Prob. 2 Prob. 3 Total

Cryptosystem. Traditional Cryptosystems: The two parties agree on a secret (one to one) function f. To send a message M, thesendersendsthemessage

Quiz 1 Solutions. Problem 2. Asymptotics & Recurrences [20 points] (3 parts)

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

Cryptography. pieces from work by Gordon Royle

Math/Mthe 418/818. Review Questions

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

MATH 158 FINAL EXAM 20 DECEMBER 2016

MATH 145 Algebra, Solutions to Assignment 4

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

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

CPE 776:DATA SECURITY & CRYPTOGRAPHY. Some Number Theory and Classical Crypto Systems

A.P. Calculus BC Test Three Section Two Free-Response No Calculators Time 45 minutes Number of Questions 3

Number Theory and Group Theoryfor Public-Key Cryptography

CS 5319 Advanced Discrete Structure. Lecture 9: Introduction to Number Theory II

5199/IOC5063 Theory of Cryptology, 2014 Fall

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

Discrete Mathematics for CS Fall 2003 Wagner MT2 Soln

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

Mathematical Foundations of Public-Key Cryptography

Partial Key Exposure: Generalized Framework to Attack RSA

COMP4109 : Applied Cryptography

Cryptography and RSA. Group (1854, Cayley) Upcoming Interview? Outline. Commutative or Abelian Groups

Math 412: Number Theory Lecture 13 Applications of

RSA RSA public key cryptosystem

Part IA Numbers and Sets

} has dimension = k rank A > 0 over F. For any vector b!

Math 223, Spring 2009 Final Exam Solutions

Lecture Notes, Week 6

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

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

MIT 6.042J: Mathematics For Computer Science

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

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

Book announcements. Sukumar Das Adhikari ASPECTS OF COMBINATORICS AND COMBINATORIAL NUMBER THEORY CRC Press, Florida, 2002, 156pp.

Introduction to Modern Cryptography. Lecture RSA Public Key CryptoSystem 2. One way Trapdoor Functions

Prob. 1 Prob. 2 Prob. 3 Total

CPSC 467b: Cryptography and Computer Security

Number Theory & Modern Cryptography

Ma/CS 6a Class 4: Primality Testing

Theory of RSA. Hiroshi Toyoizumi 1. December 8,

RSA Cryptosystem and Factorization

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.

Fall 2014 CMSC250/250H Midterm II

CPSC 467b: Cryptography and Computer Security

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

*Final Exam* EECS 203 Spring 2016

during transmission safeguard information Cryptography: used to CRYPTOGRAPHY BACKGROUND OF THE MATHEMATICAL

Cryptography: Joining the RSA Cryptosystem

Algebraic Structures Exam File Fall 2013 Exam #1

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

Ma/CS 6a Class 4: Primality Testing

Johns Hopkins Math Tournament 2018 Proof Round: Sequences

Mathematics of Cryptography

Encryption: The RSA Public Key Cipher

2 More on Congruences

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

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

Introduction to Cybersecurity Cryptography (Part 5)

CS/COE

CSE 521: Design and Analysis of Algorithms I

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

Congruence Classes. Number Theory Essentials. Modular Arithmetic Systems

Transcription:

CS/MATH 111 Winter 2013 Final Test The test is 2 hours and 30 minutes long, starting at 7PM and ending at 9:30PM There are 8 problems on the test. Each problem is worth 10 points. Write legibly. What can t be read won t be credited. Before you start: Make sure that your final has all 8 problems Put your name and SID on the front page below and on top of each page Name SID problem 1 2 3 4 5 6 7 8 total score

Problem 1: (a) For each pseudo-code below, give the exact formula for the number of words printed if the input is n (where n 1), and then give its asymptotic value (using the Θ-notation.) Pseudo-code Formula Asympt. value procedure Ahem(n) for j 1 to n + 1 for i 1 to j do print( ahem ) T (n) = n+1 =1 j = (n + 1)(n + 2)/2 Θ(n2 ) procedure Geez(n) if n = 1 then print( geez geez ) else for i 1 to 3 do Geez(n 1) T (1) = 2 and T (n) = 3T (n 1). So T (n) = 2 3 n. Θ(3 n ) (b) For each pseudo-code below, give a recurrence for the asymptotic value for the number of words printed if the input is n (where n 1) and then its solution (using the Θ-notation.) Pseudo-code Recurrence Solution procedure Oops(n) if n > 2 then print( oops ) Oops(n/3) Oops(n/3) T (n) = 2T (n/3) + 1 Θ(n log 3 2 ) procedure Eeek(n) if n > 2 then for j 1 to n do print( eeek ) for k 1 to 4 do Eeek(n/2) procedure Whew(n) if n > 1 then for j 1 to n 2 do print( whew ) for k 1 to 5 do Whew(n/2) T (n) = 4T (n/2) + n Θ(n 2 ) T (n) = 5T (n/2) + n 2 Θ(n log 5 )

Problem 2: (a) Explain how the RSA cryptosystem works. Initialization: Choose two different primes p and q, and let n = pq. Let φ(n) = (p 1)(q 1). Choose an integer e relatively prime to φ(n). Let d = e 1 (mod φ(n)). Public key is P = (n, e). Secret key is S = d. Encryption: If M is the message then its encryption is E(M) = M e rem n Decryption: If C is the ciphertext then its decrypted as D(C) = C d rem n (b) Below you are given five choices of parameters p, q, e, d of RSA. For each choice tell whether these parameters are correct 1 (write YES/NO). If not, give a brief justification (at most 10 words). p q e d correct? justify if not correct 23 51 18 89 NO 51 is not prime 23 11 33 103 NO 33 is not relatively prime to φ(n) = 220 3 7 5 5 YES 17 17 3 171 NO p and q should be different 11 7 13 37 YES 1 For correctness it is only required that the decryption function is the inverse of the encryption function.

Problem 3: (a) Give a complete statement of the principle of inclusion-exclusion. Let S 1,..., S k be finite sets. Then the cardinality of their union is k k S j = ( 1) j+1 j=1 j=1 l 1 <l 2 <...<l j j S li i=1 (b) We have three sets A, B, C that satisfy A = B = 14 and C = 19, A B = A C = 3 14 A B C and B C = 8, A B C = 1. Determine the cardinality of A B C. Let x = A B C. Then, using the inclusion-exclusion formula, we get so x = 28. x = 14 + 14 + 19 3 14 x 3 14 x 8 + 1

Problem 4: (a) Give a complete statement of Fermat s Little Theorem. If p is a prime number and a {1, 2,..., p 1} then a p 1 = 1 (mod p). (b) Use Fermat s Little Theorem to compute the following values: 78 112 (mod 113) = 1 3 39635 (mod 31) = Computing modulo 31, we get 3 39635 = 3 39630 3 5 = 3 5 = 243 = 26

Problem 5: (a) Give a complete definition of a perfect matching in a bipartite graph. A set M of edges is called a matching if any two edges in M have different endpoints. A matching M is called perfect if it covers every vertex, that is every vertex is an endpoint of an edge in M. (b) State Hall s Theorem. A bipartite graph G = (U, V, E) with U = V has a perfect matching if and only if for any set X U we have N(X) X, where N(X) denotes the set of all neighbors of vertices in X. (c) Determine whether the graph below is bipartite and if it is, whether it has a perfect matching. You must give a complete justification for your answer. l i h e g b a d j f k c Bipartite partition: U = {a, c, h, j, g, l}, V = {b, d, f, e, i, k}. This graph does not have a perfect matching. To see why, let X = {a, c, j, h}. Then N(X) = {b, d, f}. So N(X) < X, violating Hall s Theorem.

Problem 6: (a) Prove or disprove the following statement: If a graph G has an Euler tour then G also has a Hamiltonian cycle. This is false. One example is a bow-tie graph. This graph has an Euler tour (because all degrees are even) but it does not have a Hamiltonian cycle, because any cycle that visits all vertices must traverse the middle vertex twice. (b) Prove or disprove the following statement: If a bipartite graph G has a Hamiltonian cycle then G has a perfect matching. This is true. For the proof, suppose that G has a Hamiltonian cycle H = v 1 v 2...v n v 1. Let M consist of edges (v 1, v 2 ), (v 3, v 4 ), (v 5, v 6 ),..., (v n 1, v n ), that is every second edge from H. Then every vertex is covered by M and no two edges in M share an endpoint, so M is a perfect matching.

Problem 7: Using mathematical induction prove that n 5 i = 1 4 (5n+1 1). (Only proofs by induction will be accepted.) We first check the base case. For n = 0, the left-hand side is 0 5i = 5 0 = 1 and the right-hand side is 1 4 (50+1 1) = 1, so the equality holds. Now let k > 0 and assume that the equation holds for n = k, that is k 5 i = 1 4 (5k+1 1). We claim that it also holds for n = k + 1, that is We derive this equation as follows: k+1 5 i = 1 4 (5k+2 1). k+1 5 i = k 5 i + 5 k+1 = 1 4 (5k+1 1) + 5 k+1 = 1 4 5k+1 1 4 + 5k+1 = ( 1 4 + 1) 5k+1 1 4 = 5 4 5k+1 1 4 = 1 4 5k+2 1 4 = 1 4 (5k+2 1), where in the second step we used the inductive assumption, and the remaining steps are just algebra.

Problem 8: We want to tile a 2 n strip with 1 1 tiles and L-shaped tiles of width and height 2. Here are two examples of such a tiling of a 2 9 strip: Let A(n) be the number of such tilings. (a) Give a recurrence relation for A(n) and justify it. (b) Solve the recurrence to compute A(n). Here are possible endings: This gives us recurrence A(n) = A(n 1) + 4A(n 2) + 2A(n 3) with A(0) = 1, A(1) = 1, and A(2) = 5. The characteristic equation is x 3 x 2 4x 2 = 0 and its roots are 1, 1 3, and 1 + 3. So the general form of the solution is The initial conditions give us A(n) = α 1 ( 1) n + α 2 (1 3) n + α 3 (1 + 3) n. α 1 + α 2 + α 3 = 1 α 1 ( 1) + α 2 (1 3) + α 3 (1 + 3) = 1 α 1 + α 2 (4 2 3) + α 3 (4 + 2 3) = 5 Solving, we get α 1 = 1, α 2 = 1/ 3 and α 3 = 1/ 3. So A(n) = ( 1) n 1 3 (1 3) n + 1 3 (1 + 3) n.