Solutions to the Mathematics Masters Examination

Similar documents
Mathematics Masters Examination

Lecture 1: Introduction to Public key cryptography

basics of security/cryptography

Solution to Midterm Examination

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

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

Discrete Mathematics GCD, LCM, RSA Algorithm

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

CPSC 467: Cryptography and Computer Security

Solutions to the Midterm Test (March 5, 2011)

Practice Assignment 2 Discussion 24/02/ /02/2018

Public Key Cryptography

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

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

Math.3336: Discrete Mathematics. Mathematical Induction

CPSC 467b: Cryptography and Computer Security

Lecture 11: Key Agreement

Theory of Computation Chapter 12: Cryptography

Cryptography: Joining the RSA Cryptosystem

Introduction to Modern Cryptography. Benny Chor

Is It As Easy To Discover As To Verify?

9 Knapsack Cryptography

8 Elliptic Curve Cryptography

YALE UNIVERSITY DEPARTMENT OF COMPUTER SCIENCE

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

University of Tokyo: Advanced Algorithms Summer Lecture 6 27 May. Let s keep in mind definitions from the previous lecture:

CPSC 467b: Cryptography and Computer Security

Elliptic Curve Cryptography

MATH 158 FINAL EXAM 20 DECEMBER 2016

CPSC 467b: Cryptography and Computer Security

Ma/CS 6a Class 4: Primality Testing

Theme : Cryptography. Instructor : Prof. C Pandu Rangan. Speaker : Arun Moorthy CS

Public Key Cryptography. All secret key algorithms & hash algorithms do the same thing but public key algorithms look very different from each other.

MATH3302 Cryptography Problem Set 2

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

CPSC 467b: Cryptography and Computer Security

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

Ma/CS 6a Class 3: The RSA Algorithm

Number theory (Chapter 4)

Lecture Notes, Week 6

Ma/CS 6a Class 1. Course Details

Cryptography CS 555. Topic 18: RSA Implementation and Security. CS555 Topic 18 1

Question: Total Points: Score:

Lecture 19: Public-key Cryptography (Diffie-Hellman Key Exchange & ElGamal Encryption) Public-key Cryptography

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

Lecture 22: RSA Encryption. RSA Encryption

CS 355: Topics in Cryptography Spring Problem Set 5.

RSA Key Generation. Required Reading. W. Stallings, "Cryptography and Network-Security, Chapter 8.3 Testing for Primality

Lecture 15 - Zero Knowledge Proofs

Asymmetric Encryption

LECTURE 5: APPLICATIONS TO CRYPTOGRAPHY AND COMPUTATIONS

SIGNATURE SCHEMES & CRYPTOGRAPHIC HASH FUNCTIONS. CIS 400/628 Spring 2005 Introduction to Cryptography

YALE UNIVERSITY DEPARTMENT OF COMPUTER SCIENCE

You submitted this homework on Wed 31 Jul :50 PM PDT (UTC -0700). You got a score of out of You can attempt again in 10 minutes.

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

Introduction to Modern Cryptography Lecture 11

THE CUBIC PUBLIC-KEY TRANSFORMATION*

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

Final Exam Math 105: Topics in Mathematics Cryptology, the Science of Secret Writing Rhodes College Tuesday, 30 April :30 11:00 a.m.

CPSC 467b: Cryptography and Computer Security

COMS W4995 Introduction to Cryptography October 12, Lecture 12: RSA, and a summary of One Way Function Candidates.

Number Theory. Modular Arithmetic

Public-Key Cryptosystems CHAPTER 4

Univ.-Prof. Dr. rer. nat. Rudolf Mathar. Written Examination. Cryptography. Tuesday, August 29, 2017, 01:30 p.m.

CS483 Design and Analysis of Algorithms

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

RSA-256bit 數位電路實驗 TA: 吳柏辰. Author: Trumen

Cryptography. pieces from work by Gordon Royle

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:

TECHNISCHE UNIVERSITEIT EINDHOVEN Faculty of Mathematics and Computer Science Exam Cryptology, Friday 25 January 2019

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

Exam Security January 19, :30 11:30

Ma/CS 6a Class 4: Primality Testing

10 Modular Arithmetic and Cryptography

CS1800 Discrete Structures Final Version A

DM49-2. Obligatoriske Opgave

Security Issues in Cloud Computing Modern Cryptography II Asymmetric Cryptography

1 Number Theory Basics

CODING AND CRYPTOLOGY III CRYPTOLOGY EXERCISES. The questions with a * are extension questions, and will not be included in the assignment.

Public-Key Encryption: ElGamal, RSA, Rabin

CS 282A/MATH 209A: Foundations of Cryptography Prof. Rafail Ostrovsky. Lecture 10

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

Introduction to Modern Cryptography. Benny Chor

You separate binary numbers into columns in a similar fashion. 2 5 = 32

CHALMERS GÖTEBORGS UNIVERSITET. TDA352 (Chalmers) - DIT250 (GU) 11 April 2017, 8:30-12:30

Basic elements of number theory

Basic elements of number theory

Introduction to Cryptography. Lecture 8

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

Topics in Cryptography. Lecture 5: Basic Number Theory

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

CIS 551 / TCOM 401 Computer and Network Security

2. Cryptography 2.5. ElGamal cryptosystems and Discrete logarithms

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

10 Public Key Cryptography : RSA

RSA RSA public key cryptosystem

Biomedical Security. Some Security News 9/17/2018. Erwin M. Bakker. Blockchains are not safe for voting (slashdot.org) : From: paragonie.

Lecture 10: Zero-Knowledge Proofs

CSCI3390-Lecture 16: Probabilistic Algorithms: Number Theory and Cryptography

Lecture Notes 20: Zero-Knowledge Proofs

Transcription:

Solutions to the Mathematics Masters Examination OPTION 4 Spring 2007 COMPUTER SCIENCE 2 5 PM NOTE: Any student whose answers require clarification may be required to submit to an oral examination. Each of the twelve numbered questions is worth 20 points. All questions will be graded, but your score for the examination will be the sum of your scores on your eight best questions. Please observe the following: DO NOT answer two or more questions on the same sheet (not even on both sides of the same sheet). DO NOT write your name on any of your answer sheets. You will be given separate instructions on the use of these answer sheets. When you have completed a question, place it in the large envelope provided. Spring 07 CS 1/11

1. Computer Algorithms Let A = (81, 82, 63, 24, 65, 86, 17, 8, 99, 60, 91) be an array. Illustrate a linear time algorithm to build a max-heap. Show all your steps. Explain the heap sort algorithm. A = (99, 91, 86, 82, 81, 63, 17, 8, 24, 66, 65). Swap the first and last element of the array and use the build heap procedure with array length one less. Continue till array length is one. The original array now stores the numbers in nondecreasing order. Spring 07 CS 2/11

2. The nuts and bolts problem is defined as follows. You are given a collection of n bolts, A = {a 1, a 2,..., a n }, of different widths, and n corresponding nuts, B = {b 1, b 2,... b n }. You can test a given nut and bolt together, from which you learn whether the nut is too large, too small, or an exact match for the bolt. You are not allowed to compare two nuts or two bolts. You can only compare a nut and a bolt. You are to match each bolt to each nut. 1. Give an O(n 2 ) algorithm to solve the nuts and bolts problem. 2. Suppose that instead of matching all of the nuts and bolts, you wish to find the smallest bolt and its corresponding nut. Show that this can be done in only 2n 2 comparisons. Give the algorithm and prove that it makes at most 2n 2 comparisons. (i) Let the Nuts be denoted by the set A = {a 1, a 2,..., a n } and the bolts be denoted by the set B = {b 1, b 2,... b n }. Algorithm: for i = 1 to n do for j = 1 to n do if a i matches b j then pair (a i, b j ) return all the pairs (ii) Algorithm: i = 1, j = 1 while (i n) AND (j n) AND i + j 2n 1 do if a i < b j then j j + 1 if a i > b j then i i + 1 if a i = b j then if i j then (a,b) (a i, b j ), i i + 1 else (a,b) (a i, b j ), j j + 1 if i > n or j > n return (a, b) else return (a n, b n ) (iii) Let (a, b) denote there are a possible choices from set A and there are b possible choices among B. Initially a = b = n. After each comparison we can reject at most one of the possible candidates. So after a comparison (a, b) can go to (a, b), (a 1, b) or (a, b 1). We stop when we reach (1, 1). Thus, in the worst case we need at least 2n 2 comparisons Spring 07 CS 3/11

3. Combinatorics Find the general solution of the recurrence h n = 4h n 1 3h n 2 + 3 n, n 0. The characteristic equation of the homogeneous recurrence is x 2 4x+3 = 0 with roots 1, 3, so the general solution of the homogeneous recurrence is c 1 +c 2 3 n. For a particular solution of the nonhomogeneous recurrence try h n = p3 n, but this gives 3p = 4p p + 3, which is impossible. Instead, try h n = np 3 n. This satisfies the recurrence when p = 3/2. h n = c 1 + c 2 3 n + 1 2 n 3n+1. 4. The 9 squares of a 3 3 board are colored red, white and blue. Two colorings are equivalent when one can be obtained from the other by rotating the board (no flips). Find the number of non-equivalent colorings with 4 red, 3 white and 2 blue squares. The cycle index is 1 4 (z9 1 + 2z 1z 2 4 + z 1z 4 2 ). The answer is the coefficient of r4 w 3 b 2 in P G (r + b + w, r 2 + b 2 + w 2,...) = 1 ( (r + b + w) 9 + 2(r + b + w)(r 4 + b 4 + w 4 ) + (r + b + w)(r 2 + b 2 + w 2 ) 4). 4 4 times this coefficient equals ( ) 9 + 0 + coefficient of r 4 w 2 b 2 in (r 2 + b 2 + w 2 ) 4. 4, 3, 2 This last coefficient is ( ) ( 4 2,1,1. The answer is 1 ( 9 ) ( 4 4,3,2 + 4 2,1,1) ) = 318. Spring 07 CS 4/11

Graph Theory 5. 1. Construct a simple graph with 2n vertices and n 2 edges which has exponentially many perfect matchings. 2. Construct a simple graph with 2n vertices and n 2 edges which has a unique perfect matching. (1) Consider the bipartite graph G(V, E) with (i)v (G) = A B, where A = {a 1, a 2,..., a n } and B = {b 1, b 2,..., b n }, and (ii)) E(G) = {{a i, b j } : i, j {1, 2,..., n}}. Observe that E(G) = n 2. Let number of perfect matchings be equal to f(n). f(n) satisfies the recurrence relation f(n) = nf(n 1) with f(1) = 1. This implies f(n) = n!. (2) Consider the graph G(V, E) with (i)v (G) = A B, where A = {a 1, a 2,..., a n } and B = {b 1, b 2,..., b n, and (ii) E(G) = E 1 E 2 where E 1 = {{a i, b j } : i, j {1, 2,..., n} and i j} and E 2 = {{b i, b j } : i, j {1, 2,..., n}}. E = E 1 + E 2 = (1 + 2 + + n) + ( n 2) = n 2. There is only one perfect matching M = {{a i, b i } : i {1, 2,..., n}}. 6. Show that if G is simple and connected but not complete, then G has three vertices u, v and w such that uv, vw E(G) and uw / E(G). Since G is not complete it has two vertices x, y such that {x, y} is not an edge. Let P = x = v 1 e 1 v 2 e 2 e 3... e k v k+1 = y be the shortest path from x to y. Then v 1, v 2 and v 3 have the required property. Spring 07 CS 5/11

7. Error-Correcting Codes and Cryptography Consider the following technique for finding a 1000-bit prime integer for use with a cryptographic algorithm. do { With the help of a cryptographically secure pseudo-random number generator, generate a pseudo-random 1000-bit odd integer p; } while ( the Rabin-Miller test finds p to be composite ); At this point, p is a 1000-bit integer that is prime with near certainty; What is the probability that no more than 500 passes through the do-while loop are required? The probability that a large randomly-chosen integer p is prime is approximately 1/ ln(p). If p is known to be odd, the probability rises to 2/ ln(p). For p a 1000-bit integer, 2 999 p < 2 1000, so ln(p) 1000 ln(2) and 2/ ln(p) 2/(1000 ln(2)) 0.002885. So each pseudo-random odd integer has probability about 0.002885 of being prime. The probability of obtaining no prime in 500 trials is about (1 0.002885) 500, or 0.236. The probability of obtaining a prime within 500 trials is about 1 0.236, or about 0.764 (76.4%). Spring 07 CS 6/11

8. Alice wants to receive messages encrypted with the RSA. She chooses two large primes p A and q A, computes n A = p A q A and ϕ(n A ), chooses an encryption exponent e A, and then computes a decryption exponent d A. a) What formula does Alice use in computing ϕ(n A )? What condition must e A satisfy? How is d A related to e A? b) Of the six quantities p A, q A, n A, ϕ(n A ), e A, and d A, which become part of Alice s public key? Which become part of her private key? Which are no longer needed and may she discard (securely)? c) Eve suggested to Alice that she choose p A and q A as follows: Using a cryptographically secure pseudo-random number generator, generate a pseudo-random even integer r of appropriate size. Then choose p A as the largest prime less than r, and q A as the smallest prime greater than r. Would this be a good way for Alice to choose p A and q A? Why or why not? d) What computation does Bob perform to encrypt a short message M that he wishes to send to Alice? e) What computation does Alice perform to decrypt a short encrypted message C that she receives? a) ϕ(n A ) = (p A 1)(q A 1). gcd(ϕ(n A ), e A ) = 1. d A e 1 A (mod ϕ(n A)). b) Alice s public key is (n A, e A ). Her private key is d A. She may discard p A, q A, and ϕ(n A ) once she has computed her public and private keys. c) This would be a terrible way for Alice to choose p A and q A. p A and q A would be very close together, quite likely differing by no more than two thousand. (The average difference between 1000-bit primes is about ln(2 1000 ) 700.) Now n A (p + q)/2 since p and q are close together, so p is quite likely greater than n A 1000. Eve could factor n A by computing the largest odd integer less than n A, call it u, and then checking whether u, u 2, u 4, u 6,... divide n A. Most likely she would find a divisor of n A after checking fewer than 500 possibilities. Once Eve has factored n A, she can compute ϕ(n A ) and d A. Then she can decrypt any encrypted message sent to Alice. d) Bob encrypts M as M e A (mod n A ). e) Alice decrypts C as C d A (mod n A ). Spring 07 CS 7/11

9. Theory of Computation Let Σ = {0, 1}, and L be the language recognized by the NFA 1 1 q1 0 0 q0 q3 0,1 0 1 q2 0 Construct a DFA for the complement of L. 1 0 q 0 0 q 1 q 2 1 0 q 1 q 3 1 0 q 2 q 3 1 q 3 0,1 Spring 07 CS 8/11

10. Let a) Is L regular? b) Is L context-free? L = {a m b n m = n or m = 2n}. a) No. Assume it is regular. For any p, consider the string w = a 2p b p. By the pumping lemma, w = x y z, where x y p, y > 0 and x y i z L for every i 0. Let i = 2. Then x y 2 z has more than 2p a s and p b s, so it is not in L, a contradiction. b) Yes. A CF grammar generating L is S S 1 S 2 S 1 as 1 b ɛ S 2 aas 2 b ɛ Spring 07 CS 9/11

Numerical Analysis 11. 1. Consider the matrix A = 1.225E 1 2.998E 1 6.069E 1 8.066E 1 4.385E 1 7.297E 1 5.426E 1 1.410E 1 2.166E 1 Compute the LU decomposition of A with partial pivoting. Calculate with four decimal places, using rounding: write the answer of every step rounded to four decimal places in scientific format, and use the rounded number in the calculations of the next step. In addition to L and U, also give the permutation matrix P. 2. Explain how you would use the LU decomposition of A to compute A 1. Use pseudo code to describe the algorithm you would use. 1. The LU decomposition consists of L, U, and P : 1.000E+0 0.000E+0 0.000E+0 L = 1.518E 1 1.000E+0 0.000E+0 6.727E 1 6.601E 1 1.000E+0 8.066E 1 4.385E 1 7.297E 1 0 1 0 U = 0.000E+0 2.333E 1 4.961E 1 P = 1 0 0 0.000E+0 0.000E+0 5.313E 2 0 0 1. 2. Let I n be the n-by-n identity matrix. Then A 1 satisfies the matrix equation AX = I n. Denote by x k the kth column of X: X = [x 1 x 2 x n ], and let e k be the kth column of I n : I n = [e 1 e 2 e n ]. Then the columns x k of A 1 are computed in n stages, solving Ax k = e k, k = 1, 2,..., n, using each time the LU decomposition of A to compute x k, as in the pseudo code below: for k from 1 to n do x k := U 1 L 1 e k ; end for; A 1 := [x 1 x 2 x n ]. Spring 07 CS 10/11

12. Discuss the advantages and computational costs of Runge-Kutta methods, compared to using predictor-corrector multistep methods of the same accuracy. A k-stage Runge-Kutta method requires k new function evaluations, whereas a predictorcorrect multistep method takes only one new function evaluation. While a Runga-Kutta method is thus more expensive, the method allows to use variable step sizes which is an advantage over the predictor-corrector multistep methods. Spring 07 CS 11/11