Combinatorics CSC 172 SPRING 2002 LECTURE 11 Assignments With Replacement  Example: Passwords  Are there more strings of length 5 built from three.

Slides:



Advertisements
Similar presentations
Basic Permutations and Combinations
Advertisements

4.5 Generalized Permutations and Combinations
 One hundred prisoners are lined up facing the same direction, single file, so that each prisoner can see the people in front of him but no one behind.
Counting Chapter 6 With Question/Answer Animations.
MASTERMIND  Did anyone play the game over the weekend?  Any thoughts on strategy?
CSCE 2100: Computing Foundations 1 Combinatorics Tamara Schneider Summer 2013.
Fall 2002CMSC Discrete Structures1 Permutations How many ways are there to pick a set of 3 people from a group of 6? There are 6 choices for the.
Counting Tools ● Enumeration ● Multiplication ● Addition ● Negation.
Today Today: Reading: –Read Chapter 1 by next Tuesday –Suggested problems (not to be handed in): 1.1, 1.2, 1.8, 1.10, 1.16, 1.20, 1.24, 1.28.
CSE115/ENGR160 Discrete Mathematics 04/17/12
Lecture 5 Counting 4.3, Permutations r-permutation: An ordered arrangement of r elements of a set of n distinct elements. Example: S={1,2,3}:
CSE 321 Discrete Structures Winter 2008 Lecture 16 Counting.
4/5/05Tucker, Sec Applied Combinatorics, 4rth Ed. Alan Tucker Section 5.4 Distributions Prepared by Jo Ellis-Monaghan.
Recursive Definitions Rosen, 3.4 Recursive (or inductive) Definitions Sometimes easier to define an object in terms of itself. This process is called.
Applied Combinatorics, 4th Ed. Alan Tucker
Counting Principles and Probability Digital Lesson.
How many ways are there to pass through city A where the arrows represent one-way streets? Answer: mn ways The counting principal: Suppose two experiments.
5.5 Counting Techniques. More Challenging Stuff  The classical method, when all outcomes are equally likely, involves counting the number of ways something.
4. Counting 4.1 The Basic of Counting Basic Counting Principles Example 1 suppose that either a member of the faculty or a student in the department is.
Exam 1 Review 5.1, , 8.1, 8.2.
7 Further Topics in Algebra © 2008 Pearson Addison-Wesley. All rights reserved Sections 7.4–7.7.
Basic Counting Lecture 12: Oct 28. This Lecture We will study some basic rules for counting. Sum rule, product rule, generalized product rule Permutations,
Finding Probability Using Tree Diagrams and Outcome Tables
Basic Counting. This Lecture We will study some basic rules for counting. Sum rule, product rule, generalized product rule Permutations, combinations.
Chapter The Basics of Counting 5.2 The Pigeonhole Principle
Generalized Permutations and Combinations
Chapter 6 With Question/Answer Animations 1. Chapter Summary The Basics of Counting The Pigeonhole Principle Permutations and Combinations Binomial Coefficients.
Slide 7- 1 Copyright © 2006 Pearson Education, Inc. Publishing as Pearson Addison-Wesley.
Fall 2002CMSC Discrete Structures1 One, two, three, we’re… Counting.
March 10, 2015Applied Discrete Mathematics Week 6: Counting 1 Permutations and Combinations How many different sets of 3 people can we pick from a group.
(Important to algorithm analysis )
Lesson Counting Techniques. Objectives Solve counting problems using the Multiplication Rule Solve counting problems using permutations Solve counting.
Quiz 10-1, Which of these are an example of a “descrete” set of data? 2.Make a “tree diagram” showing all the ways the letters ‘x’, ‘y’, and ‘z’
1 CSC 321: Data Structures Fall 2013 Counting and problem solving  mappings, bijection rule  sequences, product rule, sum rule  generalized product.
Lecture 5 Counting 4.3, Permutations r-permutation: An ordered arrangement of r elements of a set of n distinct elements. Example: S={1,2,3}:
Union, Intersection. Intersection of Sets 3 Intersection (∩) [of 2 sets]: the elements common to both sets Some guidelines when finding the intersection.
Lesson 3-6. Independent Event – 1st outcome results of probability DOES NOT affect 2nd outcome results Dependent Event – 1st outcome results of probability.
Counting nCr = n!/r!(n-r)!=nC(n-r) This equation reflects the fact that selecting r items is same as selecting n-r items in forming a combination from.
The Pigeonhole Principle. The pigeonhole principle Suppose a flock of pigeons fly into a set of pigeonholes to roost If there are more pigeons than pigeonholes,
Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1.
Section 4.5-Counting Rules
Algebra-2 Counting and Probability. Quiz 10-1, Which of these are an example of a “descrete” set of data? 2.Make a “tree diagram” showing all.
Section 1.3 Each arrangement (ordering) of n distinguishable objects is called a permutation, and the number of permutations of n distinguishable objects.
5.5 Generalized Permutations and Combinations
2/24/20161 One, two, three, we’re… Counting. 2/24/20162 Basic Counting Principles Counting problems are of the following kind: “How many different 8-letter.
Solutions to the HWPT problems. 1.How many distinguishable arrangements are there of the letters in the word PROBABILITY? Answer: 11!/(2! 2!) 2.A and.
L14: Permutations, Combinations and Some Review EECS 203: Discrete Mathematics.
Operations on Sets Union of Sets Intersection of Sets
Sorting by placement and Shift Sergi Elizalde Peter Winkler By 資工四 B 周于荃.
SECTION 5.4 COUNTING. Objectives 1. Count the number of ways a sequence of operations can be performed 2. Count the number of permutations 3. Count the.
Math 1320 Chapter 6: Sets and Counting 6.4 Permutations and Combinations.
Combinatorics. What is Combinatorics? Wide ranging field involving the study of discrete objects.
L14: Permutations, Combinations and Some Review
The Pigeonhole Principle
CSC 321: Data Structures Fall 2015 Counting and problem solving
COCS DISCRETE STRUCTURES
CSC 321: Data Structures Fall 2016 Counting and proofs
Section 8.3 PROBABILITY.
Generalized Permutations & Combinations: Selected Exercises
Permutations and Combinations
Permutations and Combinations
CS1022 Computer Programming & Principles
Permutations and Combinations
CS100: Discrete structures
Statistics and Probability
Permutations and Combinations
Basic Counting.
CSC 321: Data Structures Fall 2018 Counting and proofs
Great Theoretical Ideas in Computer Science
Basic Counting Lecture 9: Nov 5, 6.
Presentation transcript:

Combinatorics CSC 172 SPRING 2002 LECTURE 11

Assignments With Replacement  Example: Passwords  Are there more strings of length 5 built from three symbols or strings of length 3 built from 5 symbols?

In general We are given n “items”, to each we must assign one of k “values” Each value may be used any number of times Let W(n,k) be the number of ways How many different ways may we assign values to the items? “Different ways” means that one or more of the items get different values.

Inductive Definition Basis: W(1,k) == k Induction: If we have n+1 items, we assign the first one in one of k ways and the remaining n in W(n,k) ways

Recurrence W(1,k) = k W(n+1,k) = k * W(n,k) T(1) = k T(n) = k * T(n-1) Easy expansion T(n) = k n

Example: Are there more strings of length 5 built from three symbols or strings of length 3 built from 5 symbols? Length 5, from 3 “values” = {0,1,2} “items” are the 5 positions N = 3 5 = 243 Length 3, from 5 “values” = {0,1,2,3,4} “items” are the 3 positions N = 5 3 = 125

Permutations Example: “SCRABBLE” - start with 7 letters (tiles) - how many different ways can you arrange them - we don’t care about the word’s legality

Scrabble We can pick the first letter to be any of the 7 tiles For each possible 1 st letter, there are 6 choices of second letters Or, 7*6 = 42 possible two letter prefixes Similarly, for each of the 42, there are 5 choices of the third letter. 42 * 5 = 210, and so on Total choices = 7*6*5*…*1 = 7! = 5040 In general, there are n! permutations of n items.

Ordered Selections Suppose we want to begin Scrabble with a 4 letter word? How many ways might we form the word from our 7 distinct tiles? For each possible 1 st letter, there are 6 choices of second letters 7*6 = 42 possible two letter prefixes For each of the 42, there are 5 choices of the third letter. 42 * 5 = 210 For each of the 120, there are 4 choices of the third letter. 210 * 4 = 840

In general  (n,m), the nmber of ways to pick a sequence of m things out of n == n*(n-1)*(n-2)*…*(n-m+1) == n!/(n-m)!

Combinations Suppose we give up trying to make a word and want to throw 4 of our 7 tiles back in the pile? How many different ways can we get rid of 4 tiles? Ordered selection 4!/(7-4!) = 840 However, we don’t care about order. So, how many ways are there to order 4 items? 4! = /24==35 == 7!/((7-4)!4!) = 35

In general “n choose m”

Recursive Definition for n choose m We want to choose m things out of n, we can either take or reject the first item. If we take the first, then we can take the rest by choosing m-1 of the remaining n-1 We can do this in (n-1) choose (m-1) ways OTOH, if we reject the first item, then we can get the rest by choosing m of the remaining n-1 We can do this in (n-1) choose m ways

Inductive Definition Basis: for all n there is only one way to choose all or none of the elements Induction: for 0 < m < n

Proving Inductive Definition = Direct Definition What is the induction parameter? Zero for the basis case decreases in the inductive step Complete induction on m(n-m) Prove: c(n,m) = n!/((n-m)!m!)

Basis If m(n-m) == 0, then either m == 0 or m == n If m == 0, then n!/(n-m)!m! == n!/n! = 1 = c(n,0) If m == n, then n!/(n-m)!m! == n!/n! = 1 = c(n,n)

Induction By definition c(n,m) = c(n-1,m-1) + c(n-1,m) Assume, c(n-1,m-1) = (n-1)!/((n-m)!(m-1)!) c(n-1,m) = (n-1)!/((n-m-1)!m!) Add the left sides == c(n,m), by definition Add the right sides == n!/(n-m)!m!, clearly

Orders With Some Equivalent Items In real life, we play Scrabble with duplicate letters Suppose you draw {S,T,A,A,E,E,E} at star, how many 7-letter “words” can you make. Similar to permutations, but now, some are indistinguishable, because of duplicates Trick: we can mark the letters to make them distinguishable S,T,A 1,A 2,E 1,E 2,E 3 Then we get 7!=5040 ways

How much “sameness” But some order are the same E 3 TA 1 E 1 SA 2 E 2 == E 3 TA 2 E 1 SA 1 E 2 The two As can be ordered in 2! = 2 ways The three Es can be ordered in 3! = 6 ways So, the number of different words is 7!/2!3! = 540/(2*6) = 420

In general The orders of n items with groups i 1,i 2,…,i k equivalent items is n!/(i 1 !i 2 !..i k !)

Items into Bins Suppose we throw 7 dice (6 sided). How many outcomes are there? Place each of 7 items into one of 6 bins The tokes are the dice The bins are then number of dice Putting the second token into bin 3 means that the second die shows 3

Trick Imagine 5 markers, denoted “*” that represent separation between bins, and 7 tokens “T” that represent dice The string “*TT**TTT*T*T” corresponds to no 1s, two 2s, no 3s, three 4s, a 5 and a 6 How many such strings? “orders with identical items” 12 items, 5 of type “*”, 7 of type “T” 12!/5!7! = 792

In general The number of ways to assign n items to m bins The number of orders of n-1 markers and n tokens We are picking n out of the possible n+m-1 positions for the tokens

Several kinds of items into Bins Order in bin can be either important (queues) or not

Several kinds of items, order within bin unimportant If we have items of k colors, with i j items of the jth color, then the number of distinguishable assignments into m bins is: Example: 4 red dice, 3 blue dice, 2 green dice 6 bins

Order important If there are m bins into which ij items are placed and order within the bin matters Imagine m-1 markers separating the bins and i j tokens of the jth type By “orders with identical items”