Download presentation
Presentation is loading. Please wait.
Published byMarcus McCarthy Modified over 9 years ago
2
THE BASIC OF COUNTING Discrete mathematics KNURE, Software department, Ph. 7021-446, e-mail: belous@kture.Kharkov.ua N.V. Bilous
3
2 From Kharkov to Kiev you can go by bus, by train, and by plane. From Kiev to Lvov you can go by bus and by train. How many variants are there to travel from Kharkov to Lvov? Solution: 3 2=6 Choosing each of 3 variants to travel from Kharkov to Kiev you can choose 2 variants to travel from Kiev to Lvov. Introduction to combinatorics Kharkov Kiev Lvov by bus by train by plane by bus by train
4
3 The basic counting principle If you have to do k tasks and the first task can be done in ways, n 1 the n 2 second in ways, …, and n k - in k ways then all k tasks can be done together in n 1 ·n 2 ·n 3 ·…·n k ways.
5
4 Basic difinitions -set If М is a finite set, which contains n elements, we shall name it as n-set and to write |М| = n. -subset The subset А М, which contains k elements, is named k-subset. linearly ordered The n-set X is named linearly ordered, if each element x has its own number i {1,2,.., n}.
6
5 The sum rule If a first task can be done in n 1 ways and a second in n 2 ways, and if these tasks cannot be done at the same time, then there are n 1 + n 2 to do either task.
7
6 Example Suppose that either a member of the mathematics faculty or a student who is a mathematics major is chosen as a representative to a university committee. How many different choices are there for this representative if there are 37 members of the mathematics faculty and 83 mathematics majors? The first task choosing a member of the mathematics faculty can be done in 37 ways. The second – in 83 ways. So there are 37+83=120 possible ways to pick this representative. The sum rule
8
7 We can extend the sum rule to more than two tasks. Suppose that the tasks T 1, T 2, …,T m can be done in n 1, n 2, …, n m ways, respectively, and no two of this tasks can be done at the same time. Then the number of ways to do one of these tasks is n 1 +n 2 +…+n m The sum rule
9
8 Example Example A student can choose a computer project from one of three lists. The three lists contain 23, 15, and 19 possible projects, respectively. Ho many possible projects are there to choose from? There are 23+15+19=57 projects to choose from. The sum rule
10
9 The product rule Suppose that procedure can be broken down into two tasks. If there are n 1 ways to do the first task and n 2 ways to do the second task after the first task has been done, then there are n 1 ·n 2 ways to do the procedure.
11
10 Example There are 32 microcomputers in a computer center. Each microcomputer has 24 ports. How many different ports to microcomputer are there in the computer center? There are two tasks: first picking a microcomputer and then picking a port on this microcomputer. After the Product rule the quantity of different ports to a microcomputer in the center is: 32·24 = 768 The product rule
12
11 An extended version of the Product rule Suppose that a procedure is carried out by performing the tasks. T 1, T 2, …,T m. If task T 1 can be done in n 1 ways after tasks T 1, T 2, …,T i-1, and have been done, then there are n 1 ·n 2 ·…·n m ways to carry out the procedure. The product rule
13
12 The product rule Example How many different bit strings are there of length seven? Each of the seven bits can be chosen in two ways, since beach bit is either zero or one. So there are: 2 7 =128 different bit strings of length seven.
14
13 Counting subsets of a finite set The number of the different subsets of a finite set S is 2 |S| Proof: Let S be a finite set. List the elements of S in arbitrary order. Recall that there is one-to-one correspondence between subsets of S and bit strings of length |S|. Namely, a subset of S is associated with the bit string with a 1 in the i-th position if the i-th element in the list is in the subset, and a 0 in this position otherwise. By the Product rule, there are 2 |S| bit strings of length |S|. |P(S)|= 2 |S|
15
14 The product rule Example Each user on a computer system has a password, which is six to eight characters long, where each character is an uppercase letter or a digit. Each password must contain at least one digit. How many possible passwords are there? Let P be he total number of possible passwords. By the Sum rule: P=P 6 +P 7 +P 8 By the Product rule: 36 n the number of strings of n characters, 26 n the number of strings with no digits. Hence, P 6 =36 6 -26 6 =1867866560 P 7 =36 7 -26 7 =70332353920 P 8 =36 8 -26 8 =2612282842880 Consequently, P=P 6 +P 7 +P 8 =2684483063360.
16
15 The pigeonhole principle If k+1 or more objects are placed into k boxes, then there is at least one box containing two or more of the objects. There are more Pigeons than Pigeonholes.
17
16 The generalized pigeonhole principle If n objects are placed into k boxes, then there is at least one box containing at least n/k objects. Proof: Suppose that none of the boxes contains more than [N/k]–1 objects. The total number of objects is at most k([n/k]-1)<k(((n/k)+1)-1)=n where the inequality [n/k]<(n/k)+1 has been used.
18
17 The pigeonhole principle Example Among 100 people there are at least [100/12] =9 who were born in the same month.
19
18 Example What is the minimum number of students required in a discrete mathematics class to be sure that at least six will receive the same grade, if there are five possible grades A, B, C, D, and F? The minimum number of students needed to guarantee that at least six students receive the same grade is the smallest integer N such that [N/5]=6. The smallest such integer is N=5·5+1=26. 26 is the minimum number of students needed to be sure that at least six students receive the same grade. The pigeonhole principle
20
19Permutation r-permutation A permutation of a set of n distinct elements is an ordered arrangement of these elements. We also are interested in ordered arrangements by length r from a set with n elements. An ordered arrangement by length r of a set is called an r-permutation.Example М = {1, 2, 3}. –permutation 2–permutation (1,2);(2,1);(1,3);(3,1);(2,3);(3,2); –permutation 3–permutation (1,2,3);(1,3,2);(2,1,3);(2,3,1);(3,1,2);(3,2,1).
21
20Permutation r-permutations The number of r-permutations of a set with n distinct elements is Proof: The first element of the permutation can be chosen in n ways, since there are n elements in the set, there are (n- 1) ways to choose the second element (n-2)-choosing the third, …, and until there exactly n-r+1 ways to choose the r-th element. Using Product rule, there are n (n-1)·(n-2)·…·(n-r+1)r-permutations of the set.
22
21 Factorial notation A compact representation for the multiplication of consecutive integers. We use n! to represent the product n·(n-1)·(n-2)·...·(2)·(1) where n is some positive integer. 0!=1
23
22PermutationExample Almost every morning or evening on the news I hear about the State of Illinois DCFS, the Department of Children and Family Services. I'm confused! How many different 4-letter ordered arrangements, or permutations, exist for the set of letters {D, F, S, C}? Thinking of four positions to fill, __ __ __ __, we have 4 letters to choose from for the first position, 3 for the next, 2 letters for the next position, and 1 choice for the last position. Using the multiplication principle, there are 4·3·2·1=24 different 4-letter ordered arrangements for the set of letters {D, F, S, C}.
24
23PermutationExample How many different ways are there to select 4 different players from 10 players on a team to play four tennis matches, where the matches are ordered? The number of 4-permutations of a set with 10 elements is P(10,4)=10·9·8·7=5040.
25
24 Example A saleswomen has to visit seven different cities. She must begin her trip in a specified city, but she can visit the other seven cities in any order she wishes. How many possible orders can she use when visiting these cities? The number of possible paths between the cities is the number of permutations of seven elements. Consequently, there are 7!=7·6·5·4·3·2·1= 5040 ways for saleswomen to choose her tour.Permutation If r = n then => P(n,n) = n!
26
25 Circular permutation How many ways are there to arrange 5 children at a square and at a round table? If we consider the case when children sit at a square table: After the formula of the n-permutation we have P(5,5) = 5! arrangements.
27
26 Circular permutation Now imagine that these children sit at a circular table : In each of these cases, the same people are sitting next to each other. Although there has been a change— a rotation – about the table, the five children are still in the same positions relative to each other.
28
27 Thus we have 5! unique linear arrangements of the children, but we can group those so each group has 5 arrangements that show the children in the same position relative to each other. Therefore, we have 5!/5=4! circular permutations of the five children. Circular permutation
29
28 A circular permutation is a circular arrangement of elements for which the order of the elements must be taken into account. In general: For n elements, there are (n-1)! circular permutations. The number of circular permutations of r-elements taken from an n-element set is P(n,r)/r. Circular permutation
30
29Combinations r-combination r- combination An r-combination of elements of a set is an unordered selection of r elements from the set. Thus, an r- combination is simply a subset of the set with r elements.Example Let S be the set {1,2,3,4}. 3-combination Then {1,3,4} is a 3-combination from S
31
30Combinations r-combinations The number of r-combinations of a set with n distinct elements is denoted by C(n,r) P(n,r) = C(n,r) P(r,r)
32
31CombinationsExample Let C be the set {a, b, c, d} The number of 2-combinations from C is Six subsets: {a, b}, {a, c}, {a, d}, {b, c}, {b, d}, {c, d}.
33
32Combinations Example The committee which develops a discrete mathematics course is to consist of 3 faculty members from the mathematics department and 4 from the computer science department. There are 9 faculty members from the mathematics department and 11 from the computer science department. How many ways are there to select it? After the Product rule:
34
33Combinations k-combinations The number of k-combinations of elements 1,2..., n, which contains an element 1or does not contain an element 1(after the sum rule): C (n, r) = C (n-1, r) + C (n-1, r-1) Recurrence relation Recurrence relation.
35
34 Binomial coefficient Let n and r be nonnegative integers with r n. Then C(n,r) = C(n, n-r) binomial coefficient. This number is also called a binomial coefficient.
36
35 The binomial theorem Let x and y be variables, and let n be a positive integer
37
36 The binomial theorem Example
38
37 Example What is the coefficient of x 12 y 13 in the expansion of (x+y) 25 ? From the Binomial theorem it follows that this coefficient is The binomial theorem
39
38 Pascal`s triangle Pascal`s identity: Let n and k be positive integers then C(n+1,k)=C(n,k-1)+C(n,k) Pascal`s triangle geometric arrangement of the binomial coefficients 2+1=3
40
39 Pascal’s identity Combinations of 8 out of 20 that do not include 20 are simply the combinations of 8 out of 19, so there are C(19,8). Consider the combinations of 8 in 20 that include 20. Since all these combinations include 20, the only variation comes from the 7 other objects chosen, so there are C(19,7). Therefore C(20,8)=C(19,8)+C(19,7) and, in general C(n, r) = C(n-1, r) + C(n-1, r-1) which is known as Pascal's identity.
41
40 Let n be a possible integer. Then A set with n elements has a total of different subsets. Each subset has either zero elements, one element, …, or n elements in it. There are C(n,0) subsets with zero elements, C(n,1) subsets with one element, …, and С(n,n) subsets with n elements. Hence,Combinations
42
41 Permutations with repetition The number of different permutations of n objects, where there n 1 indistinguishable objects of type 1, n 2 indistinguishable objects of type 2,..., and n k indistinguishable objects of type k, is
43
42 Permutations with repetition Example How many different strings can be made by reordering the letters of the word SUCCESS ? Solution
44
43 Permutations with repetition Example Example How many strings of length n can be formed from the English alphabet? By the Product rule: 26 n stings of length n.
45
44 Permutations with repetition r-permutations The number of r-permutations of a set with n objects with repetition allowed is (n,r)=P((n),r)=nr
46
45 Combinations with repetition r-combinations There are C(n+r–1, r) r-combinations from a set with n elements when repetition of elements is allowed. C(n, r)=C(n+r-1, r)
47
46 Example A cookie shop has four different kinds of cookies. How many different ways can six cookies be chosen? Combinations with repetition
48
47 Combinations with repetition The recurrence formula for
49
48 Combinations and permutations with and without repetition TypeRepetition Allowed? Formula R-permutationsR-combinationsR-permutationsR-combinations No NO Yes nrnr
50
49 Example There are 10 spectators at a ball game and 4 are wearing caps. How many spectators are not wearing caps? Straightforward subtraction yields the result: 10-4=6. There are 6 spectators not wearing caps We have: |T|=10 – the number of all spectators |C|=4 – the property "wearing a cap" So ~C is the property "not wearing a cap." This gives us |~C|=|T|-|C|=10-4=6. The principle of inclusion-exclusion
51
50 The principle of inclusion-exclusion How many positive integers not exceeding 1000 are divisible by 7 or 11? divisible by 7 divisible by 11
52
51 The principle of inclusion-exclusion Let A 1, A 2, …, A n be finite sets.
53
52 The principle of inclusion-exclusion A total of 1232 students have taken a course in Spanish, 879-in French, and 114-in Russian. Further, 103 have taken courses in both Spanish and French, 23-in both Spanish and Russian and 14-in both French and Russian. If 2092 students have taken at least one of Spanish, French, Russian how many students have taken a course in all three languages? Solution There are seven students who have taken courses in Spanish, French, and Russian.
54
53 Discrete probability The probability of an event E, which is a subset of a finite sample space S of equally likely outcomes, is P(E)=|E|/|S|
55
54 Example An urn contains four blue balls and five red balls. What is the probability that a ball chosen from the urn is blue? 9 - possible outcomes 4 - possible outcomes produce blue ball The probability that blue ball is chosen is 4/9. Discrete probability
56
55 There are many lotteries now that award enormous prizes to people who correctly choose a set of six numbers out of the first n positive integers, where n is usually between 30 and 50. What is the probability that a person picks the correct six numbers out of 40? There is only one winning combination. The total number of ways to choose six numbers out of 40 is So the probability of picking the winning ombination is Discrete probability.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.