360 likes | 605 Views
Discrete Mathematics. 5. COMBINATORICS. Lecture 8. Dr.-Ing. Erwin Sitompul. http://zitompul.wordpress.com. Homework 7. No.1 : . Determine GCD(216,88) and express the GCD as a linear combination of 216 and 88. No.2: .
E N D
Discrete Mathematics 5. COMBINATORICS Lecture 8 Dr.-Ing. Erwin Sitompul http://zitompul.wordpress.com
Homework 7 No.1: Determine GCD(216,88) and express the GCD as a linear combination of 216 and 88. No.2: Given the ISBN-13: 978-0385510455, check whether the code is valid or not. Hint: Verify the check digit of the ISBN numbers.
Solution of Homework 7 No.1: By enumerating: Divisors of 216: 1,2,3,4,6,8,9,12,18,24,27,36,54,72,108. Divisors of 88: 1,2,4,8,11,22,44. Common divisors of 216 and 88 are 1, 2, 4, 8. GCD(45,36) = 8. By using Euclidean Algorithm : 216 = 882 + 40 88 = 402 + 8 40 = 85 + 0 n = 0 m = 8 is the GCD, GCD(216,88) = 8.
Solution of Homework 7 No.1: Apply Euclidean Algorithm and obtain GCD(216,88) = 8 as follows: 216 = 288 + 40 (1) 88 = 240 + 8 (2) 40 = 58 + 0 (3) Rearrange (2) to 8 = 88 – 240 (4) Rearrange (1) to 40 = 216 – 288 (5) Insert (5) to (4) so that 8 = 88 – 2(216 – 288) = 88 – 2216 + 488 = 588 – 2216 Thus, GCD(216, 88) = 8 = 588 – 2216 =–2216 + 588
Solution of Homework 7 No.2: ISBN-13: 978-0385510455. Assuming the first 12 characters are true, the check digit of a valid ISBN can be obtained as follows: 91 + 73 + 81 + 03 + 31 + 83 + 51 + 53 + 11 + 03 + 41 + 53 = 105 Thus, the check digit is 105 + x13 0 (mod 10) x13 = 5 The result is identical with the check digit of the ISBN, which is 5. Then, the ISBN is valid.
Password Possibilities A password may consist of 6 up to 8 characters. The characters can be letters or numbers. How many possible password can be generated? abcdef abcdeg a123bc … resnick mdrosen … zzzzzzzz
Definition of Combinatorics Combinatorics is a branch of mathematics concerning the study of finite or countable discrete structures. One aspect of combinatorics is counting the number of possible structures of a given kind and size without enumeration. This is done by deciding when certain criteria can be met, and followed by constructing and analyzing objects meeting the criteria.
Basic Rules Rule of Product Attempt 1: pways Attempt 2: qways Attempt 1 and attempt 2: pqways Rule of Sum Attempt 1: pways Attempt 2: q ways Attempt 1 or attempt 2: p+qways
Basic Rules Example: A leader of 6th class in SDN 01 Cikarang will be elected out of 35 male students and 15 female students. In how many ways can the class leader be elected? Solution: By using Rule of Sum, 35 + 15 = 50 ways. Example: The 6th class in SDN 01 Cikarang is ordered to participate on the traditional costume parade in next August 17. Two students will be chosen to join the parade, one male and one female student. In how many ways can the two representatives be chosen? Solution: By using Rule of Product, 35 15 = 525 ways.
Extension of Basic Rules • Suppose there are n attempts, and each i-th attempt can be done in pi different ways. then: • Rule of Product For n attempts, the outcome can be obtained in p1p2 … pnways. • Rule of Sum For n attempts, the outcome can be obtained in p1+p2+ … +pnways.
Extension of Basic Rules Example: A binary digit (bit) is constructed by 0 or 1. How many bit strings can be constructed if: (a) The length of the string is 5 digit. (b) The length of the string is 8 digit (= 1 byte). Solution: (a) 2 2 2 2 2 = 25 = 32 strings. (b) 28 = 256 strings.
Extension of Basic Rules Example: How many odd integers are there between 1000 and 9999 (including 1000 and 9999), if: (a) The integers are made of distinct numbers? (b) The integers may be made of the same numbers? Solution: (a) Unit digit: 5 possible numbers (1,3,5,7,9). Thousands digit: 8 possible numbers (1 taken, no 0). Hundreds digit: 8 possible numbers (2 taken). Tens digit: 7 possible numbers (3 taken). The amount of possible odd integers are: 5887 = 2240. (b) Unit digit : 5 possible numbers (1,3,5,7,9). Thousands digit: 9 possible numbers (1-9, no 0). Hundreds digit: 10 possible numbers (0-9). Tens digit: 10 possible numbers (0-9). The amount of possible odd integers are 591010 = 4500.
Extension of Basic Rules Example: The password in a certain computer network is 6- up to 8-character long. The character can be capital letters (A-Z) or numbers (0-9). How many password can be made for this network? Solution: Number of possible characters for the password = 26 (A-Z) + 10 (0-9) = 36 characters. Number of possible 6-character-long passwords: 363636363636 = 366 = 2.176.782.336 Number of possible 7-character-long passwords : 36363636363636 = 367 = 78.364.164.096 Number of possible 8-character-long passwords : 3636363636363636 = 368 = 2.821.109.907.456 Total number of possible passwords (Rule of Sum): 2.176.782.336 + 78.364.164.096 + 2.821.109.907.456 = 2.901.650.853.888.
Extension of Basic Rules Example: Every byte consists of 8 bits (binary digits). How many bytes begin with ‘11’ or end with ‘11’? Solution: Suppose A = Set of bytes beginning with ’11’, B = Set of bytes ending with ‘11’. then AB = Set of bytes starting and ending with ‘11’, AB = Set of bytes starting or ending with ‘11’. A = 26 = 64, B = 26 = 64, AB = 24 = 16. then AB = A + B – AB = 64 + 64 – 16 = 112.
Permutation In how many distinct sequences can the balls (red, blue, white) be placed in the boxes 1, 2, and 3?
Permutation Box 1 Box 2 Box 3 b w r w b r w b w r r b w b r The number of possible ball placements with distinct sequence is 321 = 3! = 6.
Permutation • Definition: Permutation is understood to be a sequence containing each element of a finite set, once and only once. • Permutation is a special form of Rule of Product. • Suppose there are n elements in a set, then First place is chosen out of n elements, Second place is chosen out of n– 1 elements, Third place is chosen out of n – 2 elements, … Last place is chosen out of 1 remaining element. • According to Rule of Product, the number of permutations of n elements is: n(n – 1)(n – 2)…21 = n!
Permutation Example: How many letter sequences can be made out of the word “ERASE”? Solution: Way 1: 54321 = 120sequences. Way 2: P(5,5) = 5! = 120sequences. Example: In how many different ways can an attendance list be made, if the number of students in a class is 25? Solution: P(25,25) = 25!≈ 1.551 1025different ways.
Permutation r of n Now, there are 6 balls with different color and 3 boxes. Each box can only be filled by one ball. In how many distinct sequences can the balls be placed in the boxes? Solution: Box1 can be filled by one of 6 balls (6 choices). Box2 can be filled by one of 5 balls (5 choices). Box3 can be filled by one of 4 balls (4 choices). Number of distinct sequences = 654 = 120.
Permutation r of n If there are n balls with different colors and r boxes (rn), then First box can be filled by one of n ball (there are n choices), Second box can be filled by one of (n – 1) balls (there are n– 1 choice), Third box can be filled by one of (n – 2) balls (there are n– 2 choice), … The r-th box can be filled by one of (n – (r – 1)) balls (there are n– r + 1 choices), Number of distinct sequences in placing the balls is : n(n – 1)(n – 2)…(n – (r – 1)).
Permutation Formula Permutation of r out of n different objects is the number of possible sequences of r objects which are taken out of n available objects, with the condition rn.
Permutation Example: How many possible hundreds number can be formed by using the first five positive integers 1, 2, 3, 4, and 5, if: (a) Each number may only used once (no repetition)? (b) Each number may be used more than once (repetition is allowed)? Solution: (a) By Rule of Product: 543 = 60. By Permutation Formula P(5,3) = 5!/(5 – 3)! = 60. (b) By Rule of Product: 555 = 53 = 125. Cannot be solved by using Permutation Formula (it is not a permutation).
Permutation Example: The book code in a library consists of 7 characters, with 4 distinct letters followed by 3 distinct numbers. How many book code can be made according to this rule? Solution: P(26,4) P(10,3) = 26!/(26 – 4)! 10!/(10 – 3)! = 26252423 1098 = 258.336.000.
Combination Combination is a specific form of permutation. If in permutation the order matters, then in combinationthe order does not matter. Combination is understood to be a sequence containing elements of a finite set
Combination Box 1 Box 2 Box 3 b w r w b r w b w r r b w b r rbw= rwb= brw= bwr= wrb= wbr In combination, the order of appearance is neglected. The number of distinct combinations in placing 3 balls in 3 boxes is 1= P(3,3)/3!
Combination The number of distinct combinations (that is, without regarding the order) in placing 3 out of 7 balls in 3 boxes is 20 = P(6,3)/3! (Check by enumerating!) A mix of 3 ballswith different colors is only counted as 1 one combination only.
Combination Formula In general, the number of ways to put r colored balls in n boxes, without regarding the order of the balls when they are taken and put, is can also be written as Combination of r out of n objects, or C(n,r), is the number of unordered choices of r objects taken out of n.
Interpretation of Combination C(n,r) is the number of subsets consisting r elements/members, which are made out of a set with n elements/members. Suppose A= { 1,2,3,4 }. Subsets with 3 elements/members are: { 1,2,3 } = { 1,3,2 } = { 2,1,3 } = { 2,3,1 } = { 3,1,2 } = { 3,2,1 } { 1,2,4 } = { 1,4,2 } = { 2,1,4 } = { 2,4,1 } = { 4,1,2 } = { 4,2,1 } { 1,3,4 } = { 1,4,3 } = { 3,1,4 } = { 3,4,1 } = { 4,1,3 } = { 4,3,1 } { 2,3,4 } = { 2,4,3 } = { 3,2,4 } = { 3,4,2 } = { 4,2,3 } = { 4,3,2 } Thus, there are 4 subsets which are distinct to each other, or
Combination Example: Commission IV of DPR RI consists of 25 members. In how many ways can a special committee be formed, if the size of the committee is 5 people? Solution: From the available information, a special committee is a group of members where order does not matter. The members of the special committee have equal position. C(25,5) = 25!/((25 – 5)!5!) = 2524232221/(54321) = 53.130
Combination Example: Among 10 IT students batch 2009, a 5-member representative committee will be formed. Encep and Florina are calculating their chance to be elected. In how many ways can the committee be formed such that: (a) Encep is elected. (b)Encep is not elected. (c) Encep is elected but Florina not. (d)Florina is elected but Encep not. (e) Encep and Florina are elected. (f)At least one of them is elected.
Combination Solution: (a) Encep is elected. (b) Encep is not elected. (c) Encep is elected but Florina not.
Combination Solution: (d) Florina is elected but Encep not. Identical to the answer of (c) (e) Encep and Florina are elected. (f) At least one of them is elected. Both of them elected Encep elected, Florina not Florina elected, Encep not
Combination Solution: (f) At least one of them is elected. Part (f) can also be solved by using Inclusion-Exclusion Principle. Assume X = Number of ways to form a representative that includes Encep, Y = Number of ways to form a representative that includes Florina, XY = Number of ways to form a representative that includes both Encep and Florina. Then X= C(9,4) = 126 Y= C(9,4) = 126 XY= C(8,3) = 56 XY= X+Y–XY= 126 + 126 – 56 = 196.
Homework 8 A chairperson and a treasurer of PUMA IE should be chosen out of 50 eligible association members. In how many ways can a chairperson and a treasurer can be elected, if: (a) There is no limitation. (b)Amir wants to serve only if elected as a chairperson. (c) Budi and Cora want to be elected together or not at all. (d)Dudi and Encep do not want to work together.
Homework 8 A vehicle registration plate in greater Jakarta area contains 3 letters since the end of 2009. This is due to the increase of motorized vehicles in the area. (a) Before, how many registration plates are available (when only 2 letters are used)? (b)Afterwards, how many registration plates are available (with 3 letters used). Hint: Assume that there is no restrictions to arrage the letters and numbers. New