CMSC Discrete Mathematics SOLUTIONS TO SECOND MIDTERM EXAM November, 2005

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

PUTNAM TRAINING NUMBER THEORY. Exercises 1. Show that the sum of two consecutive primes is never twice a prime.

CMSC Discrete Mathematics FINAL EXAM Tuesday, December 5, 2017, 10:30-12:30

CS280, Spring 2004: Prelim Solutions

PROBLEMS ON CONGRUENCES AND DIVISIBILITY

PRIME NUMBERS YANKI LEKILI

CSE 1400 Applied Discrete Mathematics Proofs

PRACTICE PROBLEMS: SET 1

CmSc 250 Intro to Algorithms. Mathematical Review. 1. Basic Algebra. (a + b) 2 = a 2 + 2ab + b 2 (a - b) 2 = a 2-2ab + b 2 a 2 - b 2 = (a + b)(a - b)

MATH 2112/CSCI 2112, Discrete Structures I Winter 2007 Toby Kenney Homework Sheet 5 Hints & Model Solutions

Chapter 5.1: Induction

Ma/CS 6a Class 2: Congruences

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

An integer p is prime if p > 1 and p has exactly two positive divisors, 1 and p.

USA Mathematical Talent Search Round 3 Solutions Year 20 Academic Year

M381 Number Theory 2004 Page 1

Proofs. Methods of Proof Divisibility Floor and Ceiling Contradiction & Contrapositive Euclidean Algorithm. Reading (Epp s textbook)

3 The fundamentals: Algorithms, the integers, and matrices

Fall 2017 Test II review problems

Introduction to Number Theory

Number Theory Marathon. Mario Ynocente Castro, National University of Engineering, Peru

Homework #2 solutions Due: June 15, 2012

Discrete Math, Fourteenth Problem Set (July 18)

Simultaneous Linear, and Non-linear Congruences

Algorithms CMSC Basic algorithms in Number Theory: Euclid s algorithm and multiplicative inverse

7.2 Applications of Euler s and Fermat s Theorem.

3 Solutions of congruences

Number Theory Marathon. Mario Ynocente Castro, National University of Engineering, Peru

NORTHWESTERN UNIVERSITY Thrusday, Oct 6th, 2011 ANSWERS FALL 2011 NU PUTNAM SELECTION TEST

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

CHAPTER 6. Prime Numbers. Definition and Fundamental Results

Input Decidable Language -- Program Halts on all Input Encoding of Input -- Natural Numbers Encoded in Binary or Decimal, Not Unary

a the relation arb is defined if and only if = 2 k, k

not to be republished NCERT REAL NUMBERS CHAPTER 1 (A) Main Concepts and Results

4 Number Theory and Cryptography

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

MATH 4400 SOLUTIONS TO SOME EXERCISES. 1. Chapter 1

MATH 2200 Final Review

Applied Cryptography and Computer Security CSE 664 Spring 2017

Integers and Division

Basic elements of number theory

Basic elements of number theory

Discrete mathematics I - Number theory

Discrete Mathematics Lecture Notes Incomplete Preliminary Version. Instructor: László Babai

1 2 3 style total. Circle the correct answer; no explanation is required. Each problem in this section counts 5 points.

Math 511, Algebraic Systems, Fall 2017 July 20, 2017 Edition. Todd Cochrane

Number Theory Solutions Packet

Elementary Number Theory MARUCO. Summer, 2018

2301 Assignment 1 Due Friday 19th March, 2 pm

d. What are the steps for finding the y intercepts algebraically?(hint: what is equal to 0?)

ECEN 5022 Cryptography

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

Number Theory. CSS322: Security and Cryptography. Sirindhorn International Institute of Technology Thammasat University CSS322. Number Theory.

Algorithms CMSC Homework set #1 due January 14, 2015

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

Chapter 8. P-adic numbers. 8.1 Absolute values

Lecture Notes on DISCRETE MATHEMATICS. Eusebius Doedel

Contribution of Problems

MATH 2200 Final LC Review

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

2 Elementary number theory

The running time of Euclid s algorithm

Numbers and their divisors

Lecture notes: Algorithms for integers, polynomials (Thorsten Theobald)

Algebra Review. Instructor: Laszlo Babai Notes by Vincent Lucarelli and the instructor. June 15, 2001

Logic. Facts (with proofs) CHAPTER 1. Definitions

Math 312/ AMS 351 (Fall 17) Sample Questions for Final

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

Do not open this exam until you are told to begin. You will have 75 minutes for the exam.

= 1 2x. x 2 a ) 0 (mod p n ), (x 2 + 2a + a2. x a ) 2

MAS114: Exercises. October 26, 2018

Homework 3, solutions

Executive Assessment. Executive Assessment Math Review. Section 1.0, Arithmetic, includes the following topics:

Convergence of sequences and series

Homework 7 solutions M328K by Mark Lindberg/Marie-Amelie Lawn

Part II. Number Theory. Year

Secondary Math 3 Honors - Polynomial and Polynomial Functions Test Review

Midterm Preparation Problems

MATH 501 Discrete Mathematics. Lecture 6: Number theory. German University Cairo, Department of Media Engineering and Technology.

First Midterm Examination

MTH 346: The Chinese Remainder Theorem

Recitation 7: Existence Proofs and Mathematical Induction

Math 137 Exam #3 Review Guide

Section 4.1: Polynomial Functions and Models

Solutions to Practice Final

WORKSHEET ON NUMBERS, MATH 215 FALL. We start our study of numbers with the integers: N = {1, 2, 3,...}

NOTES ON SIMPLE NUMBER THEORY

n=1 ( 2 3 )n (a n ) converges by direct comparison to

7. Prime Numbers Part VI of PJE

7.4 DO (uniqueness of minimum-cost spanning tree) Prove: if all edge weights are distinct then the minimum-cost spanning tree is unique.

Notes for Math 290 using Introduction to Mathematical Proofs by Charles E. Roberts, Jr.

Public-key Cryptography: Theory and Practice

1. Consider the conditional E = p q r. Use de Morgan s laws to write simplified versions of the following : The negation of E : 5 points

1 The distributive law

ALGEBRA+NUMBER THEORY +COMBINATORICS

SOUTH AFRICAN TERTIARY MATHEMATICS OLYMPIAD

MATH 361: NUMBER THEORY FOURTH LECTURE

, a 1. , a 2. ,..., a n

Exercises Exercises. 2. Determine whether each of these integers is prime. a) 21. b) 29. c) 71. d) 97. e) 111. f) 143. a) 19. b) 27. c) 93.

Transcription:

CMSC-37110 Discrete Mathematics SOLUTIONS TO SECOND MIDTERM EXAM November, 2005 Instructor: László Babai Ryerson 164 e-mail: laci@cs This exam contributes 20% to your course grade. 1. (6 points) Let a n, b n > 1. Prove that the condition a n b n does NOT imply a n n = Θ(b n n). Before giving your counterexample, state clearly what properties your counterexample needs to have, and prove that it indeed has those properties. We need to give an example of two sequences a n, b n > 1 such that a n b n but all c and all sufficiently large n, either a n n > cb n n or b n n > ca n n. Example: a n = n 1/n ; b n = n 2/n = a 2 n. Now a n 1 because = ln n/n 0; therefore b n /a n = a n 1, so a n b n. On the other hand, b n n/a n n = a n n = n is unbounded, therefore b n n O(a n n) and consequently b n n Θ(a n n). 2. (4+4+6+3+6+4 points) (a) Define the relation a n = Ω(b n ). Do not use the big-oh notation. Give a properly quantified formula, no English words. ( c > 0)( n 0 )( n n 0 )( a n c b n ). (b) True or false? F n+1 = O(F n ) (Fibonacci numbers). Give a simple proof of your answer. TRUE. We claim that F n+1 2F n and therefore F n+1 = O(F n ). Proof of the Claim. For n 0 we have F n 0 (by induction). Therefore, for n 2 we have F n = F n 1 + F n 2 F n 1. Consequently, F n+1 = F n + F n 1 2F n. (c) Prove: if a n = Θ(b n ) and a n then ln(a n ) ln( b n ). We know that ( c > 0, C, n 0 ) such that for all n n 0 we have ca n b n Ca n. (1) Taking logarithms, ln c + ln b n ln C +. (2) Dividing by the positiv quantity a n, ln c + 1 ln b n 1 ln C. (3)

ln c By assumption, 0 and ln C 0. Therefore the fraction ln b n is between two sequences both of which converge to 1. By the squeeze principle (a.k.a. sandwich principle ) the fraction in the middle also approaches 1, i. e., ln(a n ) ln( b n ). (d) True or false: ln x = Θ(log 2 x). Prove your answer. TRUE. ln x = c log 2 x where c = ln 2. (e) True or false: π(x) = Ω(x 0.9 ), where π(x) is the number of primes x. TRUE. Equivalently, x 0.9 = O(π(x)). In fact, the stronger statement x 0.9 = o(π(x)) is true. Reason: x 0.9 π(x) x0.9 x/ ln x = ln x 0. (4) x0.1 (f) Prove: ln(x 5 + 5x 2 100) = Θ(ln(4x 9 5x 2 + 1)). Let f(x) be a polynomial of degree n 1 with positive leading coefficient. Then, for all sufficiently large x, x < f(x) < x n+1 (5) (because x = o(f(x)) and f(x) = o(x n+1 )). Taking logarithms, (1/2) ln x < ln f(x) < (n + 1) ln x (6) hold for all sufficiently large x. Therefore ln(f(x)) = Θ(ln x). It follows that for any two polynomials f 1 (x) and f 2 (x) of degrees 1 with positive leading coefficients, the logarithm of each polynomial is Θ(ln x) and therefore, by the transitivity of the Θ relation, ln(f 1 (x)) and ln(f 2 (x)) are in Θ relation with each other. 3. (6+3B points) For the positive integer x, let n(x) denote the number of decimal digits of x. (a) Prove: n(x) lg(x) where lg refers to base-10 logarithms. (b) BONUS: give a very simple explicit formula for n(x) in terms of the lg function and the rounding (floor or ceiling) functions. (a) The key observation is that 10 n(x) 1 x < 10 n(x). Taking logarithms, it follows that Dividing by n(x) we obtain n(x) 1 lg x < n(x). (7) 1 1 n(x) lg x n(x) 2 < 1. (8)

Since 1/n(x) 0, we obtain, as before by the Squeeze Principle, that lg x/n(x) 1, proving that n(x) lg x. (b) The inequalities (7) are equivalent to saying that n(x) 1 = lg x and therefore n(x) = 1 + lg x. Another correct formula is: n(x) = lg(x + 1). (Why?) 4. (A:3+3, B:5+5B points) Give simple closed-form expressions of the (a) ordinary generating function (b) exponential generating function of the sequences (A) 1, 1, 1, 1,... and (B) 1, 0, 0, 1, 0, 0, 1, 0, 0,.... (bb) is a bonus problem. Observing that 1/(1 z) = i=0 zi, and setting z = qx, we obtain that for the geometric progression 1, q, q 2,..., the (ordinary) generating function is 1/(1 qx). From the Taylor series e z = i=0 zi /i! we obtain, again by setting z = qx, that for the same geometric progression, the exponential generating function is e qx. Setting q = 1 we obtain 1/(1 + x) for (Aa) and e x for (Ab). Setting z = x 3 in our first formula we see that the answer to (Ba) is 1/(1 x 3 ). (Bb) is left as a challenge problem. 5. (6 points) Give a simple closed-form expression for the ordinary generating function of the Fibonacci numbers (F 0 = 0, F 1 = 1, F n = F n 1 + F n 2 ). Show all your work. (done in class) 6. (5 points) Pick a random integer from {1, 2,..., 101}. Let A be the event that x is even; and B the event that 3 x. Are the events A and B positively correlated, negatively correlated, or independent? 101/2 = 50; 101/3 = 33; 101/6 = 16; therefore P (A) = 50/101, P (B) = 33/101, P (A B) = 16/101 < (50/101) (33/101) because 1616 = 16 101 < 50 33 = 1650. Therefore A and B are negatively correlated. 7. (4+4 points) (a) Calculate the largest k such that 3 k divides ( 83! ) (83-83 factorial). (b) Calculate the largest l such that 3 l divides. Do 21 NOT use calculator for this question; show all your work. (a) Let k p (n) denote the exponent in the largest power of p that divides n!. Then the question is k = k 3 (83). 83 83 83 83 k 3 (83) = + + + = 27 + 9 + 3 + 1 = 40. (9) 3 3 2 3 3 3 4 (b) The desired exponent is l = k 3 (83) k 3 (21) k 3 (62) = (27 + 9 + 3 + 1) (7 + 2) (20 + 6 + 2) = 0 + 1 + 1 + 1 = 3. 3

8. (6 points) Prove: ( x)(x 13 x (mod 65)). 65 = 5 13 and 5 and 13 are relatively prime so it suffices to prove the congruence modulo 5 and modulo 13 separately. (a) By Fermat s Little Theorem, if 13 x then x 12 1 (mod 13) and therefore x 13 x (mod 13). But this last congruence also holds if 13 x since then both sides are 0 (mod 13). (b) If 5 x then x 4 1 (mod 5); therefore x 12 = (x 3 ) 4 1 4 = 1 (mod 5) and consequently x 13 x (mod 5). But the last congruence also holds when 5 x because then both sides are 0 (mod 13). 9. (4+2B points) (a) Let x > 0. Show that the largest term in the Taylor series e x = n=0 xn /n! occurs when n = x. (b) (BONUS) Prove, using the Taylor series of e x, that n! > (n/e) n. (Hint: find the largest term of the expansion of e n. Do not use Stirling s formula.) (a) Let a n = x n /n! be the n-th term of the series. Consider the quotient of two consecutive terms: a n a n 1 = x n /n! x n 1 /(n 1)! = x n. (10) So as long as x n, we have a n a n 1 ; after that, a n < a n 1. So the largest term occurs for the greatest n such that n x; this is n = x. (b) n n /n! is one of the terms (in fact, the largest term) in the expansion of e n, therefore e n > n n /n!. Rearranging the inequality we obtain n! > (n/e) n. 10. (6 points) Decide whether or not the following system of congruences is solvable. Prove your answer. x 2 (mod 9) x 8 (mod 21) x 1 (mod 7) (First solution) 7 21, so the second congruence implies the third, therefore the third congruence is redundant: x satisfies all the three congruences if and only if it satisfies the first two. The second congruence is equivalent to the pair of congruences x 8 (mod 7) and x 8 (mod 3), or equivalently, x 1 (mod 7) and x 2 (mod 3). The last congruence follows from x 2 (mod 9) and therefore is redundant. So the entire system is equivalent to the pair of congruences x 2 (mod 9) and x 1 (mod 7). By the Chinese Remainder Theorem, this system (and therefore the original system) has a unique solution modulo 63. (Second solution: by guessing) The positive solutions to the second congruence are 8, 29, 50,.... Luckily we can observe that 29 satisfies 4

all the three congruences; therefore a solution exists. It also follows that the solution is unique modulo the l.c.m.(9, 21, 7) = 63. 11. (2+6+9 points) A careless secretary puts n distinct letters into n addressed envelopes at random. All addresses are different. Let X denote the number of letters that happen to get in the right envelope. (a) What is the size of the sample space of this experiment? (b) Determine E(X). If you use auxiliary random variables, define them clearly. Half the credit goes for this definition. (c) Determine the probability that X = 0 (none of the letters goes in the right envelope). Name the method used. Prove that this probability approaches 1/e as n. (a) n! (b) Let Y i be the indicator variable of the event A i that letter #i got in the right envelope. Then X = n i=1 Y i and therefore E(X) = n i=1 E(Y i). Now E(Y i ) = P (A i ) = 1/n and therefore E(X) = 1/n = n (1/n) = 1. n i=1 12. (5B points) (BONUS) Prove that the Fibonacci sequence modulo m is periodic and the period is not longer than m 2 1. Example: the Fibonacci sequence modulo 3 is 0, 1, 1, 2, 0, 2, 2, 1, repeat. The length of the period is 8 = 3 2 1. Remains a challenge problem. 13. (2+4+B5 points) Let V = {1, 2,..., n}, n 3. Let us consider a random graph G on the vertex set V ; adjacency is decided by coin flips. (a) What is the size of the sample space for this experiment? (b) Let A i denote the event that vertex i has even degree. What is the probability of A i? (a) 2 (n 2). (b) Let j be a vertex other than i. There is a 1-to-1 correspondence between those outcomes of the experiment where the degree of i is even and those where the degree of i is odd: just flip the coin deciding the adjacency of i and j. Therefore P (A i ) = 1/2. (c) BONUS PROBLEM. What is the probability that all vertices of G have even degree? Remains a challenge problem. 14. (6 points) Find the multiplicative inverse of 62 modulo 91. Your answer should be an integer between 1 and 90. Show all your work. We follow the steps of Euclid s algorithm, starting from the conditions (a) 62x 1 (mod 91) and (b) 91x 0 (mod 91). Subtracting (a) from (b), we obtain (c) 29x 1 (mod 91). Now we subtract 2(c) from (a) and obtain (d) 4x 3 (mod 91). Finally we subtract 5

7(d) from (c) and obtain x 22 69 (mod 91). So if there is a solution, it can only be x 69 (mod 91). We also proved in the process that gcd(62, 91) = 1 (we executed Euclid s algorithm on the coefficient of x), so a solution indeed must exist. 15. (5B points) (BONUS) Prove: gcd(2 k 1, 2 l 1) = 2 d 1, where d = gcd k, l. (Hint: induction on k + l.) If k = 0 then we have d = l and gcd(0, 2 l 1) = 2 l 1 = 2 d 1. Similarly if l = 0. Now we may assume k, l 1 and assume that the statement is true for k, l if k + l < k + l. WLOG we may assume k l. We know that gcd(a, b) = gcd(a b, b). Therefore gcd(2 k 1, 2 l 1) = gcd(2 k 2 l, 2 l 1) = gcd(2 l (2 k l 1), 2 l 1) = gcd(2 k l 1, 2 l 1). (We were able to omit the term 2 k l because 2 l 1 is odd.) We can now use the inductive hypothesis, so the right-hand side is 2 s 1 where s = gcd(k l, l) = gcd(k, l). 16. (4+6+6B points) (a) Prove: there are infinitely many prime numbers. Give Euclid s proof. Assume, for a contradition, that p 1,..., p n is a complete list of all primes. Consider the number N = n i=1 p i + 1. Then, for every i we have N 1 (mod p) i. Let now p be a prime divisor of N. Then N 0 (mod p). On the other hand, p must be one of the p i (the list being complete), so we have N 1 (mod p) and therefore 1 0 (mod p), a contradiction. (b) Prove: there are infinitely many prime numbers of the form 4k 1. (Do not use Dirichlet s theorem.) Lemma. If N > 1 and N 1 (mod 4) then N has a prime divisor of the form 4k 1. Proof. Let N = p 1... p s where the p i are (not necessarily distinct) primes. N is odd, so each p i is odd. If all of them were 1 (mod 4) then so would be their product. So at least one of them must be 1 (mod 4), proving the Lemma. Proof of the result stated in the problem. Assume, for a contradiction, that q 1,..., q t is a complete list of all primes 1 (mod 4). Consider the number N = 4 t i=1 q i 1. So for each i we have N 1 (mod q i ). Since N 1 (mod 4) and N > 1, it follows by the Lemma that N has a prime divisor q such that q 1 (mod 4). So N 0 (mod q). On the other hand, q must be one of the q i (the list being complete), so we have N 1 (mod q) and therefore 1 0 (mod q), a contradiction. 6

(c) (BONUS) Prove: there are infinitely many prime numbers of the form 4k + 1. (Hint: use the fact that 1 is a quadratic nonresidue modulo primes of the form 4k 1.) Reamins a challenge problem. 17. (6 points) Count the 5-cycles in the complete graph K n. A 5-cycle is a subgraph isomorphic to C 5. K 5 has 4!/2 = 12 5-cycles: start at vertex 1, move to any one of 4 places, then to any of 3 places, then to 2, and finally 1. This gives 41 choices; but we counted every cycle twice (we can traverse ( them ) in n two directions). So the total number of 5-cycles in K n is 12. 5 18. (5B points) (BONUS) Pick a random integer x between 1 and n. Let r(x) denote the number of distinct prime divisors of x (so r(12) = 2). Prove: E(r(x)) ln ln n. Remains a challenge problem. 7