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

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

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

Name: Mathematics 1C03

Number theory (Chapter 4)

Mathematics of Cryptography

CS483 Design and Analysis of Algorithms

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

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

University of Illinois at Chicago Department of Computer Science. Final Examination. CS 151 Mathematical Foundations of Computer Science Fall 2012

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

Prob. 1 Prob. 2 Prob. 3 Total

University of New Mexico Department of Computer Science. Midterm Examination. CS 361 Data Structures and Algorithms Spring, 2003

Try the assignment f(1) = 2; f(2) = 1; f(3) = 4; f(4) = 3;.

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

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

Simple Math: Cryptography

Math 223, Spring 2009 Final Exam Solutions

Solutions to the Midterm Test (March 5, 2011)

Ma/CS 6a Class 2: Congruences

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

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:

Solutions to the Mathematics Masters Examination

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

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

basics of security/cryptography

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

Homework 1 Submission

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

Ma/CS 6a Class 2: Congruences

Lecture 6: Introducing Complexity

Discrete Mathematics for CS Fall 2003 Wagner MT2 Soln

CS2800 Questions selected for fall 2017

Discrete Mathematics and Probability Theory Summer 2014 James Cook Midterm 1

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:

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

Final Exam Review. 2. Let A = {, { }}. What is the cardinality of A? Is

Math.3336: Discrete Mathematics. Mathematical Induction

Exam 2 Solutions. In class questions

Math 109 HW 9 Solutions

Encryption: The RSA Public Key Cipher

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

University of New Mexico Department of Computer Science. Final Examination. CS 561 Data Structures and Algorithms Fall, 2006

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

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

Johns Hopkins University, Department of Mathematics Abstract Algebra - Spring 2013 Midterm Exam Solution

ECS 189A Final Cryptography Spring 2011

1/16 2/17 3/17 4/7 5/10 6/14 7/19 % Please do not write in the spaces above.

ECE596C: Handout #11

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

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

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

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

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

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

Question: Total Points: Score:

Discrete Mathematics and Probability Theory Summer 2014 James Cook Note 5

Cryptography. P. Danziger. Transmit...Bob...

MATHEMATICAL INDUCTION

Math 1: Calculus with Algebra Midterm 2 Thursday, October 29. Circle your section number: 1 Freund 2 DeFord

MEETING 6 - MODULAR ARITHMETIC AND INTRODUCTORY CRYPTOGRAPHY

Basic elements of number theory

Basic elements of number theory

Math 13, Spring 2013, Lecture B: Midterm

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

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

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

Fall 2017 September 20, Written Homework 02

19. Coding for Secrecy

The RSA cryptosystem and primality tests

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

Cool Results on Primes

Contribution of Problems

A Readable Introduction to Real Mathematics

Prob. 1 Prob. 2 Prob. 3 Total

CS1800 Discrete Structures Final Version A

download instant at

Clock Arithmetic and Euclid s Algorithm

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

Review Sheet for the Final Exam of MATH Fall 2009

Senior Math Circles Cryptography and Number Theory Week 2

Solution to Midterm Examination

Math Notes of 8/25/17. Announcements

CRYPTOGRAPHY AND NUMBER THEORY

Math 4400 First Midterm Examination September 21, 2012 ANSWER KEY. Please indicate your reasoning and show all work on this exam paper.

Math Circle Beginners Group February 28, 2016 Euclid and Prime Numbers Solutions

2.2 Inverses and GCDs

Quiz 1, Mon CS 2050, Intro Discrete Math for Computer Science

Mathematical Foundations of Public-Key Cryptography

This is a recursive algorithm. The procedure is guaranteed to terminate, since the second argument decreases each time.

Cryptography. pieces from work by Gordon Royle

Introduction. What is RSA. A Guide To RSA by Robert Yates. Topics

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

NUMBER THEORY AND CODES. Álvaro Pelayo WUSTL

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

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

Math Circle Beginners Group February 28, 2016 Euclid and Prime Numbers

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

Ma/CS 6a Class 3: The RSA Algorithm

SOLUTIONS Math 345 Homework 6 10/11/2017. Exercise 23. (a) Solve the following congruences: (i) x (mod 12) Answer. We have

A Few Facts from Number Theory and the RSA Cryptosystem OVERVIEW. RSA Producing Big Primes. Table of Contents. Overview Basic Facts of Number Theory

Transcription:

University of New Mexico Department of Computer Science Midterm Examination CS 261 Mathematical Foundations of Computer Science Spring, 2010 Name: Email: Nothing is true. All is permitted - Friedrich Nietzsche. Well, not exactly. You are not permitted to discuss this exam with any other person. If you do so, you will surely be smitten (collusion on any problem will result in a 0 on the test). You may consult any other sources including books, papers, web pages, computational devices, animal entrails, seraphim, cherubim, etc. in your quest for truth and solutions. Please acknowledge your sources. Show your work! You will not get full credit if we cannot figure out how you arrived at your answer. A numerical solution obtained via a computer program is unlikely to get much credit without a correct mathematical derivation. Write your solution in the space provided for the corresponding problem. Do NOT use any extra paper for your final solutions. If any question is unclear, ask for clarification. Question Points Score Grader 1 20 2 20 3 20 4 20 5 20 Total 100

1. Logic and Proofs (a) (4 points) Show that (a b) (a c) is logically equivalent to a (b c). Justify each step. Solution: (a b) (a c) = ( a b) ( a c) (1) = (( a b) a) (( a b) c) (2) = a (( a b) c) (3) = a ( a c) (b c) (4) = a (b c) (5) = a (b c) (6) Where step 1 follows from Example 3 in the book. Step 2 follows from the second distributive law. Step 3 follows from the second absorption law. Step 4 follows by the second distributive law. Step 5 follows by associativity and absorbtion. Step 6 follows by Example 3. (b) (6 points) Prove that if 3x + 2 is odd, then x is odd. Solution: We will show the contrapositive: if x is even then 3x+2 is even. If x is even, it equals 2k for some integer k. Thus 3x + 2 = 6k + 2 = 2(3k + 1) which is clearly an even number.

(c) (10 points) Prove or disprove that you can tile a 7 by 7 checkerboard with dominos if the top left, top right and bottom right squares are missing. Solution: This can t be done. We can show this with a coloring argument as follows. Color every odd square in the i-th row black, where i is an odd number, and all remaining squares red. In particular, the odd numbered squares in the first and last row will be black so the top left, top right, bottom left and bottom right squares are all black. There are thus 22 black squares and 24 red squares. However, each domino must cover both a red and a black square so the fact that there is not an equal number of each color implies that it is not possible to cover this checkerboard with dominos

2. Sets, Number Theory and Proofs (a) (6 points) Find a solution to the equation 5x 11 (mod 21) using techniques from this class. Show your work! Solution: Using Euclid s algorithm, we can find that the inverse of 5 mod 21 is 4. Multiplying both sides of the equation by 4, we get that x 44 (mod 21) or equivalently, x 19 (mod 21) (b) (7 points) Prove that 11 n + 1 is O(n) Solution: We must find constants n 0 and c such that for all n n 0, 11 n cn. In the previous inequality, divide both sides by n to get 11 c n. This inequality is satisfied for n 1 and c = 11. Thus we need n 0 = 1 and c = 11.

(c) (7 points) Simplify the following set as much as possible: B (Ā B) Ā. Solution: (Ā B) Ā is equivalent to (A B) A (by DeMorgan s Law), which is equivalent to the set A since A X A for any X. Thus, the entire set is equivalent to B A.

3. Doorbells and Litigants In a certain neighborhood, the houses are numbered 1 through n. One night, a mischievous mathematician circles through the neighborhood as follows. For every number i from 2 to n, the mathematician circles through the neighborhood ringing the doorbell of every house that is a multiple of i (i.e. she first circles through ringing the bells of all homes divisible by 2, then circles again to ring the bells of all homes divisible by 3, etc., etc.) The neighborhood association playfully retaliates by launching a class-action lawsuit against the mathematician. In this problem, you will use your knowledge about number theory to help them collect vital information for this lawsuit. (a) (4 points) How many homes had their doorbell rung exactly once? Your answer should be as a function of n and given using (tight) big-o notation (i.e. assume n is very large). Solution: The homes x such that x is prime had their bells rung exactly once. Thus, by the prime number theorem, the answer is O(n/ ln n) (b) (6 points) For those homes that had their doorbell rung more than once, when were they first woken up? I.e. on what circling of the neighborhood was their doorbell first rung by the mathematician? Again express your answer with big-o notation as a function of n. Solution: If the doorbell was rung more than once for a home x, then x is composite. Thus as we showed in class, at least one divisor of x must be no more than x. Since x n, the answer is O( n). (c) (10 points) What is the total number of times that the mathematician rang a doorbell? Again use big-o notation. Hint: You may find a result you showed in hw4 useful. Solution: The total number of times that a doorbell was rung is no more than ni=2 n/i = n n i=2 1/i which is O(n lg n) via an integral upperbound as done in hw4 problem 3

4. Number Tricks (a) (8 points) Consider the following magic trick. Think of any number n, now compute n 4, divide n 4 by 5 and let r be the remainder. Using my magical powers I can guess that the number r is either 0 or 1. Explain why this trick works by proving that r will always be either 0 or 1. Hint: You will find a theorem discussed in class useful. Solution: If 5 divides n then n = 5k for some integer k and n 4 = 5 4 k 4. Thus, 5 divides n 4. If 5 does not divide n, then Fermat s Little Theorem tells us that n 4 mod 5 is 1. Thus, the remainder when we divide n 4 by 5 is either 0 or 1.

(b) (12 points) Consider the following magic trick. You think of any number. You tell me what the remainder is when you divide your number by 4. You tell me the remainder when you divide your number by 25. Using my magical powers, I then tell you the last two digits of your number. Describe the algorithm I use to perform this trick and why it works. Hint: You will find (another) important theorem discussed in class useful. Solution: 25 and 4 are relatively prime (you can verify this by computing gcd(25, 4) or just realizing that the factoring of 25 = 5 2, 4 = 2 2 and so they share no common factors. Thus we can use the Chinese Remainder Theorem to determine n mod (25 4) whenever we know both n mod 25 and n mod 4. Finally, note that n mod 100 is just the last two digits of n. Note this trick would not work if we used the numbers 50 and 2 for example since they are not relatively prime! Now here is the algorithm for this trick. Let r 1 = n mod 25 and r 2 = n mod 4. Then m 1 = 25, m 2 = 4, M 1 = 4, M 2 = 25, y 1 = 4 1 mod 25 = 19 and y 2 = 25 1 mod 4 = 1. Thus the magician calculates: x = r 1 4 19 + r 2 25 1 mod 100 which is (76r 1 + 25r 2 ) mod 100. Try this out for several values of r 1 and r 2 and marvel at the mathematical magic!

5. Public Key Cryptography Imagine Bob wants to send a message to Sue such that 1) only Sue can read the message; and 2) Sue can verify that Bob is the person who sent the message. In this problem, you will show how to do this with RSA cryptography, even when all communication is by broadcast. To solve this problem, you will need two pairs of public and private keys. For consistency of notation, please let p 1, q 1, d 1 be the first set of private keys and n 1, e 1 be the first set of public keys (where the public and private keys are constructed as discussed in class). Similarly, let p 2, q 2, d 2 be the second set of private keys and n 2, e 2 be the second set of public keys. Also let f 1 (x) = x e 1 mod n 1 and g 1 (x) = x d 1 mod n 1. And similarly, let f 2 (x) = x e 2 mod n 2 and g 2 (x) = x d 2 mod n 2. Finally let m be the message that Bob wants to send to Sue. This problem can be done in two rounds. In the first round, the following happens: Bob generates p 1, q 1, d 1, n 1, e 1 and broadcasts n 1, e 1. Sue generates p 2, q 2, d 2, n 2, e 2 and broadcasts n 2, e 2. You will now determine what happens in the second round, using the above notation. Note: You must use the above notation to receive credit for this problem. (a) (7 points) What does Bob broadcast? Solution: Let s = g 1 (m) (s is the signature for m). Then Bob broadcasts m = f 2 ( ms ) (b) (7 points) What does Sue compute in order to decrypt and verify Bob s message? Solution: Sue computes g 2 (m )) in order to retrieve the message m s. She then computes f 1 (s) and verifies that it equals m. (c) (6 points) Describe briefly (2-3 sentences) why this scheme allows Sue to decrypt the message and verify that it came from Bob. Solution: As shown in class, g 2 is the inverse of f 2 so g 2 (f 2 (x)) = x. This shows that Sue can decrypt Bob s message to get m s. Similarly, f 1 is the inverse of g 1 so f 1 (s) will equal m.