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

Similar documents
MATH 2200 Final Review

What you learned in Math 28. Rosa C. Orellana

Basic Proof Examples

Solutions to Practice Final

MATH 363: Discrete Mathematics

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

Solution Set 2. Problem 1. [a] + [b] = [a + b] = [b + a] = [b] + [a] ([a] + [b]) + [c] = [a + b] + [c] = [a + b + c] = [a] + [b + c] = [a] + ([b + c])

(1) Which of the following are propositions? If it is a proposition, determine its truth value: A propositional function, but not a proposition.

(c) Give a proof of or a counterexample to the following statement: (3n 2)= n(3n 1) 2

Math 324 Summer 2012 Elementary Number Theory Notes on Mathematical Induction

MATH 2200 Final LC Review

HOMEWORK #2 - MATH 3260

Definition 6.1 (p.277) A positive integer n is prime when n > 1 and the only positive divisors are 1 and n. Alternatively

MATH 271 Summer 2016 Practice problem solutions Week 1

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

Summing Series: Solutions

Exam Practice Problems

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

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

REVIEW QUESTIONS. Chapter 1: Foundations: Sets, Logic, and Algorithms

Twin primes are pairs of natural numbers (p, p + 2) such that both p and p + 2 are primes.

CSE 321 Solutions to Practice Problems

7.2 Applications of Euler s and Fermat s Theorem.

Know the Well-ordering principle: Any set of positive integers which has at least one element contains a smallest element.

Math Homework # 4

Recitation 7: Existence Proofs and Mathematical Induction

MATH 4400 SOLUTIONS TO SOME EXERCISES. 1. Chapter 1

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

a + b = b + a and a b = b a. (a + b) + c = a + (b + c) and (a b) c = a (b c). a (b + c) = a b + a c and (a + b) c = a c + b c.

Properties of the Integers

Discrete Math, Spring Solutions to Problems V

Math 261 Spring 2014 Final Exam May 5, 2014

DISCRETE STRUCTURES AMIN WITNO

Homework #2 solutions Due: June 15, 2012

MATH 324 Summer 2011 Elementary Number Theory. Notes on Mathematical Induction. Recall the following axiom for the set of integers.

MA Discrete Mathematics

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

Math 110 HW 3 solutions

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

Math 283 Spring 2013 Presentation Problems 4 Solutions

Math 13, Spring 2013, Lecture B: Midterm

Simplification by Truth Table and without Truth Table

Number Theory Homework.

Exam in Discrete Mathematics

Math Final Exam December 14, 2009 Page 1 of 5

Fall 2017 Test II review problems

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

MATH CSE20 Homework 5 Due Monday November 4

DISCRETE MATH: FINAL REVIEW

CS1800 Discrete Structures Spring 2018 February CS1800 Discrete Structures Midterm Version A

1. How many labeled trees are there on n vertices such that all odd numbered vertices are leaves?

6 Permutations Very little of this section comes from PJE.

Proof by Contradiction

Simplification by Truth Table and without Truth Table

What can you prove by induction?

MATH 215 Final. M4. For all a, b in Z, a b = b a.

Chapter 1 Review of Equations and Inequalities

CMSC250 Homework 9 Due: Wednesday, December 3, Question: Total Points: Score:

Appendix G: Mathematical Induction

Review Sheet for the Final Exam of MATH Fall 2009

On the number of semi-primitive roots modulo n

CHAPTER 6. Prime Numbers. Definition and Fundamental Results

Simplification by Truth Table and without Truth Table

Number Tree LCM HCF Divisibility Rules Power cycle Remainder Theorem Remainder of powers a n b n Last and Second last digit Power of Exponents Euler s

CMSC Discrete Mathematics SOLUTIONS TO SECOND MIDTERM EXAM November, 2005

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

Algebra Revision Guide

CSE 20. Final Review. CSE 20: Final Review

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

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

Proof 1: Using only ch. 6 results. Since gcd(a, b) = 1, we have

Mathematics for Computer Science MATH 1206C [P.T.O] Page 1 of 5

Name: Mathematics 1C03

Discrete mathematics , Fall Instructor: prof. János Pach

CSE 1400 Applied Discrete Mathematics Proofs

Exam in Discrete Mathematics

MATH 310: Homework 7

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

Math 10850, fall 2017, University of Notre Dame

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

CS1800: Mathematical Induction. Professor Kevin Gold

(e) Commutativity: a b = b a. (f) Distributivity of times over plus: a (b + c) = a b + a c and (b + c) a = b a + c a.

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:

CHAPTER 4 SOME METHODS OF PROOF

CS1800: Strong Induction. Professor Kevin Gold

Some Review Problems for Exam 1: Solutions

Basic elements of number theory

Basic elements of number theory

Math 430 Exam 1, Fall 2006

MATH 114 Fall 2004 Solutions to practice problems for Final Exam

a. See the textbook for examples of proving logical equivalence using truth tables. b. There is a real number x for which f (x) < 0. (x 1) 2 > 0.

Math Circle: Recursion and Induction

Show Your Work! Point values are in square brackets. There are 35 points possible. Some facts about sets are on the last page.

Cool Results on Primes

Solutions to Tutorial 4 (Week 5)

CS1800 Discrete Structures Final Version A

Grade 11/12 Math Circles Rational Points on an Elliptic Curves Dr. Carmen Bruni November 11, Lest We Forget

Unit i) 1)verify that [p->(q->r)] -> [(p->q)->(p->r)] is a tautology or not? 2) simplify the Boolean expression xy+(x+y) + y

2.5 Compound Inequalities

MATH 61-02: PRACTICE PROBLEMS FOR FINAL EXAM

Transcription:

McGill University Faculty of Science Solutions to Practice Final Examination Math 40 Discrete Structures Time: hours Marked out of 60

Question. [6] Prove that the statement (p q) (q r) (p r) is a contradiction using truth tables or the rules of logic. Then draw a Venn diagram showing clearly why this is a contradiction. Solution. Using truth tables, we have a contradiction, since the last column displays false for every truth assignment to p, q and r. p q r p q q r p r (p q) (q r) (p r) F F F T F F F F F T T T F F F T F T T F F F T T T F F F T F F F F F F T F T F T T F T T F T T F F T T T T F T F Using the rules of logic: (p q) (q r) (p r) ( p q) (q r) (p r) ( p q) (p r) (q r) associativity ( p (p r)) (q p r) (q r) distributivity (( p p) r) (q p r) (q r) associativity 0 (q p r) (q r) contradiction (q p r) (q r) absorption (q r p) (q r) (q r) commutativity 0 (q r) contradiction 0 contradiction. Using Venn Diagrams: q r p q p r There are no regions which contain all three colourings, therefore the given statement is a contradiction.

Question. [6] Let n be a positive integer. Prove that n k(n k) = k= ( n + ). Solution. We ll recall from class that n k= k = ( n ) (it would be given as a hint in the actual exam). Now we prove the given statement by induction. For n =, both sides are zero so we are done. Now suppose n k(n k) = k= and we prove the given formula. Well ( ) n n n n k(n k) = k(n k) + k. k= k= The last term is ( ( n ) by what we recalled from class, and the first term is n ) by induction. So n k(n k) = k= This completes the proof. = = = ( ) n + ( ) n = k= n(n )(n ) 6 n(n ) ((n ) + ) 6 (n + )n(n ) ( ) 6 n +. + n(n )

Question. [6] (a) Write down the number of compositions of n into k non-negative parts, where n and k are non-negative integers and n k. Solution. This is bookwork, the answer is ( ) n+k k. (b) State the multinomial formula, for the number of ordered partitions of an n element set into parts of sizes n, n,..., n k. Then determine the number of ways the letters of the word BANANA can be rearranged. n! Solution. First part is n!n!...n k := ( ) n! n n... n k (bookwork). The answer to the second part is ( 6 ) = 60.

Question 4. [6] Solve the recurrence equation a n = a n + a n where a = a =. Solution. This is the Fibonacci equation, so its bookwork. 4

Question 5. [6] (a) Prove that if p is a prime number, and 0 < k < p, then p ( p k). Find an example to show this is not true if p is not prime. Bookwork (b) Prove that the product of primes greater than n and less than n is less than ( n n ) for any n. Solution. The same proof as in (a) shows that if n < p < n and p is prime, then p ( ) n n. But if primes p, p,..., p k divide a number, so does their product. So if we multiply all the primes between n and n together, we get a number which divides ( ) n n, and is therefore less than ( ) n n. 5

Question 6. [6] (a) Determine 7 0 modulo. Solution. Since is prime, we can use Fermat a p mod p for any prime p and a 0. In particular, 7 0 mod 0. (b) Determine 7 0 modulo 49. Solution. Since 7 0 = (49) 5, the answer is zero. (c) Determine 7 0 modulo 0. Solution. Notice 7 0 = (49) 5 ( ) 5 = () 5 modulo 0. Now () = mod 0 so () 5 = () 7 9 so the answer is 9. 6

Question 7. [6] (a) Find the Prüfer code for the labelled tree shown below. The root of the tree is the vertex labelled zero. 0 5 7 9 4 6 8 Figure : A labelled tree Solution. The rule is: create two sequences one on top of the other as follows. At each step, pick the smallest non-zero leaf, and write that number in the top sequence. Below it, right the label of the vertex in the tree that it is joined to. The very last edge, which will join to zero, is not written down, so if the tree has n vertices, the sequences have length n. Then the lower sequence is the Prüfer code. Prüfer Code ( 0 9 5 0 9 0) 7

Question 7 continued... (b) Draw the tree with Prüfer code (0, 8, 0,, 8, 6,, 0,,,, 8). Solution. First add zero at the end of the Prüfer code and then create another sequence from the Prüfer code as follows: above each number in the Prüfer code, write the smallest non-zero number which does not appear in the code at that position or to the right, and which has not already been written down in the new code. This gives the pair of sequences ( 4 5 7 9 0 6 ) 8 0 8 0 8 6 0 8 0 Now its easy to draw the tree. We could start by joining 0 to 8, then 8 to, then to then to, and so on. Don t forget to add the edge 0 to. 6 7 4 9 5 8 0 8

Question 8. [6] Find a minimum spanning tree in the weighted graph below using Kruskal s Algorithm starting with the shaded edge. Shade those edges which are in your minimum tree in the figure, and write down the total cost of your minimum tree. 7 Figure : A graph with edge costs Solution. At each stage, pick any edge of lowest cost which does not create a cycle with the edges chosen so far. There are many ways to do this, but in the end, when no more edges can be added without creating a cycle, we have a minimum cost tree (there are many minimum cost trees, but they all have the same minimum cost). Total cost of minimum tree 8 9

Question 9 [6] State and prove Euler s Formula. Solution. Bookwork 0

Question 0. [6] (a) Determine the generating series for the set of compositions of n into k parts where each part of the composition is an element of the set {0, }. Solution. The generating series for S = {(x, x,..., x k ) : x i {0, } i} is Φ S (x) = ( + x ) k. (b) Determine the number of compositions of n into k parts where each part of the composition is an element of the set {0, }. Solution. We have to find x n in Φ S (x). So we use the binomial theorem Φ S (x) = k j=0 ( ) k x j. j If n is odd, then this sum has no x n in it (since j is always even). We expected this: an odd number can t be written as a sum of 0s and s. Suppose now n is even. Then when j = n/ in the sum, we get x n. The answer is whatever is in front of x n, which, in this case, happens to be ( k n/) when n is even. So that is the answer when n is even, the answer is zero when n is odd.

Blank Page