Section 1: Counting and Enumeration
1.1: The Basics
Permutations
A permutation on an -element set is an arrangement of the elements in a specific order. A -permutation is an arragement of elements from the set.
We assume that all elements are distinct, by property of sets.
The total number of -permutations on an element set is given as
This is also known as the falling factorial of . Let be positive integers. Then, the falling factorial is given as
Example: Permutations with Repetition
How many rearrangements of are there?
Note the repetition. If they were all distinct, we would have combinations!
If we treat our ‘s as 4 distinct letters, there are ways to permute them. Similarly, for , there are ways to permute them. These cases should only be counted one in the original question, so we need to divide them out.
So, we find that our answer is
This result (and intuition) can be generalized to a theorem.
Theorem: Multinomial Coefficient
Suppose object 1 occurs times, object 2 occurs times, object k occurs times, to give us objects.
Then, the total number of arrangements of the objects is
Called the multinomial coefficient.
Combinations
The total number of ways to create a -element subset from , n choose k, is denoted
and called a combination of binomial coefficient.
Note that this is essentially a permutation without the ordering! This is why we divide by - we’re removing all cases that have the same ordering!
Example: Combinations
There are 5 cats, 4 dogs, 5 mice. Three are chosen.
What are the total ways to get exactly 2 cats, 1 dog? Well, out of our 5 cats we choose 2, and out of our 4 dogs we choose 1! This gives us
What are the total ways to get at least 1 cat (3 animals total)? Note that in this case, we can’t simply do , as this double counts some cases! Instead, we want to make our cases mutually exclusive.
- First, say we choose 1 cat. We have options (choose 2 from the other non-cats to make 3).
- Next, say we choose 2 cats. We have options (choose 1 from the other non-cats to make 3).
- Finally, say we choose 3 cats. We have options.
This gives usoptions.
Binomial Theorem
For a positive integer , we have
The proof for above is omitted. However, intuitively, you can think of it as expanding
Then, for any , we can find its coefficient by choosing terms to contribute to the x, and choosing the remaining terms to contribute to the way. We find all ways we can do this (leading to the binomial coefficient you see!)
Example: Binomial Theorem Intuition, Extended
Suppose we are interested in the coefficient of from !
Well, of the 5 terms, we choose 3 to multiply the , 1 to multiply the , and 1 to multiply the . This gives us
This is essentially permutations with repetition!
Multinomial Theorem
1.2: Counting in Two Ways
Many combinatorial identities can be interpreted in multiple ways.
For example, consider
This describes the same count, but we can see it in 2 different ways!
- The right hand side describes the number of ways to create a -size subset from .
- The left hand side describes -size subsets that do or do not contain element .
- If we do contain , then we choose elements from the remaining elements.
- If we do not contain , then we choose elements from the remaining elements.
Another example:
This describes the total number of possible ways we can form a team with a leader among people.
- In the right hand side, we choose a leader from a group of people, and for the remaining people, they choose to “include” or “not include” them in the team.
- In the left hand side, we choose a team of people from total (), and among those people, choose a leader.
Another example:
- In the RHS, we describe all ways to create a 3-size subset from .
- In the LHS, let . We assign all of the elements to , , or , and find the number of ways we can create a 3-size subset, choosing 1 from each . First, let the first elements be in . Then, let the next element be in , and let the remaining be in . Choose 1 from each group , and find the number of ways we can do this. Thus, for any iteration, we have choices for , 1 choice for , and choices for .
1.3: Pigeonhole Principle
In its simplest form, the Pigeonhole Principle states that if pigeons into pigeonholes, there exists at least 1 pigeonhole with at least 2 pigeons. This is because you can fill in holes with 1 pigeon each, and are left with one extra pigeon that must go with one of the already filled holes.
More generally, if we have pigeons and pigeonholes, there exists a pigeonhole with at least pigeons (or, more than pigeons).
Example: Pigeonhole Principle
Prove that in a group of 40 poeple, at least 4 people have a birthday in the same month.
Here, let pigeons be people, and pigeonholes be months. We have 12 pigeonholes, and 40 pigeons.
By the pigeonhole principle, there exists at least 1 month with at least people.
Example: Pigeonhole Principle (2)
Prove that if 6 distinct numbers are chosen from , then two of the numbers will sum to 10.
Here, let pigeonholes be pairs of numbers summing to 10: , and let pigeons be our “choice” of number in our 6-number set.
By the pigeonhole principle, there exists at least 1 pair with at least choices, i.e. both numbers in the pair are selected. Note that we cannot have chosen twice, as the numbers are distinct.
Example: Pigeonhole Principle (3)
An athlete works out in blocks of hours. He plans to work out a total of 45 hours in a 30-day month. Assume he works out at least 1 hour each day. Prove that there is a period of consecutive days (2 or more) where the cumulative hours he has worked out is a total of exactly 14 hours.
Let be the accumulated hours up to the day . This gives us the sequence . Because we are doing at least 1 hour a day, this is a strictly increasing sequence- each number is distinct.
Consider the sequence . Note that the ‘s are distinct by our earlier assumption. We know that because , .
We find that our sequences take on at most 59 different values, but there are 60 total values, with ‘s and ‘s distinct! Thus, letting the ‘s and ‘s be pigeons, 1 - 60 be pigeonholes, by the pigeonhole principle, there must exist some value where the sequences overlap- .
So, - in other ways, from day to , the athlete worked out exactly 14 hours.
1.4: Compositions and Set Partitions
Compositions
Let be non-negative integers such that
Then the ordered -tuple is a weak composition of into parts.
This can be seen as a way to give dollars to people, where some people may get none!
How many weak compositions of into are possible?
Theorem: Stars and Bars
There are
Possible weak compositions of into .
Proof
Consider stars, and bars. We define a model where all stars to the right of the first bar (before the second bar) is the value of , all stars to the right of the second (before the third) is the value of , and so on and so forth for .
Observe that the first object must be a bar. This leaves objects that are not used. However we choose to place the remaining bars gives us a unique weak composition of into parts! So, we have
Possible compositions.
Example: Stars and Bars
How many non-negative integer solutions are there to ?
By the theorem, we have
Example: Stars and Bars (2)
There are 5 cokes, 7 sprites, and 6 Dr. Peppers. How many ways can we choose 4 sodas?
We can see this as being cokes, being sprites, being Dr. Peppers, and rephrase the problem as
Finding the total number of non-negative integer solutions.
What if a weak composition requires ? Well, we can simply give each 1, and then perform a weak composition on the remaining! This way, it doesn’t matter if the weak composition yields that someone got nothing, as they already have at least 1. We formalize this below.
The total -tuples satisfying , where each is a positive integer () is
Called a composition of into parts.
Partitions
Let be a finite set, and be non-empty subsets of . A partition of satisfies the following:
-
Their union makes up
-
The subsets are disjoint.
For a given , we say is partitioned into blocks.
Example: Partitions
Let .
We have 5 possible partitions:
Above, you can see that there are 3 cases of “2 blocks”.
A Stirling number of the second kind, denoted is the total number of partitions of into exactly blocks. By convention, .
There’s no easy formula for all ! However, we have some formulas for subsets of the stirling numbers.
Example: Stirling Numbers
What is ?
For , assign each number to 1 of 2 teams: . Subtract the cases where all are only in 1 team: .
Finally, divide by 2 because sets have no ordering.
Theorem: Stirling Numbers (Recurrence Relation)
For all non-negative integers ,
Proof
The LHS is the total number of partitions of into exactly blocks.
In the RHS, we consider partitions of where element “n” is a singleton block or not. If it is a singleton block, then we find the remaining blocks from the remaining. If it is not a singleton block, then we can create blocks from , and then put in any of the blocks ( choices).
Theorem: Stirling Numbers (Summation)
We have
The proof will be covered later!
What if we didn’t want to be limited by blocks?
The total number of partitions of into any # of blocks is the Bell number, denoted . By convention, .
Example: Bell Numbers
From an earlier example, let .
We have 5 possible partitions:
So, .
Theorem: Bell Numbers (Summation)
We have
Proof
The LHS describes all ways to partition .
In the RHS, we look at partitions depending on some element “n”, lying in a subset of size .
First, create one subset of size (1 element is always taken out before the choosing, hence the -1). Then, of the remaining elements, we find the number of ways to partition it.
Example: Partitions
Let .
Recall that is surjective / onto if for every , there exists an such that .
How many surjective functions are there?
Here, we want to partition our domain values into blocks, where each block will be associated with one output. We multiply by , the total number of ways to associate one combination of blocks with the outputs.
1.5: Integer Partitions
A partition of integer is a positive sequence of integers , where , such that
So, is the same as . What matters is not what’s inside of the blocks, but the sizes of the blocks relative to one another!
We denote the total number of partitions of by . By convention, .
The formula for this is extremely complex!
Example: Case
We find that
There are 5 total partitions of 4! .
A Ferrers diagram (or Young Diagram) of an integer partition is a partial rectangular grid whose row contains dots (rectangles).
These diagrams can illustrate some very interesting relationships! One diagram representing is given below.
Interestingly, the conjugate of a partition on a diagram is a new grid whose column is now . Here, the conjugate would yield
Basically, we flip the entire thing along a diagonal!
We can use this to establish some interesting identities!
Theorem: Integer Partitions Identity
The total number of integer partitions of such that equals the total number satisfying
Each partition has a size of at least 2!
Proof
Consider a partition such that .
If we were to draw a Ferrers diagram, we would find that the conjugate of the diagram corresponds to a diagram whose first two columns are always the same length, telling us that there are at least two dots in each row.
Thus, each must take on at least 2.
The converse also holds, with a similar proof.
The total partitions of into exactly parts is denoted .
Note that the previous definition did not establish this part requirement.
Theorem: Integer Partitions into Exactly Parts
For ,
Proof
The LHS describes the ways to partition into exactly parts.
The RHS considers partitions into parts for either or . If , we take one and partition the remaining into parts for a total of . If , we first give 1 to all parts, then partition the remaining into parts to guarantee that all numbers have at least 2.
1.6: The Twelvefold Way
We throw balls into bins. We consider the cases of the balls and bins being labeled (distinguishable) or not, and if each bin has no restriction, each bin has at least 1 ball, or each bin has at most 1 ball.
This forms 12 cases total, which can be solved with the methods described previously.
- Labeled balls to labeled bins
- No restriction: For every ball, we can put it in possible bins.
- At least 1 ball: We find the number of ways to partition into , and then permute what bin each group goes into.
- At most 1 ball (obvioulsly, ): Choose of the bins to place the balls into. Then, permute the ordering of how we place the balls.
- Unlabeled balls to labeled bins
- No restriction: Perform weak composition to decompose into (labeled) parts.
- At least 1 ball: First give each bin 1 dollar, then perform weak composition on the remaining parts.
- At most 1 ball: Choose bins of the to place a ball into.
- Labeled balls to unlabeled bins.
- No restriction: We partition the set of balls into , from . We do a sum instead of Bell numbers, as bell numbers will overcount (we cannot count higher than ).
- At least 1 ball: We partition the set of balls into parts.
- At most 1 ball: Just one way, as the bins are labeled!
- Unlabeled balls to unlabeled bins.
- No restriction: Some bins can be empty, so this is integer partitions into 1 bin, then 2 bins, and so forth until bins. Simple integer partitions assume the integers (bins) can never be empty, which is not true here.
- At least 1 ball: Each bin must have at least 1 ball, so this is integer partitions into parts.
- At most 1 ball: If , since nothing is labeled, we’ll just have bins filled with 1 ball. So, there is only 1 way.
Examples: The Twelvefold Way
A multiset is a set such that elements can be repeated. How many multisets of size 5 can be created using ?
We can convert this into one of the 12 ways. Consider 5 unlabeled balls to 7 labeled bins. Each ball is used as a counter to how many times the element occurs in the multiset.
Twenty students split into exactly 4 study groups to prepare for an exam (groups with 1 person are fine). However, brothers Bobs and Carl must be in the same group. Also, sisters Alice and Diane want to be in the same group. What are the possible number of groups?
First, as Bob / Carl, Alice / Diane must always be together, let’s group them into 1 entity each. So, we have 18 labeled balls into 4 unlabeled boxes, where each box must have at least 1 ball.
How many injective / one-to-one functions are there for ?
For each element in our range, we know that there is at most 1 value in our domain mapping to it. This is the same as labeled bins, labeled balls, where each bin can only have at most 1 ball.
Let . A function is monotone if whenever . How many monotonic functions are there?
Let us have labeled bins for the output, and unlabeled balls for the domain values. Note that these can be unlabeled, as the monotone constraint forces an order (the balls in bin 1 must correspond to the first values in the domain, and so forth). This is weak compositions! Thus, we have
1.7: Inclusion-Exclusion Principle
Theorem
Let , where is finite. Assume that the ‘s are non-empty.
Let , and denote . Define .
Then,
In other words, the union of all sets is the set minus the intersection of all subset combinations.
Applying Demorgan’s Law on this, we obtain
Where is the complement of .
Basically, sometimes when we want to find something, we can find it by considering its complements (which can be easer to solve)!
Example: Case
In the case, we have
This is commonly used everywhere in probability theory!
This principle is very useful in simplifying problems that may be quite complex, into simpler sub-problems that can be combined to yield our solution.
Example: Inclusion-Exclusion Principle
How many non-negative integer solutions are there to , where
Here, we have a max on our integers, which is really difficult to solve! However, it may be easier to solve using the inclusion-exclusion principle.
Here, we could perform weak compositions when , but we also have upper bounds.
Let
Note that , is all weak compositions.
We want
Example: Inclusion-Exclusion (2)
Use inclusion-exclusion to count the total surjective functions . In other words, each has at least 1 such that .
Define
So, the number of surjective functions can be found as
Note that the first term describes the number of indices we DON’T want to map to. If we do not map to indices, then there are indices that we need to map to, and for each value in our domain it can map to any one of these indices (hence the .
Which is a formula for Stirling numbers we found from earlier!
Example: Inclusion-Exclusion (3)
The Euler totient function is given as
Which is equivalent to the total number of values in that are relatively prime to (meaning they have no common divisors besides 1).
Let the prime factorization of be . Let
So, for example, if we have , , would be the number of numbers where 7 divides , . In other words, the number of multiples of 7!
So,
Between the last two steps, we find that this is equal to the ugly summations, as we’re basically choosing ‘s to find all possible combinations!
Example: Inclusion-Exclusion (4)
Twenty couples attend counseling. They sit at a circular, unlabeled table (exactly 40 chairs).
How many seatings assure no one sits next to their significant other?
Let denote the set where couple sits next to each other. We want
Note that what we are doing per term is selecting couples, then finding the number of orderings of our “40” people given that the couples are tied together (, because for each tied couple they’re 1 entity). Furthermore, we need to multiply by , as each couple pair could be swapped in order. Finaly, we divide by the number of rotations.
Note that we start at to include the empty set.