CSCI 2824: Lecture 22 NotesWe will start chapter 5 on combinatorics.
CombinatoricsCombinatorics is the mathematics behind counting discrete structures. Often, it is important to know how many objects of a particular type exist to make some decisions. Eg.,
In this module (Chapter 5 of the book), we will study the basics of counting objects. We will start from some basic puzzles. PuzzleWe have three envelopes colored red, green and violet. We could invite one of three people Alice, Bob and Carol. How many possible ways are there of choosing a person and a color for their invitation? Answer
There are 9 possible ways. To understand why, we will construct a concept of choiceset. This set will represent the set of all the possible choices we have. In this case, our choices are We have choices. Constructing a choice set is very tedious, and often impossible. We would like to count directly, without actually constructing each choice separately. PuzzleWe have three tee shirts. Two are red (indistinguishable) and one is violet. We have three people interested in these teeshirts: Alice, Bob and Carol. How many possibilities ways are there of choosing a color for every person? Answer
Let us just enumerate possibilities.
There are three in all. Another way to represent it is to use the notion of a choice set. If we choose who gets the violet shirt, the other two have to get the red (there is no choice for these two). Therefore choice set is PuzzleLet us say that CU, Nebraska and Texas are contending for the basketball playoffs in a roundrobin. Each team needs to play the other exactly once. How many games will be there? Answer
We know that two of the games will have CU in it. This leaves one game with Nebraska and Texas. So we arrive at 3 games in all. PuzzleThere are teams that need to play each other in a tournament. Each team needs to play the other exactly once. How many games will be played? Answer
Let us number the teams .
Total Basic Rules for CountingWhen asked to count the number of possibilities, we need to be careful of two things:
In the former case, our count will be larger than what it should be. In the latter case, the count will be smaller. If we commit both types of errors, the count may as well be a random number!! Product RuleLet us say that we have to choose items, in order. There are choices for item 1 and independently there are choices for item 2. Then there are choices for both together. Let us revisit the first example: We have three envelopes colored red, green and violet. We could invite one of three people Alice, Bob and Carol. How many possible ways are there of choosing a person and a color for their invitation? Answer
There are two items: We need to choose (a) person amongst Alice, Bob and Carol and (b) color among red, green and violet. Therefore and . The number of possibilities is . PuzzleTom, Mary and Francois go to an avant garde french restaurant. For their dessert, they have a choice between three things:
How many possible ways are there of placing an order? Answer
PuzzleLet us say we have work to do in Paris, Bangkok or Budapest. There are Brian and Carla to send out. How many possible ways are there to send at most one person to one place? Answer
Let us take it from the point of view of the person. There are three options for Brian. Once we fix that, there are two remaining places that Carla could go to. This gives us options. PuzzleLet us take the previous puzzle, where we have places: Paris, Bangkok or Budapest and personnel (forget their names now). We do not care which person goes to which place. In other words, sending Brian to Paris and Carla to Bangkok is now the same as sending Carla to Paris and Brian to Bangkok. In this problem, we just care about which places get visited. How many possibilities are there now? Answer
Since there are just two people, one place has to be left out. There are three ways to choose this place, and therefore, three possible choices. PuzzleHow many digit numbers can be formed by the numerals . There are four digits .
Combine these to conclude that there are such numbers. PermutationsLet us take distinct objects . A permutation of objects consists of choosing an ordered sequence of objects from the objects.
ExampleList all permutations of two elements from the set . The elements are giving rise to six permutations of objects. Example1List all permutations of all the 4 words in the phrase “University Of Colorado Boulder”. Note that in a permutation, (1) we cannot repeat objects and (2) order in which we place object matters.
We have choices for . Once we fix that we have choices for , for and the remaining goes to . This gives rise to options. ExampleLet us modify the previous example to require a phrase of 3 words (instead of all 4) from the set { University, Colorado, Of, Boulder }. Formal Rules for CountingWe will now start to understand the intuition we have developed more precisely. Basic Rules for CountingRule of products: If and then . Example1We have 3 tee shirts with colors { red, green, blue } and 2 caps with labels {A,B}. How many possible ways are there of choosing a tee shirt and a cap? Example2Let us say that in a tournament teams A, B and C play matches against each other in a round robin. How many matches are played? How many possible outcomes are there for the tournament? Answer
To count matches is easy, we know that there are three matches to be played M1: A vs. B, M2: A vs. C and M3: B vs. C. Each match has two outcomes. Winner1 = {A,B}, Winner2 = {A,C}, Winner3 = {B,C}. Therefore, applying the product rule are 2 2 2 = 8 outcomes overall. Rule of SumsRule of sums: If and are disjoint then . Example1We are allowed to make up a positive integer from the digits {1,3,5,7}. Each digit is to be used at most once (we may decide to skip a digit).
Solution We split the problem into 4 disjoint counts: count all one digit numbers, two digit numbers, three digit and four digit numbers that can be formed. Together, using the rule of sums, we can simply add these counts and get the required overall count.
Adding them up we have possible numbers. Rule of ComplementsRecall that for a set where . Rule of complements Let us say that instead of counting , we can count . Then . ExampleHow many odd numbers are there between and (include both limits in your count). First let us just count the even numbers . Why?
There are a total of numbers between and . Therefore, odd number count is . ExampleLet us say we toss a coin ten times. Each time we toss, we get a head or a tail.
