580 likes | 707 Views
Click on the picture. 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
E N D
Click on the picture 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= {a1, a2,…, an} 3 digit numbers with distinct digits Relations from A to B 3 digit +ve odd integers with distinct digits Symmetric Relations Simple Graphs
Combinatorics Counting the number of possible outcomes. Counting the number of ways a task can be done. Sanjay Jain, Lecturer, School of Computing
Click on the picture Introduction • Multiplication Rule • Examples Sanjay Jain, Lecturer, School of Computing
Counting Probability 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. A sample space is the set of all possible outcomes of a random experiment. An event is a subset of a sample space. Combinatorics
Tossing two coins. Sample Space: {HH, HT, TH, TT} Event: At least one head: {HH, HT, TH} Example
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 Equally Likely Probability Formula 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).
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 Example
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 Counting The Elements of A List
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 Theorem
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 Counting Elements of a Sublist
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 Floors and Ceilings
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 Sum of numbers from 1 to n
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 Pairs of numbers: = = =
Coin Toss: T H H H T T Possibility Trees Toss 2 ways 2 x 2 ways
Theorem: If an operation (or job) consists of k tasks (or steps), T1, T2,…, Tk, performed one after another and The Multiplication Rule • T1 can be done in n1 ways • T2 can be done in n2 ways (irrespective of how T1 is done) • …. • Tk can be done in nk ways (irrespective of how T1 ... Tk-1 are done) Then, the entire operation can be done in n1* n2* ….* nk ways.
Theorem: If an operation (or job) consists of k tasks (or steps), T1, T2,…, Tk, performed one after another and The Multiplication Rule Ti can be done in ni ways (irrespective of how T1 ... Ti-1 are done) Caution:Note the independence assumption. One cannot use the multiplication rule unless the independence assumption holds.
Cartesian Product How many elements are there in A x B? A= {a1, a2,…., an} B= {b1, b2,…., bm} Recall: A X B = {(a,b) : a A and b B}.
Cartesian Product Job: select an element of A X B. • T1: Select an element a of A • T2: Select an element b of B • (this gives us an element (a,b) of A X B) • T1 can be done in n ways • T2 can be done in m ways (irrespective of how T1 is done) by the multiplication rule, the job can be done in n*mways. The number of elements of A x B is n*m
Subsets of A= {a1, a2,…, an} How many subsets of A={a1, a2,…, an} are there? Job: select a subset of A. • T1: either select or not select a1 • T2: either select or not select a2 • …. • Tn: either select or not select an 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 2n. Therefore, the number of subsets of A is 2n.
3 digit numbers with distinct digits How many 3 digit numbers with distinct digits are there?
3 digit numbers with distinct digits How many 3 digit numbers with distinct digits are there? • T1: Select the hundred’s digit • T2: Select the ten’s digit • T3: Select the unit’s digit
3 digit numbers with distinct digits How many 3 digit numbers with distinct digits are there? • T1: Select the hundred’s digit • T1 can be done in 9 ways (digit 0 cannot be selected)
3 digit numbers with distinct digits How many 3 digit numbers with distinct digits are there? • T2: Select the ten’s digit • T2 can be done in 9 ways (irrespective of how T1 was done). You cannot select the digit chosen in T1
3 digit numbers with distinct digits How many 3 digit numbers with distinct digits are there? • T3: Select the unit’s digit • T3 can be done in 8 ways (irrespective of how earlier tasks were done). You cannot select the digit chosen in T1 and T2
3 digit numbers with distinct digits How many 3 digit numbers with distinct digits are there? • T1 can be done in 9 ways • T2 can be done in 9 ways • T3 can be done in 8 ways Therefore, the total number of 3 digit numbers with distinct digits are 9*9*8
How many different relations are there from A to B? A={a1, a2,…., an}, B={b1, b2,…., bm} T(i,j) : select or not select (ai,aj) 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 2n*m ways Total number of relations is: 2n*m 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 = 2n*m Relations From A to B How many different relations are there from A to B? A={a1, a2,…., an}, B={b1, b2,…., bm}
Be careful in using the Multiplication Rule How many 3 digit +ve odd integers have distinct digits? • T1: Select the hundred’s digit • T2: Select the ten’s digit • T3: Select the unit’s digit
3 digit +ve odd integers How many 3 digit +ve odd integers have distinct digits? • T1: Select the hundred’s digit • T1 can be done in 9 ways
3 digit +ve odd integers How many 3 digit +ve odd integers have distinct digits? • T2: Select the ten’s digit • T2 can be done in 9 ways (irrespective of how T1 was done). You cannot select the digit chosen in T1
3 digit +ve odd integers How many 3 digit +ve odd integers have distinct digits? • T3: Select the unit’s digit • T3 can be done in ? ways (the number of ways is either 3 or 4 or 5 depending on how exactly T1 and T2 were done).
3 digit +ve odd integers How many 3 digit +ve odd integers have distinct digits? • T1 can be done in 9 ways • T2 can be done in 9 ways • T3 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.
3 digit +ve odd integers How many 3 digit +ve odd integers have distinct digits? (reordering tasks) • T1: Select the unit’s digit • T2: Select the hundred’s digit • T3: Select the ten’s digit
3 digit +ve odd integers How many 3 digit +ve odd integers have distinct digits? (reordering tasks) • T1: Select the unit’s digit • T1 can be done in 5 ways
3 digit +ve odd integers How many 3 digit +ve odd integers have distinct digits? (reordering tasks) • T2: Select the hundred’s digit • T2 can be done in 8 ways (irrespective of how T1 was done).
3 digit +ve odd integers How many 3 digit +ve odd integers have distinct digits? (reordering tasks) • T3: Select the ten’s digit • T3 can be done in 8 ways (irrespective of how T1 and T2 are done).
3 digit +ve odd integers How many 3 digit +ve odd integers have distinct digits? (reordering tasks) • T1 can be done in 5 ways • T2 can be done in 8 ways • T3 can be done in 8 ways Therefore, the total number of 3 digit +ve odd integers with distinct digits is 5*8*8