230 likes | 369 Views
CS 173: Discrete Mathematical Structures. Cinda Heeren heeren@cs.uiuc.edu Siebel Center, rm 2213 Office Hours: W 12:30-2:30. CS 173 Announcements. Homework #7 due 10/23, 8a. Exam #2, 11/3, 7-9p. CS 173 From last time?.
E N D
CS 173:Discrete Mathematical Structures Cinda Heeren heeren@cs.uiuc.edu Siebel Center, rm 2213 Office Hours: W 12:30-2:30
CS 173 Announcements • Homework #7 due 10/23, 8a. • Exam #2, 11/3, 7-9p. Cs173 - Spring 2004
CS 173 From last time? • Suppose you are planning an evening of Har Bopping, and you want to Bop 4 Hars. If there are 7 Hars on campus, and if you agree that tonight’s game requires that some Har be Bopped more than once, how many different Har Bopping schedules can you make? Ex: AABC, ACCD, AFAF are valid Har Bopping schedules, but AFDE is not. Cs173 - Spring 2004
YUCK! CS 173 From last time? One approach: • First 2 are alike, and last two are different: 7x1x6x5. • First and third alike, second and fourth different: 7x6x1x5. • First two alike, last two alike, different from first: 7x1x6x1. • Etc. Cs173 - Spring 2004
Each entry unique 74 7x6x5x4 74 - 7x6x5x4 = 1561 CS 173 From last time? A better approach: • Count total number of schedules possible: • Subtract those that you don’t want to count: • All others must have repeats. Cs173 - Spring 2004
20 CS 173 Decision Tree How many different best of 5 game series are possible between the Cardinals and the Astros? Cs173 - Spring 2004
CS173Pigeonhole Principle If n pigeons fly into k pigeonholes and k < n, then some pigeonhole contains at least two pigeons. Cs173 - Spring 2004
CS173Pigeonhole Principle If n pigeons fly into k pigeonholes and k < n, then some pigeonhole contains at least two pigeons. Cs173 - Spring 2004
0, 1, 2, 3, or 4 Some pair has the same remainder, by PHP. We can use this simple little fact to prove amazingly complex things. CS173Pigeonhole Principle Let S contain any 6 positive integers. Then, there is a pair of numbers in S whose difference is divisible by 5. Let S = {a1,a2,a3,a4,a5,a6}. Each of these has a remainder when divided by 5. What can these remainders be? 6 numbers, 5 possible remainders…what do we know? Consider that pair, ai and aj, and their remainder r. ai = 5m + r, and aj = 5n + r. Their difference: ai - aj = (5m + r) - (5n + r) = 5m - 5n = 5(m-n), which is divisible by 5. Cs173 - Spring 2004
Let’s say she knows 3 others. Consider one person. CS173Pigeonhole Principle Six people go to a party. Either there is a group of 3 who all know each other, or there is a group of 3 who are all strangers. If any of those 3 know each other, we have a blue , which means 3 people know each other. So they all must be strangers. She either knows or doesn’t know each other person. But then we’ve proven our conjecture for this case. But there are 5 other people! So, she knows, or doesn’t know, at least 3 others. The case where she doesn’t know 3 others is similar. Cs173 - Spring 2004
CS173Ice Cream Cones Do these two cones provide the same ice cream experience? Cs173 - Spring 2004
P(n,r) = n! / (n-r)! • 60 • 125 • 12!/7! • 512 • No clue CS173Permutations In a running race of 12 sprinters, each of the top 5 finishers receives a different medal. How many ways are there to award the 5 medals? 11 10 9 8 12 A permutation is an ordered arrangement of objects. The number of permutations of r distinct objects chosen from n distinct objects is denoted P(n,r). Cs173 - Spring 2004
P(17,10) = 17x16x15x14x13x12x11 CS173Permutations Suppose you have time to listen to 10 songs on your daily jog around campus. There are 6 Cake tunes, 8 Moby tunes, and 3 Eagles tunes to choose from. How many different jog playlists can you make? Cs173 - Spring 2004
P(6,4) x P(8,4) x P(3,2) CS173Permutations Suppose you have time to listen to 10 songs on your daily jog around campus. There are 6 Cake tunes, 8 Moby tunes, and 3 Eagles tunes to choose from. Now suppose you want to listen to 4 Cake, 4 Moby, and 2 Eagles tunes, in that band order. How many playlists can you make? Cs173 - Spring 2004
P(6,4) x P(8,4) x P(3,2) x 3! CS173Permutations Suppose you have time to listen to 10 songs on your daily jog around campus. There are 6 Cake tunes, 8 Moby tunes, and 3 Eagles tunes to choose from. Finally, suppose you still want 4 Cake, 4 Moby, and 2 Eagles tunes, and the order of the groups doesn’t matter, but you get dizzy and fall down if all the songs by any one group aren’t played together. How many playlists are there now? Cs173 - Spring 2004
M2 M4 M5 M1 M3 5! X P(6,3) CS173Permutations In how many ways can 5 distinct Martians and 3 distinct Jovians stand in line, if no two Jovians stand together? Cs173 - Spring 2004
C(12,5) P(12,5) = C(12,5) x 5! CS173Combinations A basketball squad consists of 12 players, 5 of which make up a team. How many different teams of players can you make from the 12? What’s the diff? In a running race of 12 sprinters, each of the top 5 finishers receives a different medal. How many ways are there to award the 5 medals? Cs173 - Spring 2004
CS173Combinations A combination is an unordered selection of elements from some set. The number of combinations of r distinct objects chosen from n distinct objects is denoted by C(n,r) or nCr or , and is read “n choose r.” C(n,r) = P(n,r)/r! = n!/((n-r)!r!) Cs173 - Spring 2004
CS173Combinations A committee of 8 students is to be selected from a class consisting of 19 frosh, and 34 soph. In how many ways can 3 frosh and 5 soph be selected? Cs173 - Spring 2004
CS173Combinations A committee of 8 students is to be selected from a class consisting of 19 frosh, and 34 soph. In how many ways can a committee with exactly 1 frosh be selected? Cs173 - Spring 2004
CS173Combinations A committee of 8 students is to be selected from a class consisting of 19 frosh, and 34 soph. In how many ways can a committee with at most 1 frosh be selected? Cs173 - Spring 2004
CS173Combinations A committee of 8 students is to be selected from a class consisting of 19 frosh, and 34 soph. In how many ways can a committee with at least 1 frosh be selected? Cs173 - Spring 2004