* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Lecture 15 - Mathematics
Survey
Document related concepts
Big O notation wikipedia , lookup
Mathematics of radio engineering wikipedia , lookup
Large numbers wikipedia , lookup
Location arithmetic wikipedia , lookup
History of the function concept wikipedia , lookup
Non-standard analysis wikipedia , lookup
Fundamental theorem of algebra wikipedia , lookup
Function (mathematics) wikipedia , lookup
Mathematics of Sudoku wikipedia , lookup
Non-standard calculus wikipedia , lookup
Principia Mathematica wikipedia , lookup
Proofs of Fermat's little theorem wikipedia , lookup
Transcript
Math236 Discrete Maths with Applications P. Ittmann UKZN, Pietermaritzburg Semester 1, 2012 Ittmann (UKZN PMB) Math236 2012 1 / 43 The Multiplication Principle Theorem Let S be a set of k-tuples (s1 , s2 , . . . , sk ) of objects in which: the rst object s1 comes from a set of size n1 for each choice of s1 there are n2 choices for object s2 for each choice of s2 there are n3 choices for object s3 for each choice of s3 there are n4 choices for object s4 and, in general, for each choice of si , 1 ≤ i ≤ k − 1, there are ni +1 choices for object si +1 Then the number of k-tuples in the set S is n1 n2 · · · nk Ittmann (UKZN PMB) Math236 2012 2 / 43 The Multiplication Principle (cont.) Example How many 4-digit odd numbers are there? We consider each number abcd as the 4-tuple (a, b, c , d ) Such a number is odd if and only if the last digit, d, is in the set {1, 3, 5, 7, 9} There are no other restrictions on the digits Thus: n4 = 5 n1 = 9 (since the rst digit cannot be 0), n2 = n3 = 10, and It follows that the number of 4-digit odd numbers is 9 · 10 · 10 · 5 = 4500 Ittmann (UKZN PMB) Math236 2012 3 / 43 Basic counting principles Example How many odd numbers less than 10,000 are there? We use the Addition Principle together with the Multiplication Principle For i ∈ {1, 2, 3, 4}, So, N1 = {1, 3, 5, 7, 9}, N2 = {11, 13, 15, 17, 19, 21, . . . , 99} Notice that let Ni be the set of all {N1 , N2 , N3 , N4 } Ittmann (UKZN PMB) i -digit odd numbers and so on is a pairwise disjoint collection of sets Math236 2012 4 / 43 Basic counting principles (cont.) Example By the Addition Principle, the number of odd numbers less than 10,000 is |N1 | + |N2 | + |N3 | + |N4 | Using the Multiplication Principle as we did in the previous example We see that |N1 | = 5, |N2 | = 45, |N3 | = 450 Thus the answer is 4500 Ittmann (UKZN PMB) and |N4 | = 4500 + 450 + 45 + 5 = 5000 Math236 2012 5 / 43 Basic counting principles (cont.) Example How many k -tuples can be chosen from a set of n elements if repetition is allowed? k -tuples (s1 , s2 , . . . , sk ) in which each si comes n elements and in which it's possible that si = sj We seek the number of from a xed set of For each position in the k -tuple, we can choose any one of n dierent elements Hence, by the Multiplication Principle, there are n| · n ·{z· · · · n} = nk k such terms k -tuples Ittmann (UKZN PMB) Math236 2012 6 / 43 The Power Set Denition If S is a set, then we let 2 called the power set of S denote the set of all subsets of S S, sometimes Example If S = {a , b , c }, 2 then S = {∅, {a}, {b }, {c }, {a, b }, {a, c }, {b , c }, {a, b , c }} Ittmann (UKZN PMB) Math236 2012 7 / 43 The Power Set (cont.) The Multiplication Principle enables us to prove a formula for the number of subsets of a set Theorem If S is a nite set, then Ittmann (UKZN PMB) S 2 = 2|S | Math236 2012 8 / 43 The Power Set (cont.) Proof. Let S = {x1 , x2 , . . . , x|S | } With each subset A⊆S do the following: Associate an |S |-tuple (a1 , a2 , . . . , a|S | ) with A Where for i ∈ {1, 2, . . . , |S |} we set ( ai = 0 1 if xi 6∈ A if xi ∈ A. Clearly, each subset corresponds to exactly one |S |-tuple |S |-tuple and each corresponds to one subset Ittmann (UKZN PMB) Math236 2012 9 / 43 The Power Set (cont.) Proof. It follows that the number of subsets is equal to the number of such |S |-tuples Note each position in the |S |-tuple is chosen from a set Thus we are asking the question How many |S |-tuples {0 , 1 } of size 2 can be chosen from a set of 2 elements? |S | From the second to last example, the answer is 2 Ittmann (UKZN PMB) Math236 2012 10 / 43 The Power Set (cont.) Example Let S = {a, b, c } The subset {a , c } The subset {b } and let x1 = a, x2 = b, x3 = c and corresponds to the 3-tuple corresponds to the 3-tuple (1, 0, 1) (0, 1, 0) According to previous theorem, the number of subsets of S is S 2 = 2|S | = 23 = 8 This can be veried by counting the subsets Ittmann (UKZN PMB) Math236 2012 11 / 43 The Pigeonhole Principle The Pigeonhole Principle We study a principle referred to as the Pigeonhole Principle Theorem If n + 1 objects are placed into n boxes, then at least one box contains at least two objects Ittmann (UKZN PMB) Math236 2012 12 / 43 The Pigeonhole Principle The Pigeonhole Principle (cont.) Proof. Suppose this is not the case Then, each box contains at most one object This implies that the number of objects is at most n This is a contradiction Example If we choose 13 people, then there are two who have their birthday in the same month Ittmann (UKZN PMB) Math236 2012 13 / 43 The Pigeonhole Principle The Pigeonhole Principle (cont.) Example Suppose we have n How many of the 2 married couples n people must be selected to guarantee that we have chosen at least one married couple? Construct n boxes, each corresponding to one married couple Each time we choose someone, place them into the box corresponding to the couple they are a member of The Pigeonhole Principle says that once we've chosen n+1 people, at least one box must contain 2 people That is, we've chosen a married couple Ittmann (UKZN PMB) Math236 2012 14 / 43 The Pigeonhole Principle The Pigeonhole Principle (cont.) Example We choose 101 of the integers 1, 2, . . . , 200 We claim that among the integers chosen, there are two having the property that one is divisible by the other Each integer in n {1, 2, . . . , 200} can be written in the form n 2k , where is an odd number between 1 and 199 Ittmann (UKZN PMB) Math236 2012 15 / 43 The Pigeonhole Principle The Pigeonhole Principle (cont.) Example There are 100 odd integers in {1, 2, . . . , 200} So if we choose 101 numbers, by the Pigeonhole Principle, two of the numbers we've chosen must have the same odd n That is, two of the numbers we've chosen are of the form n2k2 We assume without loss of generality that The number n2k2 Ittmann (UKZN PMB) divides the number Math236 n2k1 and k1 ≥ k2 n2k1 , as desired 2012 16 / 43 The Pigeonhole Principle The Strong Pigeonhole Principle We now give a stronger form of the Pigeonhole Principle Theorem Let n1 , n2 , . . . , nk be positive integers Let n1 + n2 + · · · + nk − k + 1 objects are placed into k boxes Then there is an integer i ∈ {1, 2, . . . , k } such that the ith box contains at least ni objects Ittmann (UKZN PMB) Math236 2012 17 / 43 The Pigeonhole Principle The Strong Pigeonhole Principle (cont.) Proof. Assume, to the contrary, that this is not the case Then for each i ∈ {1, 2, . . . , k }, the i th box contains at most ni − 1 objects Thus the total number of objects is at most (n1 − 1) + (n2 − 1) + · · · + (nk − 1) = n1 + n2 + · · · + nk − k This is a contradiction Ittmann (UKZN PMB) Math236 2012 18 / 43 The Pigeonhole Principle The Strong Pigeonhole Principle (cont.) Example A basket of fruit is to be made up from apples, bananas, litchis, and mangos How many pieces of fruit must we place in the basket to be guaranteed that there are at least three apples or at least two bananas or at least ten litchis or at least ve mangos? From the Strong Pigeonhole Principle, the answer is 3 Ittmann (UKZN PMB) + 2 + 10 + 5 − 4 + 1 = 17 Math236 2012 19 / 43 The Pigeonhole Principle The Strong Pigeonhole Principle (cont.) Example Suppose that we choose n2 + 1 integers from the integers 1, 2, . . . , n Think of this in the following way: We pick n2 + 1 integers Each integer is put into a box marked from 1 to n depending on its value Ittmann (UKZN PMB) Math236 2012 20 / 43 The Pigeonhole Principle The Strong Pigeonhole Principle (cont.) Example Note that n2 + 1 = (n + 1) + (n + 1) + · · · + (n + 1) −n + 1 | n {z } terms The Strong Pigeonhole Principle guarantees that at least one box contains at least n+1 objects That is, at least one of the integers 1, 2, . . . , n is chosen at least n+1 times Ittmann (UKZN PMB) Math236 2012 21 / 43 The Pigeonhole Principle The Strong Pigeonhole Principle (cont.) Let a1 , a2 , . . . , ak be a sequence of real numbers Recall that a subsequence ai1 , ai2 , . . . , ait , where 1 The sequence of a1 , a2 , . . . , ak is of the form ≤ i1 < i2 < · · · < it ≤ k a1 , a2 , . . . , ak is increasing if a1 ≤ a2 ≤ · · · ≤ ak and decreasing if a1 ≥ a2 ≥ · · · ≥ at Ittmann (UKZN PMB) Math236 2012 22 / 43 The Pigeonhole Principle The Strong Pigeonhole Principle (cont.) Example Consider the sequence 8, 1, 3, 5, 9, 2, 6, 4, 7 Then 1, 5, 2, 7 is a subsequence, but 1, 2, 3, 4 is not Note that 1, 3, 5, 9 is an increasing subsequence, and 8, 5, 2 is a decreasing subsequence Ittmann (UKZN PMB) Math236 2012 23 / 43 The Pigeonhole Principle The Strong Pigeonhole Principle (cont.) The Strong Pigeonhole Principle enables us to prove the following interesting result, rst established by Erdös and Szekeres Theorem Every sequence a1 , a2 , . . . , an2 +1 of n2 + 1 real numbers contains an increasing subsequence of length n + 1 or a decreasing subsequence of length n + 1 Ittmann (UKZN PMB) Math236 2012 24 / 43 One-to-one functions and permutations One-to-one functions As mentioned before, a function is a relation in which each element of the domain is related to exactly one element of the range Let f be a function with the additional property that no two elements of its domain are related to the same element of its range That is, x 6= y We call f a implies that one-to-one Ittmann (UKZN PMB) f (x ) 6= f (y ) function, or an Math236 injection 2012 25 / 43 One-to-one functions and permutations One-to-one functions (cont.) If f is one-to-one, then the relation f −1 = {(b, a) : (a, b) ∈ f } is also a function Conversely, if If f f is not one-to-one, then f − is an injection, then Ittmann (UKZN PMB) 1 f −1 is called the Math236 is not a function inverse function of f 2012 26 / 43 One-to-one functions and permutations One-to-one functions (cont.) Example Let f1 = {(1, a), (2, c ), (3, b)} Both f1 and f2 The function and f2 = {(1, a), (2, b), (3, b)} are functions f1 is an injection, while This follows since the element b f2 is not of the range of f2 is related to both 2 and 3 The inverse of Ittmann (UKZN PMB) f1 is f1−1 = {(a, 1), (c , 2), (b, 3))} Math236 2012 27 / 43 One-to-one functions and permutations One-to-one functions (cont.) Example The relation f3 = {(x , x 2 ) : x ∈ R} However, both (2, 4) and (−2, 4) is a function are members of f3 , so f3 is not one-to-one The relation f4 = {(x , 5x + 6) : x ∈ R} Its inverse is the function The relation is a one-to-one function f4−1 = {(x , (x − 6)/5 : x ∈ R} f5 = {(x , tan(π(x − 1/2))) : x ∈ (0, 1)} is a one-to-one function Its inverse is the function f5−1 = {(x , (1/π) arctan x + 1/2) : x ∈ (−∞, ∞)} Ittmann (UKZN PMB) Math236 2012 28 / 43 One-to-one functions and permutations Permutations Let A S be a nite nonempty set permutation S of S is a one-to-one function whose domain and range are both Example Let S = {1, 2, 3} One permutation of f (3) = 2 S is the function f with f (1) = 1, f (2) = 3, and This permutation can be denoted in the following manner f = Ittmann (UKZN PMB) 1 2 3 1 3 2 Math236 2012 29 / 43 One-to-one functions and permutations Permutations (cont.) The top row of the matrix is read as the domain and the bottom row as the range Thus, in general, this notation has this form f = Ittmann (UKZN PMB) 1 2 3 f (1) f (2) f (3) Math236 2012 30 / 43 One-to-one functions and permutations Permutations (cont.) Example There are six permutations of a set of three elements. The six {1, 2, 3} permutations of f1 = f4 = 1 2 3 1 2 3 1 2 3 1 3 2 Ittmann (UKZN PMB) are: f2 = f5 = 1 2 3 2 3 1 1 2 3 3 2 1 Math236 f3 = f6 = 1 2 3 3 1 2 1 2 3 2 1 3 2012 31 / 43 One-to-one functions and permutations Permutations (cont.) Written this way, it's easy to nd the inverse of a permutation To do so, 1 2 Interchange the top and bottom rows of the matrix (If necessary) re-order by the elements in the (new) rst row Ittmann (UKZN PMB) Math236 2012 32 / 43 One-to-one functions and permutations Permutations (cont.) Example The inverse of f2 = is 1 2 3 2 3 1 2 3 1 1 2 3 After resorting the top row into ascending order, becomes the permutation In other words, Ittmann (UKZN PMB) 1 2 1 3 1 2 = f3 f2−1 = f3 Math236 2012 33 / 43 One-to-one functions and permutations Permutations (cont.) Example Similarly f1−1 = f1 f3−1 = f2 f4−1 = f4 f5−1 = f5 f6−1 = f6 Ittmann (UKZN PMB) Math236 2012 34 / 43 One-to-one functions and permutations Permutations (cont.) f = f −1 , involution If as is the case with f1 , f4 , f5 , and f6 , then f is called an Another way of writing permutations is as follows For the permutation 2 3 4 2 4 1 3 we only write the bottom row, Thus, we could write Ittmann (UKZN PMB) 1 (2413) f1 = (123), f6 = (213), Math236 etc. 2012 35 / 43 Counting permutations Counting permutations We now attempt to count permutations and similar mathematical objects Example How many permutations of the set S = {a, b, c } are there? As mentioned in the last example, we can think of each permutation on S as a 3-tuple (f (a), f (b), f (c )) The question then becomes: How many such 3-tuples are there? Ittmann (UKZN PMB) Math236 2012 36 / 43 Counting permutations Counting permutations (cont.) Example The value f (a ) may be any of three things: Once we've assigned a value to Since f is one-to-one, f (b ) f (a ), a, b , and we must assign one to cannot have the same value as This means that there are only two possibilities for Ittmann (UKZN PMB) c Math236 f (b ) f (a ) f (b) 2012 37 / 43 Counting permutations Counting permutations (cont.) Example Lastly, once we've chosen neither f (a) nor f (b ) f (b ), we must specify It follows that, whatever the values of possible value for f (c ) f (a ) and f (c ), f (b), which can be there's only one From the Multiplication Principle, the total number of such 3-tuples is 3 Ittmann (UKZN PMB) ·2·1=6 Math236 2012 38 / 43 Counting permutations Counting permutations (cont.) Recall that n factorial is the function with rule 0! =1 and, for n ≥ 1, n! = n · (n − 1) · (n − 2) · · · 3 · 2 · 1 So, 0! =1 1! =1 2! =2 3! =6 4! = 24 5! = 120 This gives us a compact way to write certain expressions down Ittmann (UKZN PMB) Math236 2012 39 / 43 Counting permutations Counting permutations (cont.) n-set An is a set containing n elements Example How many permutations of an n-set Suppose that the elements of the are there? n-set are x1 , x2 , . . . , xn As in the previous example, we can consider each permutation to be an n-tuple (f (x1 ), f (x2 ), . . . , f (xn )) As before, we have n Once we've chosen f (x1 ), Ittmann (UKZN PMB) choices for f (x1 ) there are Math236 (n − 1) possible choices for 2012 f (x2 ) 40 / 43 Counting permutations Counting permutations (cont.) Example Once we've chosen f (x2 ), there are (n − 2) possible choices for f (x3 ), and so on So we see that the number of permutations of an n-set is n(n − 1)(n − 2) · · · 2 · 1 = n! Ittmann (UKZN PMB) Math236 2012 41 / 43 Counting permutations Counting permutations (cont.) Example = 720 permutations of the set {a, b, c , d , e , f } k -tuples can be chosen from an n-set There are 6! Example How many if repetition of elements is not allowed? If repetition of elements is allowed, we already know the answer to this question is nk Suppose then that repetition is not allowed We may choose any of n elements for the rst position in the k -tuple Once we've done that, we may choose any element for the second position except the one we chose for the rst Ittmann (UKZN PMB) Math236 2012 42 / 43 Counting permutations Counting permutations (cont.) Example So for each choice for the rst position, there are n−1 choices for the second position Once we've chosen the second position, there are (n − 2 ) possibilities for the third position, and so on When we reach the k th position, there are n−k +1 possibilities From the Multiplication Principle, the number of such k -tuples is thus n(n − 1)(n − 2) · · · (n − k + 2)(n − k + 1) Ittmann (UKZN PMB) Math236 2012 43 / 43