550 likes | 716 Views
Introduction to Counting. Discrete Structures. A Multiplication Principle. Example 3. Suppose you're buying equipment for a home office. You wish to purchase a computer, a scanner, and a printer ("3 decisions to make").
E N D
Introduction to Counting Discrete Structures
Example 3 • Suppose you're buying equipment for a home office. You wish to purchase a computer, a scanner, and a printer ("3 decisions to make"). • If you have narrowed your choices to 3 models of computers, 4 scanners, and 2 printers, how many different overall outcomes are possible?
“ a branch of a tree” The Count • By the multiplication principle, the product 3 x 4 x 2 = 24 computer scanner printer tells us 24 different systems are possible.
Decision Tree: 24 branches Total of 24 different systems computer scanner printer
Example 4 • Consider a license plate consisting of any 3 single digit numbers followed by any 3 letters. • Examples of such license plates include 533 ATZ, 285 VCC, etc. • There are 6 decisions to make. • For each digit, we have the 10 choices 0, 1,..., 9 • and for each letter, we have 26 choices a,b,...,z.
The Plates • The total number of different plates is given by 10 x 10 x 10 x 26 x 26 x 26 digit 1 digit 2 digit 3 letter 1 letter 2 letter 3 A total of 17,576,000 different plates!
Example 5 • In a deli, suppose we may choose from 4 types of bread, 6 types of meat, and 3 types of cheese. • Consider the sandwiches which include one type of meat plus one type of cheese. How many such sandwiches are possible? • There are three decisions to make(bread, meat, cheese)
The Sandwiches • There are three decisions to make • 4 x 6 x 3 = 72bread meat 1 cheese • A total of 72 different sandwiches.
By the multiplication principle, if | A| = n, then Cardinality of a Set • The number of elements in a set A is called the “cardinality” of A , denoted | A|. • By the multiplication principle,if | A| = n and | B| = m, then | A x B| = nm.
No Overlap? • In this special case, count the total elements by counting each set separately. In this case, the sets are said to be "disjoint".
Multiply and Add • Consider the license plate example again. This time allow either 3 digits followed by 3 letters or just 6 digits. These two sets of plates are disjoint (no overlap). A total of 18,576,000 license plates
Inclusion/Exclusionand Combinations Discrete Structures
Because the sets are not disjoint. How many elements? • Recall our sets A = {2,4,5,8,10} andB = { 2,3,5,7,8,9}. Determine the cardinality,
Avoid Double Counting • When adding the 5 elements from A with the 6 elements from B, the 3 elements which lie in both A and B must be counted only once.
Addition Principle For any two sets A and B, In particular, if A and B are disjoint sets,then
Playing Cards • The 13 cards in each category or "suit" include a 2, 3, 4, 5, 6, 7, 8, 9, 10, Jack, Queen, King, and an Ace. The Jack, Queen, and King are called "face cards".
Aces or Spades • In a deck of playing cards, how many of the cards are Aces or Spades? That's a total of 16 distinct cards.
Using Addition Rule • By counting the set of Aces and set of Spades individually and subtracting the overlap…
Substitute in the known values… Solving for other term • Given any 3 of the values in the addition rule, we may solve for the remaining unknown value. • Find the number of elements in B, given
Elements in B The 85 elements of B includes the 35 in the overlap with A. These regions contain the total of 140 elements.
Example • “In a survey of 1000 students, 700 indicate they are enrolled in a math or english class. Of these students, 400 are enrolled in a math class and 650 are enrolled in an english class. How may are enrolled in math and english classes?”
Find Intersection • Using the addition principle, setup and solve for the intersection. 50 350 300 M E
Extended to 3 Sets? May generalize further for any n sets.
Problem 8, page 203 • Among 150 students83 own a car,97 own a bicycle,28 own a motorcycle,53 own car and bicycle,14 own car and motorcycle,7 own bicycle and motorcycle,2 own all three items • How many own only a bicycle? • How many don’t own any of these items?
Permutations and Combinations Discrete Structures
Arranging Letters • When we consider 3 letters on a license plate, the order in which the letters appear is significant. That is, the sequence of letters PHT is different than TPH, even though the same letters are used. • Using the “multiplication principle”, there are 26 x 25 x 24 = 15600 ways to pick and arrange 3 distinct letters(not using the same letter twice).
“Permutations” • When we wish to consider the many different arrangements of the various choices, as with letters on license plates, we use the term "permutations". • “Permutations of n objects, taken r at a time” • Consider 26 letters, choose and arrange 3.How many ways may this be done?
Permutation Formula When repetitions are not allowed, the number of ways to choose and arrange any r objects chosen from a set of n available objects is denoted Pn, r .
Using the Formula • For the arrangements of 3 lettersrecall by “multiplication principle”, there are 26 x 25 x 24 = 15600 ways
Same as before! A convenient notation, but why not just use the multiplication principle?
Or equivalently, Gold, Silver, Bronze • Consider the top 3 winners in a race with 8 contestants. How many results are possible?
Calculate it • Calculators have a built-in feature for these computations (labeled as nPr ). • Use the MATH button and PRB submenu. • To compute the value P8,3 = 336we simply enter:8 nPr 3
Compare 2 Cases: Consider a club with 16 members: • Case 1: • If a president, VP, and treasurer are elected, how many outcomes are possible? • (select and arrange 3, order is important) • 16 x 15 x 14 = 3360 pres. VP treas. • Case 2: • If a group of 3 members is chosen, how many groups are possible ? • (a choice of 3 members, order is not important) • Since we don't count the different arrangements, this total should be less.
Case 2 “Combinations” • We’re interested in the members of the group, not all the possible arrangements. • Think of the group as one "choice of 3” from the 16 members. • The number of different combinations is denoted by C16, 3 . “Combinations of 16 objects, taken 3 at a time”
Combinations Formula • number of combinations of r items chosen from n available choices, is given by“Combinations of n objects, taken r at a time”Often read as “n, choose r"
Calculate “16, choose 3” simplifies as Or we may calculate the value C16,3 = 560by simply entering: 16 nCr 3
Our Comparison Case 1: Case 2:Given one group of 3 members, such as Joe, Bob, and Sue, 6 arrangements are possible:( Joe, Bob, Sue), ( Joe, Sue, Bob), ( Bob, Joe, Sue) ( Bob, Sue, Joe), ( Sue, Joe, Bob), ( Sue, Bob, Joe)Each group gets counted 6 times for permutations. Divide by 6 to “remove this redundancy”.
Arranging Letters • How many distinct ways can the letters “MISSOURI” be arranged? • There are 8 letters, so there are 8! permutations. But not all distinct! • RUIS1 MS2 OI is equal to RUIS2 MS1 OI so don’t count these twice. • Same consideration for the letter “I’s”. • 8!, reduce by half, and reduce by half again.Perhaps an easier way?
Rearranging Missouri • How many distinct ways can the letters “MISSOURI” be arranged? • Alternate, choose 2 slots for the M’s, choose 2 slots for the I’s, then arrange the other 4 letters.
Rearranging Mississippi • How many distinct ways can the letters “mississippi” be arranged? • Alternate, choose 4 slots for the S’s, 4 slots for the I’s, 2 slots for the P’s, then only one slot left to place the M.
More Combinations Discrete Structures
Consider all combinations of 5 cards, taken from the 52 cards. That is, “52, choose 5”. 5 card hands? • When a hand of cards is drawn from a deck, which cards we receive is important, not the arrangement. • How many different 5-card hands are possible ?
Series of Choices • Try combining our new counting formulas with our previous counting principles. • How many 5-card hands include exactly 3 kings and 2 aces? • Here we select kings and select aces. It’s a series of decisions, so we apply the multiplication principle: • ? x ? = ???choose 3 of choose 2 of the 4 kings the 4 aces
3 Kings, 2 Aces • “4 kings, choose 3”; there are C4,3 = 4 possible outcomes. • “4 aces, choose 2”; there are C4,2 = 6 possible outcomes. • C4, 3 x C4, 2 = (4)(6) = 24choose 3 of choose 2 of the 4 kings the 4 aces • There are 24 hands including 3 kings and 2 aces.
Committee • Consider a group of 20 juniors and 25 seniors. • Question 1: How many ways can a committee of 4 of these students be selected? • "45 available students, choose 4“ C45,4 = 148,995 possible committees. • Question 2: How many ways can a committee with 2 juniors and 2 seniors be selected? • Select 2 of the 20 juniors, select 2 of 25 seniors:C20, 2x C25, 2 = (190)(300) = 57,000 committtees.
Continued… • Question 3: How many ways can a committee of 4 students be selected, including at least 3 seniors? Adding the two cases yields a total of (20)(2300) + 12650 = 58,650 committees.
Defective, or not? Among a collection of 20 clocks, 5 are defective. • Question 1: How many ways can 3 of the clocks be selected? • "20 available clocks, choose any 3“ C20,3= 1140 possible selections. • Question 2: How many ways can 3 of the clocks be selected such that none are defective? • Select 3 from the 15 non-defective clocksC15,3 = 455 selections don't involvedefective clocks
Partition as Disjoint Sets • All 5-card hands categorized as: • no face cards: C40, 5 = 658,008 1 face card: C12,1 C40, 4 = 1,096,680 2 face cards: C12,2 C40, 3 = 652,0803 face cards: C12,3 C40, 2 = 171,6004 face cards: C12,4 C40, 1 = 19,800all 5 face cards: C12,5 = 792 • Total 5-card hands: 2,598,960
Throw out the rest • Sometimes instead of counting the objects we’re interested in… • …it’s easier to count “all objects” and subtract out the objects we don’t want. • Consider a subset A of a “universal” set S