Download presentation
Presentation is loading. Please wait.
Published byNeal Harrison Modified over 8 years ago
1
Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements of a sublist Sum of numbers from 1 to n Pairs of numbers Possibility Trees & The Multiplication Rule Cartesian Product Subsets of A= {a 1, a 2,…, a n } 3 digit numbers with distinct digits Relations from A to B 3 digit +ve odd integers with distinct digits Symmetric Relations Simple Graphs Click on the picture
2
Combinatorics Counting the number of possible outcomes. Counting the number of ways a task can be done. Sanjay Jain, Lecturer, School of Computing
3
Introduction Sanjay Jain, Lecturer, School of Computing l Multiplication Rule l Examples Click on the picture
4
Combinatorics Counting Probability l To say that a process is random means that when it takes place, one out of a possible set of outcomes will occur. However it is in general impossible to predict with certainty which of the possible outcomes will occur. l A sample space is the set of all possible outcomes of a random experiment.. l An event is a subset of a sample space.
5
Example Tossing two coins. Sample Space: {HH, HT, TH, TT} Event: At least one head: {HH, HT, TH}
6
END OF SEGMENT
7
Equally Likely Probability Formula Suppose S is a sample space in which all outcomes are equally likely. Suppose E is an event in S. Then the probability of E, denoted by Pr(E) is Notation: For a set A, #(A) denotes the number of elements in A. Sometimes n(A) or || A || is also used for #(A). Sometimes Prob(E) or P(E) is also used for Pr(E).
8
Example Consider the process of drawing a card from a pack of cards. What is the probability of drawing an Ace? Assume drawing any card is equally likely. Sample Space: S={SA, S2, S3, …., HA, H2,….}. Event: E={SA, HA, DA, CA} #(S)=52 #(E)=4 Pr(E)=4/52
9
END OF SEGMENT
10
Counting The Elements of A List How many integers are there from 8 through 15? 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8
11
Theorem If m and n are integers and m n then there are n-m+1 integers from m to n (both inclusive). Proof: m m+1 m+2 ………………… n m+0 m+1 m+2 …………………m+(n-m) 1 2 3 ……………… (n-m)+1
12
END OF SEGMENT
13
Counting Elements of a Sublist How many 3 digit positive integers are divisible by 5? 100 105 ………. 995 20*5 21*5 ……… 199*5 20 21 ……….. 199 199 -20+1=180
14
END OF SEGMENT
15
Floors and Ceilings w denotes the largest integer w. For example: 6.9 = 6; -9.2 = -10; 9 = 9 w denotes the smallest integer w. For example: 6.9 =7; -9.2 = -9; 9 = 9
16
END OF SEGMENT
17
Sum of numbers from 1 to n Theorem: 1+2+….+n = n(n+1)/2 Proof We show this by induction on n. For n=1, the above is clearly true. Suppose the theorem holds for n = k. We show the theorem for n = k+1. 1 + 2 + … + k + (k+1) = [k (k + 1) / 2] + (k+1) = (k + 2) ( k + 1) / 2 = (k + 1) (k + 2) / 2
18
END OF SEGMENT
19
Pairs of numbers: How many distinct pairs of numbers (i,j) satisfy the property 1 i < j n? For any i, 1 i < n, the number of j’s which satisfy 1 i < j n, is n - i. Thus, the number of distinct pairs of numbers (i,j) that satisfy the property 1 i < j n is = = =
20
END OF SEGMENT
21
Possibility Trees Coin Toss: 2 ways Toss 2 x 2 ways H T T HH T
22
END OF SEGMENT
23
The Multiplication Rule Theorem: If an operation (or job) consists of k tasks (or steps), T 1, T 2,…, T k, performed one after another and l T 1 can be done in n 1 ways l T 2 can be done in n 2 ways (irrespective of how T 1 is done) l …. l T k can be done in n k ways (irrespective of how T 1... T k-1 are done) Then, the entire operation can be done in n 1 * n 2 * ….* n k ways.
24
The Multiplication Rule Theorem: If an operation (or job) consists of k tasks (or steps), T 1, T 2,…, T k, performed one after another and T i can be done in n i ways (irrespective of how T 1... T i-1 are done) Caution: Note the independence assumption. One cannot use the multiplication rule unless the independence assumption holds.
25
END OF SEGMENT
26
Cartesian Product How many elements are there in A x B? A= {a 1, a 2,…., a n } B= {b 1, b 2,…., b m } Recall: A X B = {(a,b) : a A and b B}.
27
Cartesian Product Job: select an element of A X B. l T 1 : Select an element a of A l T 2 : Select an element b of B n (this gives us an element (a,b) of A X B) l T 1 can be done in n ways l T 2 can be done in m ways (irrespective of how T 1 is done) by the multiplication rule, the job can be done in n*m ways. The number of elements of A x B is n*m
28
END OF SEGMENT
29
Subsets of A= {a 1, a 2,…, a n } How many subsets of A={a 1, a 2,…, a n } are there? Job: select a subset of A. l T 1 : either select or not select a 1 l T 2 : either select or not select a 2 l …. l T n : either select or not select a n Each of these tasks can be done in two ways (irrespective of how the earlier tasks are done). Thus the number of ways of doing the job is 2 n. Therefore, the number of subsets of A is 2 n.
30
END OF SEGMENT
31
3 digit numbers with distinct digits How many 3 digit numbers with distinct digits are there?
32
3 digit numbers with distinct digits How many 3 digit numbers with distinct digits are there? l T 1 : Select the hundred’s digit l T 2 : Select the ten’s digit l T 3 : Select the unit’s digit
33
3 digit numbers with distinct digits How many 3 digit numbers with distinct digits are there? l T 1 : Select the hundred’s digit l T 1 can be done in 9 ways (digit 0 cannot be selected)
34
3 digit numbers with distinct digits How many 3 digit numbers with distinct digits are there? l T 2 : Select the ten’s digit l T 2 can be done in 9 ways (irrespective of how T 1 was done). You cannot select the digit chosen in T 1
35
3 digit numbers with distinct digits How many 3 digit numbers with distinct digits are there? l T 3 : Select the unit’s digit l T 3 can be done in 8 ways (irrespective of how earlier tasks were done). You cannot select the digit chosen in T 1 and T 2
36
3 digit numbers with distinct digits How many 3 digit numbers with distinct digits are there? l T 1 can be done in 9 ways l T 2 can be done in 9 ways l T 3 can be done in 8 ways Therefore, the total number of 3 digit numbers with distinct digits are 9*9*8
37
END OF SEGMENT
38
Relations From A to B How many different relations are there from A to B? A={a 1, a 2,…., a n }, B={b 1, b 2,…., b m } T (i,j) : select or not select (a i,a j ) as a member of R. (1 i n and 1 j m) Note that the total number of tasks is n*m. Each T (i,j) can be done in 2 ways. Thus all the tasks can be done in 2 n*m ways Total number of relations is: 2 n*m
39
Relations From A to B Another Method: A relation is a subset of A X B. Number of elements in A X B = n*m number of subsets of A X B = 2 n*m How many different relations are there from A to B? A={a 1, a 2,…., a n }, B={b 1, b 2,…., b m }
40
END OF SEGMENT
41
Be careful in using the Multiplication Rule How many 3 digit +ve odd integers have distinct digits? l T 1 : Select the hundred’s digit l T 2 : Select the ten’s digit l T 3 : Select the unit’s digit
42
3 digit +ve odd integers How many 3 digit +ve odd integers have distinct digits? l T 1 : Select the hundred’s digit l T 1 can be done in 9 ways
43
3 digit +ve odd integers How many 3 digit +ve odd integers have distinct digits? l T 2 : Select the ten’s digit T 2 can be done in 9 ways (irrespective of how T 1 was done). You cannot select the digit chosen in T 1
44
3 digit +ve odd integers How many 3 digit +ve odd integers have distinct digits? l T 3 : Select the unit’s digit l T 3 can be done in ? ways (the number of ways is either 3 or 4 or 5 depending on how exactly T 1 and T 2 were done).
45
3 digit +ve odd integers How many 3 digit +ve odd integers have distinct digits? l T 1 can be done in 9 ways l T 2 can be done in 9 ways l T 3 can be done in ? ways Therefore, the Multiplication Rule may not always be applicable. However, for this problem one can use the Multiplication Rule by reordering tasks.
46
3 digit +ve odd integers How many 3 digit +ve odd integers have distinct digits? (reordering tasks) l T 1 : Select the unit’s digit l T 2 : Select the hundred’s digit l T 3 : Select the ten’s digit
47
3 digit +ve odd integers How many 3 digit +ve odd integers have distinct digits? (reordering tasks) l T 1 : Select the unit’s digit l T 1 can be done in 5 ways
48
3 digit +ve odd integers How many 3 digit +ve odd integers have distinct digits? (reordering tasks) l T 2 : Select the hundred’s digit l T 2 can be done in 8 ways (irrespective of how T 1 was done).
49
3 digit +ve odd integers How many 3 digit +ve odd integers have distinct digits? (reordering tasks) l T 3 : Select the ten’s digit l T 3 can be done in 8 ways (irrespective of how T 1 and T 2 are done).
50
3 digit +ve odd integers How many 3 digit +ve odd integers have distinct digits? (reordering tasks) l T 1 can be done in 5 ways l T 2 can be done in 8 ways l T 3 can be done in 8 ways Therefore, the total number of 3 digit +ve odd integers with distinct digits is 5*8*8
51
END OF SEGMENT
52
Symmetric Relations Suppose A ={a 1,a 2,…,a n }. How many symmetric relations can be defined on A? We will show that it is 2 n(n+1)/2 Recall: for a relation to be symmetric, for each i, j, either both (a i,a j ) and (a j,a i ) are in R or both are not in R. Divide the job of selecting a symmetric relation R into the following tasks. S i (for 1 i n) Either select or not select (a i,a i ) in R T (i,j) (for 1 i < j n) Either select or not select both (a i,a j ) and (a j,a i ) in R Note that the number of different T (i,j) 's are (n-1)n/2
53
Symmetric Relations S i (for 1 i n) Either select or not select (a i,a i ) in R T (i,j) (for 1 i<j n) Either select or not select both (a i,a j ) and (a j,a i ) in R Each S i and T (i,j) can be done in exactly 2 ways. Thus the total number of symmetric relations on A are (2*2*…*2) * (2*2*….*2) (there are n 2’s in the first group, and ((n-1)n/2) 2’s in the second group) =2 n *2 n(n-1)/2 =2 n(n+1)/2
54
END OF SEGMENT
55
Simple Graphs How many simple undirected graphs are there with n vertices? This is similar to symmetric relations except that S i ’s are not there. T (i,j) (for 1 i < j n) Either select or not select the edge {v i,v j } (= {v j,v i }) Note that the number of different T (i,j) 's are (n-1)n/2 Each T (i,j) can be done in exactly 2 ways. Thus the total number of simple graphs is 2*2*….*2 (there are ((n-1)n/2) 2’s ) =2 n(n-1)/2
56
END OF SEGMENT
57
Summary l Multiplication Rule l Remember the conditions under which multiplication rule is applicable, specially note the independence assumption Click on the picture
58
Follow-Up l Explain assignments. l List books, articles, electronic sources. l If appropriate, give an introduction to the next lecture in the series. Click on the picture
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.