Introduction to combinatorics (CSCI 2824, Spring 2015)In this lecture we start the chapter on combinatoics, the art of counting discrete objects. This page covers the following topics:
(Sections 5.1, 5.2 of the textbook) Recap: Four different structure types in combinatoricsAs we saw in the last lecture, when we talk about counting the number of combinations of elements from a set , it is very important to identify the following two features:
These two features defines four different basic discrete structures relevant to combinatorics:
Case study: drawing two numbers fromToday, we consider the following situation: suppose we have a set of integers. Category 1: Ordered listsIf we draw two integers from in order and allowing repetition, how many possible outcomes are there? This question concerns the number of distinct length-2 ordered lists whose entries are drawn from . The possible outcomes that we are interested in can be described by the set . So the answer is simply the cardinality of the set , i.e., . Category 2: Unordered listsIf we draw two integers from without order and allowing repetition, how many possible outcomes are there? This question concerns the number of distinct length-2 unordered lists whose entries are drawn from . The possible outcomes that we are interested in can be described by the set . So the answer is given by the cardinality of this set, which is . Category 3: PermutationIf we draw two integers from in order but not allowing repetition, how many possible outcomes are there? This question concerns the number of permutations of 2 objects from . The possible outcomes that we are interested in can be described by the set . So the answer is given by . Category 4: SetsIf we draw two inregers from without order and bot allowing repetition, how many possible outcomes are there? This question concerns the number of size-2 subsets of . The possible outcomes that we are interested in can be described by the set , which has elements. Hence the answer is . Basic Rules for CountingIn this section, we mention some basic rules for counting, via set intersection/union. These rules look simple, but knowing how to apply them in practice can be really tricky! The product ruleProduct rule
If and then . More generally, given any sets , . Example 1We 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? Example 2Let 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? Solution 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. The sum ruleSum rule
If and are disjoint (i.e., ), then . Example 3We 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).
Question: How many numbers can we make? 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. Inclusion-exclusion principleWe have seen the formula for counting the elements in when and are disjoint. What if and are not disjoint, i.e., is not an empty set? Inclusion-exclusion principle
For any sets and , . Example 4How many bit strings of length 10 either begin with three 1's or end with two 0's? Rule of ComplementsRule of complements
Let and be two sets satisfying , i.e., is a subset of . Then . (Here denotes the set difference minus , i.e., .) Example 5How many odd numbers are there between and (include both limits in your count). Solution First let us just count the even numbers . Why?
There are a total of numbers between and . Therefore, odd number count is . Example 6Let us say we toss a coin ten times. Each time we toss, we get a head or a tail.
|