Lecture 2
The Counting Principle: Consider a process of r stages. Suppose that:
- There are n1 possible results at the first stage.
- For every possible result at the first stage, there are n2 possible results at the second stage.
- More generally, for any sequence of possible results at the first i−1 stages, there are n1 possible results at the ith stage.
- Then, the total number of possible results of the r-stage process is n1n2⋯nr
Big Idea: For problems without permutation or replacement, a series of decisions can be enumerated by multiplying the number of possible decisions at each stage.
Example: A pixel in a digital image is represented by 8 bits. How many encodings are possible for one pixel?
28=256
Mutually Exclusive Counting: Suppose that X1,…,Xt are sets and that the ith set Xi has ni elements. If X1…,Xi is a pairwise disjoint family, the number of possible elements that can be selected from X1 or X2 or … or Xt is n1+n2+⋯+nt
Big Idea: Because the set family is pairwise disjoint, we can think of these sets like bubbles on a Venn Diagram that don't overlap. Counting total elements across these sets is the same as just adding the number of elements from each.
Example: A six person committee Alice, Ben, Connie, Dolph, Egbert, and Francisco is to select a chairperson, secretary, and treasurer.
- In how many ways can this be done? 6⋅5⋅4=120
- In how many ways can this be done if Alice or Ben must be chairman? 5⋅4+5⋅4=40
- How many ways if Egbert holds one of the offices? 5⋅4+5⋅4+5⋅4=603(5⋅4)=60
- How many ways if both Dolph and Francisco holds one of the offices? 4⋅3⋅2=24
Inclusion-Exclusion Principle for Two Sets: |X∪Y|=|X|+|Y|−|X∩Y|
Big Idea: If two sets intersect, adding the cardinality of both individually would double-count the overlap so it's subtracted away.
Permutation: A permutation of n distinct elements x1,…,xn is an ordering of the n elements x1,…,xn. There are n! permutations of n elements.
Example: ABCDEF Permutations
- How many permutations of the letters ABCDEF are there with the substring DEF?
- Consider DEF to be a single element: 4!=24
- How many permutations of the letters ABCDEF are there with DEF together in any order?
- Number of ways to order DEF is 3!. The number of permutations with DEF together is 3!4!=144
- How many ways can you seat 6 people around a round table? (if everybody moves n seats to the left or right, that is considered the same seating) 5!
R-Permutation: An r-permutation of n distinct elements x1,…,xn is an ordering of an r-element subset of x1,…,xn. The number of r-permutations of n distinct elements is P(n,r)=n!(n−r)!
Example: How many ways can we select a chairperson, vice-chairperson, secretary, and treasurer froma group of 10 persons?
P(10,4)=10⋅9⋅8⋅7
Example: In how many ways can seven distinct Martians and five distinct Neptunians wait in line if no two Neptunians stand together?
- The Martians can stand together however they'd like, so there are 7! options for them. Because the Neptunians must have a Martian between them, there are 8 possible positions for them to stand. This means there are P(8,5) possible orderings of Neptunians.
7!⋅P(8,5)=33,868,800
Combination: An r-combination of X is an unordered selection of r elements of X. The number of r-combinations of n distinct objects is C(n,r)=P(n,r)r!=n!(n−r)!r!
- Notation: C(n,r)=(nr)
Example: In how many ways can we select a committee of two women and three men from a group of 5 distinct women and 6 distinct men?
C(5,2)⋅C(6,3)=200
Example: How many 8-bit strings contain exactly 4 ones?
C(8,4)=70