Discrete Mathematics 5. COMBINATORICS Lecture 8 Dr.-Ing. Erwin Sitompul .
-
Upload
linda-grout -
Category
Documents
-
view
227 -
download
4
Transcript of Discrete Mathematics 5. COMBINATORICS Lecture 8 Dr.-Ing. Erwin Sitompul .
Discrete Mathematics
5. COMBINATORICS
Lecture 8
Dr.-Ing. Erwin Sitompulhttp://zitompul.wordpress.com
8/2Erwin Sitompul Discrete Mathematics
Homework 7
Determine GCD(216,88) and express the GCD as a linear combination of 216 and 88.
No.1:
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.
8/3Erwin Sitompul Discrete Mathematics
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 + 4088 = 402 + 840 = 85 + 0
n = 0 m = 8 is the GCD, GCD(216,88) = 8.
8/4Erwin Sitompul Discrete Mathematics
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 that8 = 88 – 2(216 – 288) = 88 – 2216 + 488 = 588 – 2216
Thus, GCD(216, 88) = 8 = 588 – 2216 = –2216 + 588
8/5Erwin Sitompul Discrete Mathematics
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 = 105Thus, 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.
13odd digit even digit
3 0 (mod 10)i ii i
x x x
8/6Erwin Sitompul Discrete Mathematics
A password may consist of 6 up to 8 characters. The characters can be letters or numbers. How many possible password can be generated?
abcdefabcdega123bc…resnickmdrosen…zzzzzzzz
Password Possibilities
8/7Erwin Sitompul Discrete Mathematics
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.
8/8Erwin Sitompul Discrete Mathematics
Basic Rules
Rule of ProductAttempt 1: p ways Attempt 2: q ways
Attempt 1 and attempt 2: p q ways
Rule of Sum Attempt 1: p ways Attempt 2: q ways
Attempt 1 or attempt 2: p + q ways
8/9Erwin Sitompul Discrete Mathematics
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.
8/10Erwin Sitompul Discrete Mathematics
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 p1 p2 … pn ways.
Rule of SumFor n attempts, the outcome can be obtained in p1 + p2 + … + pn ways.
8/11Erwin Sitompul Discrete Mathematics
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
8/12Erwin Sitompul Discrete Mathematics
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.
8/13Erwin Sitompul Discrete Mathematics
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.336Number of possible 7-character-long passwords : 36363636363636 = 367 = 78.364.164.096Number of possible 8-character-long passwords : 3636363636363636 = 368 = 2.821.109.907.456Total 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.
8/14Erwin Sitompul Discrete Mathematics
Extension of Basic Rules
Example:Every byte consists of 8 bits (binary digits). How many bytes begin with ‘11’ or end with ‘11’?
Solution:SupposeA = Set of bytes beginning with ’11’, B = Set of bytes ending with ‘11’.thenA B = Set of bytes starting and ending with ‘11’,A B = Set of bytes starting or ending with ‘11’.
A = 26 = 64, B = 26 = 64, A B = 24 = 16. then
A B = A + B – A B = 64 + 64 – 16 = 112.
8/15Erwin Sitompul Discrete Mathematics
Permutation
In how many distinct sequences can the balls (red, blue, white) be placed in the boxes 1, 2, and 3?
8/16Erwin Sitompul Discrete Mathematics
Permutation
r b w
w b
b r w
w r
w r b
b r
The number of possible ball placements with distinct sequence is 321 = 3! = 6.
Box 1 Box 2 Box 3
8/17Erwin Sitompul Discrete Mathematics
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!
8/18Erwin Sitompul Discrete Mathematics
Example:How many letter sequences can be made out of the word “ERASE”?
Solution:Way 1: 54321 = 120 sequences.Way 2: P(5,5) = 5! = 120 sequences.
Permutation
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 1025 different ways.
8/19Erwin Sitompul Discrete Mathematics
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:Box 1 can be filled by one of 6 balls (6 choices).Box 2 can be filled by one of 5 balls (5 choices).Box 3 can be filled by one of 4 balls (4 choices).Number of distinct sequences = 654 = 120.
8/20Erwin Sitompul Discrete Mathematics
Permutation r of n
If there are n balls with different colors and r boxes (r n), thenFirst 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)).
8/21Erwin Sitompul Discrete Mathematics
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 r n.
( , ) ( 1) ( 2) ... ( ( 1))P n r n n n n r
!( , )
( )!
nP n r
n r
8/22Erwin Sitompul Discrete Mathematics
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
8/23Erwin Sitompul Discrete Mathematics
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.
8/24Erwin Sitompul Discrete Mathematics
Combination Combination is a specific form of permutation. If in permutation the order matters, then in combination the
order does not matter.
Combination is understood to be a sequence containing elements of a finite set
8/25Erwin Sitompul Discrete Mathematics
r b w
w b
b r w
w r
w r b
b r
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!
Box 1 Box 2 Box 3
Combination
rbw = rwb = brw = bwr = wrb = wbr
8/26Erwin Sitompul Discrete Mathematics
Combination
The number of distinct combinations (that is, without regarding the order) in placing 3 out of 7 balls in 3 boxes is20 = P(6,3)/3! (Check by enumerating!)
A mix of 3 balls with different colors is only counted as 1 one combination only.
8/27Erwin Sitompul Discrete Mathematics
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
!( , ) .
( )! !
nC n r
n r r
( , )C n r can also be written asn
r
Combination of r out of n objects, or C(n,r), is the number of unordered choices of r objects taken out of n.
8/28Erwin Sitompul Discrete Mathematics
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
4 4!(4,3)
3 (4 3)!3!C
4
8/29Erwin Sitompul Discrete Mathematics
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
8/30Erwin Sitompul Discrete Mathematics
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.
8/31Erwin Sitompul Discrete Mathematics
Combination
Solution:(a) Encep is elected.
9!(9,4)
(9 4)!4!C
126
(b) Encep is not elected.
9!(9,5)
(9 5)!5!C
126
(c) Encep is elected but Florina not.
8!(8,4)
(8 4)!4!C
70
8/32Erwin Sitompul Discrete Mathematics
Combination
Solution:(d) Florina is elected but Encep not.
8!(8,4)
(8 4)!4!C
70
(e) Encep and Florina are elected.8!
(8,3)(8 3)!3!
C
56
(f) At least one of them is elected.
(8,4) (8,4) (8,3)C C C 196
Identical to the answer of (c)
Encep elected, Florina
not
Florina elected, Encep
not
Both of them
elected
2 70 56
8/33Erwin Sitompul Discrete Mathematics
Solution:(f) At least one of them is elected.
Combination
Part (f) can also be solved by using Inclusion-Exclusion Principle.
AssumeX = Number of ways to form a representative that
includes Encep,Y = Number of ways to form a representative that
includes Florina,X Y = Number of ways to form a representative that
includes both Encep and Florina. Then X= C(9,4) = 126
Y= C(9,4) = 126XY= C(8,3) = 56XY= X+Y–XY = 126 + 126 – 56 = 196.
8/34Erwin Sitompul Discrete Mathematics
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.
8/35Erwin Sitompul Discrete Mathematics
Homework 8
NewA 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.