Presentation is loading. Please wait.

Presentation is loading. Please wait.

Counting and probability What do you mean by counting? How do you count things in daily life? Counting the European way or the English speaking way?

Similar presentations


Presentation on theme: "Counting and probability What do you mean by counting? How do you count things in daily life? Counting the European way or the English speaking way?"— Presentation transcript:

1

2 Counting and probability

3 What do you mean by counting? How do you count things in daily life? Counting the European way or the English speaking way? 8 days a week (not the Beatles song)?

4 1.1 Linear Series Rule. If m and n are integers such that m  n, then there are n- m+1 integers from m to n inclusive. 1.1 Linear Series Rule. Example 1: How many integers are there in the sequence 10, 11, 12, …, 19, 20 ? Example 2: How many integers are there in the sequence -8,-7,- 6,…-1,0,1,2,…4, 5 ? Example 3: How many integers are there in 0 to 1000 inclusive, that are divisible by 3.

5 1.1 Linear Series Rule. If m and n are integers such that m  n, then there are n- m+1 integers from m to n inclusive. 1.1 Linear Series Rule. Example 1: How many integers are there in the sequence 10, 11, 12, …, 19, 20 ? Ans: 20 – 10 + 1 = 11 Example 2: How many integers are there in the sequence -8,-7,- 6,…-1,0,1,2,…4, 5 ? Ans: 5 – (–8) + 1 = 14 Example 3: How many integers are there in 0 to 1000 inclusive, that are divisible by 3. The integers are 0,3,6,9,…,996,999, which are in the form 3k, where k = 0,1,2,…,333. Hence there are 333-0+1 = 334 integers from 0 to 1000 which are divisible by 3.

6 What is Probability? A coin has a 50% chance of landing heads. What does that mean? The coin will land heads 50% of the time? not really. The coin will land heads approximately 50% of the time? Then the probability is approximately 50%, not exactly 50%. It means that the fraction of the time that the coin lands heads will get arbitrarily close to 50% as the number of coin tosses increases without bound.

7 The Sample Space An experiment is a procedure that leads to an outcome. Toss a coin. We observe a characteristic of the outcome. Which side landed up? The sample space is the set of all possible observations/ outcomes. Sample space = {H, T} An event is a collection of possible observations, i.e., a subset of the sample space. E(H) = 1 A sample space is the set of all possible outcomes of a random process or experiment. An event is a subset of a sample space.

8 Some points to ponder. The processes are random, i.e. some set of outcomes is sure to occur but it is impossible to predict with certainty which one. We will consider only finite sample spaces. The probability of an event is the sum of the probabilities of its individual members. If the members of the sample space are equally likely, then P(E) = |E|/|S|. If the n members of the sample space are equally likely, then the probability of each member is 1/n. Examples Toss a coin, P(H) = 1/2. Roll a die, P(3) = 1/6.

9 Possibility Trees and the Multiplication Rule

10 Often, an experiment may be viewed as a sequence of simple procedures, or sub-experiments. An outcome of the experiment will be a sequence of outcomes of the sub-experiments. To analyze the experiment, we should first analyze the sub- experiments. Draw three cards, with replacement, from a shuffled deck  1 st sub-experiment: Draw the 1 st card.  2 nd sub-experiment: Draw the 2 nd card.  3 rd sub-experiment: Draw the 3 rd card. What is the sample space? Are the outcomes equally likely? What if we drew without replacement?

11 A possibility tree Starts at a root. Has one level for each sub-experiment. At each level, shows a set of branches for all the possibilities (sample space) of that sub-experiment. If sub-experiment #1 has m possible outcomes and sub-experiment #2 has n possible outcomes (no matter how sub-experiment #1 turned out), then the two sub-experiments in sequence have mn possible outcomes. Multiplication Rule If an operation consists of a sequence of steps/events E 1, E 2 … E k and if each E i can be performed in n i ways regardless of how the previous steps E 1, … E i-1 were performed (i.e. independent), then the entire operation can be performed in n 1 ´n 2 ´…´n k ways.

12  Examples  Toss 5 coins: 2  2  2  2  2 = 32 possibilities  Roll 3 dice: 6  6  6 = 216 possibilities  Draw 5 cards (without replacement): 52  51  50  49  48 = 311,875,200 possibilities Example 1:What is the maximum number of possible 3-letter English words with the pattern consonant-vowel-consonant? Example 2: How many odd numbers greater than 3000 can be formed by using each of the digits 1, 2, 3, and 4 once? Example 3: A car license plate has 3 letters of alphabet followed by 4 single digit numbers. How many different car licenses can be issued (a) if repetitions of alphabets/numbers in the license plate is allowed; (b) if repetitions are not allowed? Example 4: (Limitations of the Multiplication Rule) Two teams A and B are to play each other repeatedly until one wins two games in a row, or until a total of 3 games. How many ways can a tournament be played?

13 Why do the rules of multiplication not apply here? A winsB wins A winsB wins A winsB wins A winsB wins A winsB wins

14 Example 5: Three officers – A president, a treasurer, and a secretary, are to be chosen from among 4 people: A, B, C, D. Suppose that A cannot be president, and either C or D must be secretary. How many ways can the officers be chosen? Selecting three officers can be broken down to the following tasks: Step 1: Select the president : 3 ways. Step 2: Select the treasurer : 3 ways. Step 3: Select the secretary : 2 ways. Total number of performing the task = 3.3.2 ways

15 Example 5: Three officers – A president, a treasurer, and a secretary, are to be chosen from among 4 people: A, B, C, D. Suppose that A cannot be president, and either C or D must be secretary. How many ways can the officers be chosen? Goal Re-ordering is a possible way to by-pass dependency of tasks 1.Select the president: 3 ways 2.Select the treasurer: number of ways DEPENDENT on the outcome of step 1!!! 3.Select the secretary: number of ways DEPENDENT on the outcome of step 2, which is in turn, DEPENDENT on step 1. C D A A B A B D C D C D D C C start B C D

16 (Goal Re-ordering is a possible way to by-pass dependency of tasks) Step 1: Select the secretary : 2 ways (C or D). Step 2: Select the president : 2 ways regardless of the choice taken in step 1 (person B with the remaining person from step 1) Step 3: Select the treasurer : 2 ways. (person A with the person remaining from step 2) Total number of performing the task = 2 * 2 * 2 ways C D A A B A B D C D C D D C C start B C D

17 Each step is independent of the choices of previous step. The number of ways of each step is independent of the choices of the previous step

18 Permutations

19 A permutation of the elements of a set is an ordering of those elements. Distinct orderings are distinct permutations. The permutations of {a, b, c} are abc, acb, bac, bca, cab, and cba. 1.a permutation of a set S of n distinct objects is an ordered list of these objects 2.an r-permutation is an ordered list of r elements of S S={1,2,3}, all permutations={(1,2,3),(2,1,3),(1,3,2),(2,3,1),(3,1,2),(3,2,1)} all 2-permutations={(1,2),(2,1),(1,3),(3,1),(2,3),(3,2)} 3.the number of r-permutations of a set S with n elements is written as P(n,r). 4.If n and r are integers such that, then P(n,r) = n*(n-1)*(n-2)*...*(n-r+1) = n!/(n-r)! 5.P(n,n) = n! / (n-n)! = n!

20 6. CIRCULAR PERMUTATIONS –The number of ways of permuting r objects from a set of n objects in a circle (in which two arrangements are the same when one is a rotation of the other) is P(n,r) / r. 1. How many different ways can a salesman visit 8 cities? 2. How many different ways can 10 horses in a race win, place and show (come in first, second, third)?

21 Addition and Difference rule Theorem: Let {A 1, …, A n } be a partition of a set A. Then |A| = |A 1 | + … + |A n |. Corollary: Let {A 1, …, A n } be a collection of pair wise disjoint finite sets. Then |A 1  …  A n | = |A 1 | + … + |A n |.

22 Addition Rule: If a finite set A = A 1  A 2  A n where all the A i ’s are mutually disjoint, then |A| = |A 1 | + |A 2 | +  + |A n | Difference Rule: If A is a finite set and B  A, then |A – B| = |A| – |B|

23 Example 1: A computer access code word consists of one to three letters, chosen from the 26 alphabets, with repetitions allowed. How many code words are possible? Set of all code words of length  3 Set of all code words of length 1 Set of all code words of length 2 Set of all code words of length 3 By addition rule: |Set of all code words of length  3 | = | Set of all code words of length 1 | + | Set of all code words of length 2 | + | Set of all code words of length 3 |

24 Example 1: A computer access code word consists of one to three letters, chosen from the 26 alphabets, with repetitions allowed. How many code words are possible? Set of all code words of length  3 Set of all code words of length 1 Set of all code words of length 2 Set of all code words of length 3 Number of code words of length 1 = 26 Number of code words of length 2 = 26 2 (Multiplication Rule) Number of code words of length 3 = 26 3 (Multiplication Rule) Total number of code words = 26 + 26 2 + 26 3 (Addition Rule)

25 Basic Rules: Addition/Difference Rule Example 2: There are 15 different computer science books, 12 different math books, and 10 different chemistry books on the shelf. How many ways can we select 2 books, each from a different subject? By addition rule: |Set of selections of 2 books| = | Set of selection of 1 book from CS and 1 book from Math | + | Set of selection of 1 book from CS and 1 book from Chem | + | Set of selection of 1 book from Math and 1 book from Chem | Set of selections of 2 books 1 book from CS and 1 book Math 1 book from CS and 1 book from Chemistry 1 book from Math and 1 book from Chemistry

26 Example 2: There are 15 different computer science books, 12 different math books, and 10 different chemistry books on the shelf. How many ways can we select 2 books, each from a different subject? Set of selections of 2 books 1 book from CS and 1 book Math 1 book from CS and 1 book from Chemistry 1 book from Math and 1 book from Chemistry 15  12 (M.R.) 15  10 (M.R.) 12  10 (M.R.) ++

27 Basic Rules: Addition/Difference Rule Example 3: A group of eight people are attending the movies together. If two of the eight people are enemies and do not want to sit next to each other, how many ways can this group sit in a row, such that the two enemies are separated? Answer: Different arrangements of 8 people in a row = 8! (by multiplicaton rule) How? Step 1: Sit the 1 st person: 8 ways Step 2: Sit the 2 nd person: 7 ways regardless of outcome of step 1. Step 3: Sit the 3 rd person: 6 ways regardless of outcome of step 1-2. … Different arrangements of 8 people in a row where the 2 enemies sit next to each other Different arrangements of 8 people in a row where the 2 enemies sit apart

28 Basic Rules: Addition/Difference Rule Example 3: A group of eight people are attending the movies together. If two of the eight people are enemies and do not want to sit next to each other, how many ways can this group sit in a row, such that the two enemies are separated? Answer: Different arrangements of 8 people in a row = 8! Different arrangements of 8 people in a row where the 2 enemies sit next to each other Different arrangements of 8 people in a row where the 2 enemies sit apart = 2*7 ! (by multiplicaton rule) How? Step 1: Sit the 2 enemies together: 2*7 ways Step 2-7: Sit the remaining 6 people: 6*5*4*3*2*1 Step 1: Combine the 2 enemies as 1 person and take it as an arrangement of 7 people to 7 chairs, (7!). Step 2: Different ways of arranging the 2 enemies to sit side-by-side: 2 ways. OR… Another way of looking at it:

29 Basic Rules: Addition/Difference Rule Example 3: A group of eight people are attending the movies together. If two of the eight people are enemies and do not want to sit next to each other, how many ways can this group sit in a row, such that the two enemies are separated? Answer: Different arrangements of 8 people in a row = 8! Different arrangements of 8 people in a row where the 2 enemies sit next to each other Different arrangements of 8 people in a row where the 2 enemies sit apart = 2*7! (by multiplicaton rule) Answer = 8! – 2*7! (Difference Rule)

30 Basic Rules: Addition/Difference Rule Example 4: How many integers are there in 1000 to 9999 that contain at least a digit 5. Answer =(Number of integers in 1000 to 9999) – (Number of integers in 1000 to 9999 that do not contain a digit 5) (Difference Rule) =(9999 – 1000 + 1) – 8.9 3 (Linear Series Rule) (Multiplication Rule) =3168 If S is a finite sample space and A is an event in S, then Page 298 example 6.3.3

31 Basic Rules: Addition/Difference Rule Example 5: How many 3 digit numbers have at least one digit repeated? Answer =Number of 3 digit numbers– Number of 3 digit numbers which have NO digit repeated (Difference Rule) (9 *10 *10) Multiplication Rule: Step 1: Choose hundredths digit(must exclude leading ‘0’, therefore only 9 ways) Step 2: Choose tenths digit Step 3: Choose units digit (9 *9 *8) Multiplication Rule: Step 1: Choose hundreths digit (must exlude leading ‘0’) Step 2: Choose tenths digit (10 ways, excluding the digit in step 1. Therefore 9 ways) Step 3: Choose units digit

32 Basic Rules: Inclusion-Exclusion Rule

33 1.4Inclusion-Exclusion Rule: (For 2 sets) Given any sets A and B, |A  B| = |A| + |B| – |A  B| (For 3 sets) Given any sets A, B and C, |A  B  C | = |A| + |B| + |C| – |A  B| – |A  C| – |B  C| + |A  B  C| (For n sets) Given any sets A 1 … A n, | A 1  …  A n | = | A i | – | A i  A j | + | A i  A j  A k | –… The pattern is to add “one at a time”, subtract “two at a time”, and add “three at a time” and so on.

34 Basic Rules: Inclusion-Exclusion Rule Example 1: How many integers from 1 through 1000 are multiples of 3 or 5? How many are neither multiples of 3 nor 5? Answer: |{Integers of multiples of 3 or 5}| = |{Integers of multiples of 3}| + |{Integers of multiples of 5}| – |{Integers of multiples of 3 and 5}| (Inclusion-Exclusion Rule) All integers fom 1 to 1000 Multiples of 5 Multiples of 3

35 Basic Rules: Inclusion-Exclusion Rule Example 1: How many integers from 1 through 1000 are multiples of 3 or 5? How many are neither multiples of 3 nor 5? Answer: |{Integers of multiples of 3 or 5}| = |{Integers of multiples of 3}| + |{Integers of multiples of 5}| – |{Integers of multiples of 3 and 5}| (Inclusion-Exclusion Rule) |{Integers of multiples of 3}| = |{3k | where k = 1,2,…333}| = 333 |{Integers of multiples of 5}| = |{5k | where k = 1,2,…200}| = 200 |{Integers of multiples of 3 and 5}| = |{15k | where k = 1,2,…66}| = 66 Ans = 333 + 200 – 66= 467

36 Basic Rules: Inclusion-Exclusion Rule Example 1: How many integers from 1 through 1000 are multiples of 3 or 5? How many are neither multiples of 3 nor 5? Question: How many are neither multiples of 3 nor 5? Answer: {Int from 1..1000} -{Int from 1..1000 with are multiples of 3 or 5} Ans= 1000-467 (By difference rule) = 533 1000 467 How many primes are there between 1 and 100? The non-primes must be multiples of 2, 3, 5, or 7, since the square root of 100 is 10.

37 Counting subsets of a Set: Combinations

38 Definition: –An r-combination of a set of n elements is a subset of r elements taken from the set of n elements ( ). Notation: –The number of r-permutations of a set of n elements is denoted as C(n,r), also as and Note: A combination is an unordered selection: you are selecting a ‘set’, and ordering is not important in sets.

39 Theorem: The number of r-combinations of a set of n elements is C(n, r) = n!/[r!(n – r)!]. Corollary: For all n  0 and 0  r  n, P(n, r) = r!  C(n, r). Calculator tools Example 1: You are to select five members from a group of twelve to form a team. (a) How many distinct five-person teams can be selected? (b) If two of them insist on working together as a pair, such that any team must either contain both of neither. How many five person teams can be formed? Answer: (a) C(12,5) All 5-person teams satisfying the ‘2-friends’ constraint. Those teams which involve the 2 ‘friends’ Those teams which do not involve the 2 ‘friends’ C(10,3) C(10,5)

40 1’st version using addition rule Those teams which contain A but not B All 5-person teams that do not contain the two enemies, say A and B Those teams which contain B but not A Those teams which do not contain A nor B Step 1: select the A: 1 way Step 2: select the remaining people except B: C(10,4) C(10,4) C(10,5) ++ Example 2 You are to select five members from a group of twelve to form a team. If two of them insist on working apart,how many five person teams can be formed?

41 Example 2 You are to select five members from a group of twelve to form a team. If two of them insist on working apart,how many five person teams can be formed? All 5-person teams Those teams with the two enemies together Those teams with the two enemies apart C(12,5) Ans: C(12,5) – C(10,3) Step 1: select the two enemies: 1 way Step 2: select the remaining 3 people: C(10,3) C(10,3) 2’nd version

42 Example : A group of twelve consists of five men and seven women. (a) How many five-person teams can be chosen that consists of three men and two women? (b) How many five-person teams contain at least one man? (c) How many five-person teams contain at most one man? (a)Answer: Step 1: choose the men: C(5,3) ways Step 2: choose the women: C(7,2) ways (regardless of the choices made in step 1) Multiplication rule: C(5,3) x C(7,2) (b)Answer: Number of 5-person teams that contain at least one man = Number of 5-person teams – Number of 5-person teams that do not contain any men (all women). (DIFFERENCE RULE) = C(12,5) – C(7,5)

43 (c)Answer: Number of 5-person teams that contain at most one man = Number of 5-person teams that contain no men + Number of 5-person teams that contain 1 man (BY ADDITION RULE) = (C(5,0) x C(7,5)) Step 1: Choose 0 men from 5 men Step 1: Choose 5 women from 7 women + (C(5,1) x C(7,4))Step 1: Choose 1 man from 5 men Step 2: choose 4 women from 7 women Example 4: 10 people are to sit around two round tables. The first table has 6 chairs, the second table has 4 chairs. (a) How many ways can this be done? (b) How many ways can this be done if two of them need to sit together?

44 (a)Answer (version#1): Step 1: Choose 6 people to sit on the first table C(10,6) Step 2: Arrange the 6 people on the first table 5! (Circular Permutation) Step 3: Arrange the remaining 4 on the second table. 3! (Circular Permutation) (BY MULTIPLICATION RULE) = C(10,6) x 5! x 3! = 10!/24 (a)Answer (version#2): Step 1: Permute 6 people from 10 circularly around the first table P(10,6)/6 Step 2: Arrange the remaining 4 on the second table. 3! (Circular Permutation) (BY MULTIPLICATION RULE) = P(10,6)/6 x 3! = 10!/24

45 (b)Answer (version#1): BY ADDITION RULE Number of sitting arrangements where the two sit on the 1 st table + Number of sitting arrangements where the two sit on the 2 nd table BY MULTIPLICATION RULE Step 1: Put the two on the first table: 1 way Step 2: Select 4 more to join them: C(8,4) Step 3: Permute them around the table : 5! Step 4: Permute the remaining 4 circularly on 2 nd table: 3! BY MULTIPLICATION RULE Step 1: Put the two on the second table: 1 way Step 2: Select 2 more to join them: C(8,2) Step 3: Permute them around the table: 3! Step 4: Permute remaining 6 circularly on 1 st table: 5! = (C(8,4)x5!x3!) + (C(8,2)x3!x 5!) Example 4: 10 people are to sit around two round tables. The first table has 6 chairs, the second table has 4 chairs. (a) How many ways can this be done? (b) How many ways can this be done if two of them need to sit together?

46 (b)Answer (version#2): BY ADDITION RULE Number of sitting arrangements where the two sit on the 1 st table + Number of sitting arrangements where the two sit on the 2 nd table BY MULTIPLICATION RULE Step 1: Put the two on the first table: 1 way Step 2: Permute 4 from 8 circularly on the 2 nd table: P(8,4)/4 Step 3: Permute the 6 circularly on 1 st table: 5! BY MULTIPLICATION RULE Step 1: Put the two on the second table: 1 way Step 2: Permute 6 from 8 circularly on the 1 st table: P(8,6)/6 Step 3: Permute remaining 4 circularly on 2 nd table: 3! = (P(8,4)/4 x 5!) + (P(8,6)/6 x 3!)

47 Permutations of Sets with Repeated ElementsTheorem: Suppose a set contains n 1 indistinguishable elements of one type, n 2 indistinguishable elements of one type, and so on, through k types, where n 1 + n 2 + … + n k = n. Then the number of (distinguishable) permutations of the n elements is n!/(n 1 !n 2 !…n k !). How many eight-bit strings have exactly three 1’s? 12335678 1.Choose a subset of 3 positions out of 8 to contain 1’s. Once 1. Above has been chosen the remaining Positions are filled with 0’s. C(8, 5) ways 1 way

48 How many different numbers can be formed by permuting the digits of the number How many permutations are there of the letters in the word MISSISSIPPI? IIMSSPISSIP, ISSSPMIIPIS, PIMISSSSIIP and so on. 11!/(4!4!2!1!) = 34650 444556? 6!/(3!2!1!) = 720/(6  2  1) = 60.

49 R-Combinations with repetitions allowed

50 A multiset is a set, except that repetitions are allowed. For example, {1, 1, 2, 2, 2, 3, 4} is a multiset. An r-combination with repetitions allowed of a set of n elements is a multiset of r objects, with each member taken from the set of n elements. Definition (r-combinations from a multi-set): Given a set X of n objects, an r-combination with repetition allowed (or r- combination with a multi-set of size r) is an unordered selection of elements taken from X with repetition allowed. Theorem: The number of r-combination with repetition allowed drawn from a set of n elements is C(r+n–1, r). Example: 3-combinations from a set {a,b,c,d} –[a,a,a]; [a,a,b]; [a,a,c]; [a,a,d] –[a,b,b]; [a,b,c]; [a,b,d]; Total Number = 20 = C(3+4-1, 3) –[a,c,c]; [a,c,d]; [a,d,d]; –[b,b,b]; [b,b,c]; [b,b,d]; –[b,c,c]; [b,c,d]; [b,d,d]; –[c,c,c]; [c,c,d]; [c,d,d]; –[d,d,d]

51 Category aCategory bCategory cCategory d [a,a,a]X X X [a,a,b]X X [a,b,d] XX X [a,c,d] XX X [b,c,c] X X [a,a,a] [a,a,b] [a,b,d] [a,c,d] [b,c,c] Selection X X X | | | X X | X | | X | X | | X X | | X | X | X | X X | Represented by: Problem generalized: r -combination = putting r crosses From a set of n elements = putting n-1 ‘|’s in between crosses. Reduces to the same problem of assigning 2-bits (X and |) to r+n-1 positions. (Permuting r+n-1 positions from a multi-set of {X,|}

52 Roll three dice. How many different possible combinations are there? (Order does not matter.) n = 6, r = 3. C(n + r – 1, r) = C(8, 3) = 56. Are the 56 different combinations equally likely?

53 Example 1: A person giving a party wants to set out 15 assorted cans of soft drinks for his guests. He shops at a store that sells 5 different types of soft drinks (a) How many different selections of cans of 15 soft drinks can he make? (b) If root beer is one of the types of soft drinks, how many different selections include at least 6 cans of root beer? Answer: (a)15-combination (15 drinks) from a multi-set of 5 categories –r = 15 drinks = 15 crosses –n = 5 categories: need 4 ‘|’ to separate the crosses –C(15+5-1, 15) = C(19, 15) = 3876 (b)Step 1: take out 6 cans of root beer: 1 way Step 2: select the remaining 9 cans: 9-combination (9 remaining drinks) from a multi-set of 5 categories: C(9+5-1, 9) = C(13,9) = 715 Final Answer = 1 x 715 = 715 (Multiplication Rule)

54 Example 2: How many solutions are there to the equation x 1 + x 2 + x 3 + x 4 = 10 (a) if x 1, x 2, x 3, x 4 are non-negative integers? (b) if x 1, x 2, x 3, x 4 are positive integers? Answer: (a)10-combination from a multi-set of 4 categories –r = 10 units = 10 crosses; to be distributed into… –n = 4 categories: the four variables: need 3 ‘|’ to separate the crosses –C(10+4-1, 10) = C(13, 10) = 286 (b)Step 1: Assign 1 unit to each of the four variables: 1 way. Step 2: Assign the remaining 6 units to the four variables: 6-combination from a multi-set of 4 categories = C(6+4-1, 6) = C(9,6) = 84 Final Answer = 1 x 84 = 84 (Multiplication Rule)

55 Example 3: How many triplets of the form (i,j,k) are there, when (a) each i, j, k  {1,…,n} (b) each i, j, k  {1,…,n} and 1  i  j  k  n Answer: (a)Permutation: n 3 (b)3-combinations from a multi-set of n categories: (Observation skills needed to relate problem to known scenario) For example if 1  i  j  k  5, then we have 3-combinations from a multi-set of 5 categories: 3 X’s and 4 ‘|’s (1,1,2) being represented as XX|X||| (1,2,4) being represented as X|X||X| (2,3,5) being represented as |X|X||X Therefore in general, answer is C(n+3-1, 3) = (n+2)!/ (3! x (n-1)!) = (n+2)(n+1)n / 6

56 The Algebra of Combinations

57 Theorem: For all n  1 and 0  r < n, C(n, r) + C(n, r + 1) = C(n + 1, r + 1). Proof: Basic step: n = 1. –r must be 0. –C(1, 0) + C(1, 1) = 1 + 1 = 2. –C(2, 1) = 2. –Therefore, the statement is true for n = 1. Inductive step –Assume that the statement is true for any set of n elements, for some n  1, and any r, 0  r < n. –Let S be a set of n + 1 elements. –Let x  S. –Each (r + 1)-combination of S either includes x or does not include x.

58 –Each (r + 1)-combination of S which does not include x may be viewed as an (r + 1)-combination of S – {x}. –There are C(n, r + 1) such (r + 1)-combinations. –For each of the (r + 1)-combinations that do include x, remove the x. –The result is an r-combination of the S – {x}. –There are C(n, r) such r-combinations. –Thus, the total number of (r + 1)-combinations of S is C(n, r) + C(n, r + 1). –Therefore, C(n, r) + C(n, r + 1) = C(n + 1, r + 1).

59 Common properties (1) C(n,r) = C(n, n-r) (2) Pascal’s Formula: C(n+1, r) = C(n, r-1) + C(n,r) Proof of (1) Proven Algebraically: C(n,r) = n! / ( r!  (n-r)! ) = n! / ( (n-r)!  (n-(n- r))! ) = C(n, n-r) Proven using combinatorial reasoning (p331 of text) Let A be a set with n elements. Let the subsets of A of size r be B 1, B 2,…,B k. Each B k can be paired up with a subset of A of size n–r: namely A – B k. All subsets of size n All subset of size n–r B 1 A – B 1 B 2 A – B 2 … … B k A – B k

60 0 0 1 0 1 1 2 1 2 2 2 1 3 1 3 2 3 0 3 3 1 1 1 1 21 1 331

61 The Binomial Theorem

62 Theorem: Given any numbers a and b and any nonnegative integer n, (a + b) n =  k=0..n C(n, k)a n – k b k. Proof: Use induction on n. Basic step: n = 0. –(a + b) 0 = 1. –  k=0..0 C(0, k)a 0 – k b k = C(0, 0)a 0 b 0 = 1. –Therefore, the statement is true when n = 0. Inductive step –Suppose the statement is true for some n  0. –Then (a + b) n + 1 = (a + b)(a + b) n = (a + b)  k=0..n C(n, k)a n – k b k =  k=0..n C(n, k)a n – k + 1 b k +  k=0..n C(n, k)a n – k b k + 1 = a n + 1 +  k=1..n C(n, k)a n – k + 1 b k +  k=0..n - 1 C(n, k)a n – k b k + 1 + b n + 1 = a n + 1 +  k=1..n C(n, k)a n – k + 1 b k +  k=1..n C(n, k – 1) a n – k + 1 b k + b n + 1

63 = a n + 1 +  k=1..n (C(n, k) + C(n, k – 1))a n – k + 1 b k + b n + 1 = a n + 1 +  k=1..n C(n + 1, k)a n – k + 1 b k + b n + 1 =  k=0..n + 1 C(n + 1, k)a n – k + 1 b k. Therefore, the statement is true for n + 1. Thus, the statement is true for all n  0.

64 Binomial Theorem: Algebraic proof is by induction on n. (p341 of text) Combinatorial Proof: (a+b) n = (a+b) (a+b) (a+b) … (a+b)(n copies) #1 #2 #3 #n b a a … a a b a … a What is the coefficient of a n-k b k ? How many ways can we create the a n-k b k term? Well, to create a term, we have to select either a or b from each (a+b) group. Problem reduces to a n-permutation with repetitions (previous section 2.3), of 2 types of objects: selecting n-k copies of a and k copies of b: n!/(k!(n-k)!) = C(n,k)

65 A probability space is a sample space S, together with a probability Pr[A] for each sample point w, such that 1. 2. 3. If A and B are mutually disjoint, then the probability of the union is


Download ppt "Counting and probability What do you mean by counting? How do you count things in daily life? Counting the European way or the English speaking way?"

Similar presentations


Ads by Google