Enumerative Combinatorics
Contents
1.11. Enumerative Combinatorics#
Main references for this section are [37, 60, 81].
1.11.1. Basic Counting#
There are two basic principles of counting: the sum rule and the product rule. The sum rule is derived from the cardinality of union of disjoint sets. The product rule is derived from the Cartesian product of two sets.
1.11.1.1. Product Rule#
(Product rule)
Suppose an experiment has two aspects.
First aspect can vary in
If there are
Examples
If there are three possible coffee choices and two possible doughnut choices then the number of different combinations of coffee and doughnut are six.
If a t-shirt comes in three different sizes and four different colors, then there are twelve different varieties of the same t-shirt.
1.11.1.2. Sum Rule#
(Sum rule)
Suppose that the outcome of an experiment consists
of two different cases
In general, if the outcome of an experiment has
(sum rule for sets)
The sum rule in set theory is as follows.
If
Examples
Suppose a house has two floors. The first floor has
rooms and the second floor has rooms. Then the number of ways you can select a room is .Suppose a team has
men and women members. Then the number of ways you can select a team member is .Suppose we have to pick either a single letter or a single digit. There are
possible letters and possible digits. Thus, there are possible outcomes.
1.11.2. Permutations#
Permutations are different arrangements of a given finite set of objects.
(Permutation)
A permutation of
(Permutations of A,B,C)
Following are the possible permutations of the three letters A,B,C.
A, B, C
A, C, B
B, A, C
B, C, A
C, A, B
C, B, A
As we can see there are
Following are the possible ways to pick and arrange 2 letters out of the set {A, B, C, D}.
A, B
A, C
A, D
B, A
B, C
B, D
C, A
C, B
C, D
D, A
D, B
D, C
There are 12 possible
The number of
Proof. We proceed as follows.
There are
ways of choosing the first object.Once the first object has been chosen, there are
ways of choosing the second object.Continuing in the same manner, once
objects have been chosen, there are ways of choosing the -th object.At the end, when
objects have been chosen, then there are ways of choosing the last object.By the product rule, the total number of arrangements is
(Factorial)
The factorial of
By convention, we define
It is clear that the number of permutations of
objects is .We can also see that the number of
-permutations of objects is given by the formula
(Round table seating arrangement problem)
You are a family of three. You have invited five guests for a party. Your dining table can seat all the eight people. As hosts, you don’t want to sit together on the table. The guests can be seated arbitrarily. How many seating arrangements are possible?
We note that only the relative arrangements of people matters.
Let your family members be called A, B, C.
Let the guests be labeled as 1,2,3,4,5.
We shall identify an arrangement starting from where A is sitting and then going clockwise.
An example arrangement is A,1,2,B,3,4,C,5.
Note that neither B nor C can be at the end as that would lead to them sitting next to A.
Since A is always at the beginning of an arrangement, we can drop it.
Let us replace all the guests by *.
Then the arrangement looks like *, *, B, *, *, C, *.
Forget about the seats for the moment and just look at this arrangement.
We see that B and C must be placed between the guests so that they are not sitting next to each other.
We can think of slots between guests and denote them by |.
Then the guests and slots between them can be represented as * | * | * | * | *.
There are 4 slots between 5 guests.
We can see that we can place B and C into either of these 4 slots.
The number of ways the 2 slots out of 4 can be selected is
.Once the slots have been picked up by B and C, the guests can arrange themselves in
different ways.By the product rule, the total number of arrangements is
.
1.11.3. Combinations#
Assume that we have
The number of
There is only 1 way of to choose all
objects. Hence .There is only 1 way to choose none of the
objects. Hence .There are
ways to choose one of the objects. Hence .There are
ways to choose of the objects as it is equivalent to drop one of the objects. Hence .
The number of
Proof. This follows from the fact that each
By Theorem 1.41 the number of
-permutations of objects isLet
.Then for each of the unordered subsets of
elements, there are ways that we can arrange them in a specific order.Hence
by the product rule.
Hence we have
What is the number of ways to choose 3 hearts from a deck of cards at least one of which is an ace or a king?
There are 13 cards of the suit of hearts.
The selection includes a king but no ace. Number of ways to choose 2 other cards is
.The selection includes an ace but no king. Number of ways to choose 2 other cards is
.The selection includes both king and ace. Number of ways to choose the third card is
.Total number of ways is
Here is another way to divide the problem in two cases.
The selection includes an ace. In this case the number of ways the remaining two cards can be selected is
.The selection includes a king but not an ace. The number of ways the remaining two cards can be chosen is
.Hence total number of cases is
Here is a third approach.
Ace is included:
ways.King is included:
ways.Both of these cases include the case where both ace and king are included.
The number of ways both ace and king can be selected is
.Since this is double counted, hence we need to subtract it from total number of cases.
Thus, we get
1.11.4. Binomial Theorem#
(Binomial coefficient)
For any nonnegative
This is another name for the number of
(Binomial theorem)
For any
As a special case, we have
Setting
Proof. Consider the simpler cases first:
For
, both L.H.S. and R.H.S. reduce to .For
, the L.H.S. is . The R.H.S. is
We now consider the general case.
We can write
There are
factors of on the R.H.S..Consider the term
.This is attained by choosing
from factors and from remaining factors.There are
ways to choose out of factors from which can be picked.Thus, the coefficient of
in the expansion of is .The smallest power of
in the expansion is and the largest power is .Thus, we have
The special case is obtained by setting
and .
For any natural number
Proof. From the binomial theorem we have:
Differentiating on both sides, we get
Putting
1.11.5. Bijections#
Recall from Definition 1.82 that two sets are equivalent if there exists a bijection (a bijective function) between them. In that case, the sets are said to have the same cardinality. In this section, we are dealing with finite sets only. Recall from Definition 1.84 that a set is called finite if there is a bijection between the set and a segment of natural numbers. Thus, there exists a bijection between two finite sets, then they have the same number of elements. This gives us a powerful method of counting the number of elements in a finite set. If we can find a bijection between a given set and a set whose number of elements is known, then we know the number of elements of the given set is also known. This technique is known as the bijective technique.
We use this technique to provide a proof for the number of subsets of a finite set.
(Number of subsets of a finite set)
Let
Proof. We develop a bijection between subsets
of
Let
.Let each bit of a binary string
correspond to an element of ( ).For each subset
of , the let the corresponding binary string be formed as follows:If
, then .Otherwise,
.
It is easy to see that this is a bijection between the set of subsets of
and the set of binary strings of length .The number of possible binary strings of length
is since each bit can take exactly values.Hence, due to the equivalence of the two sets, the number of subsets of
is .
Following is an example of mapping between
subsets of the set
subset |
|||
---|---|---|---|
0 |
0 |
0 |
|
1 |
0 |
0 |
|
0 |
1 |
0 |
|
0 |
0 |
1 |
|
1 |
1 |
0 |
|
0 |
1 |
1 |
|
1 |
0 |
1 |
|
1 |
1 |
1 |
1.11.6. Combinatorial Proofs#
(Combinatorial proofs)
If
(Combinatorial identity)
Let there be two functions
The equation
Note
The concept of combinatorial proofs and identity is also applicable to the problems with multiple variables.
Proof. Consider the problem of choosing
By definition, the number of ways
objects can be chosen from a set of objects is given by .Choosing
objects from a set of objects is equivalent to leaving the remaining objects from the set.The number of ways to leave
objects out of objects is .Hence we have the combinatorial identity
1.11.6.1. Sum of Binomial Coefficients#
For every natural number
We already showed this result in Theorem 1.43. Let us look at a combinatorial proof.
By Theorem 1.45, the number of subsets of a set of
elements is .Another way of counting the number of subsets of
elements is as follows.Each subset has
elements where .The number of subsets of
elements is .Hence total number of subsets is
.
By Theorem 1.46, the two must be equal.
1.11.6.2. Pascal’s Identity#
(Pascal’s identity)
For integers
Proof. Let there be
The L.H.S. is the number of ways of choosing
objects from object.Fix some object
.In a selection of
objects, either is selected or it is not selected.If
is selected, then there are ways of selecting the remaining objects.If
is not selected, then all the objects must be selected from the remaining objects.The two cases are mutually exclusive and add up to
on the R.H.S..
1.11.6.3. Hockey Stick Identity#
Consider the problem of choosing
Let us label the objects as
.We consider
different cases as follows.Each subset can be identified by the largest label inside it.
In the
-th case, we consider all the subsets where the largest label is .Since this object is decided, the number of ways of choosing the remaining
objects from the objects whose labels are smaller than is given by .Since any such subset must have at least
objects, hence the minimum possible value of is .The maximum possible value of
is .Hence, the total number of elements is given by
We get the identity
By replacing
with , we get another version
This identity enables us to compute
(Hockey stick identity)
Note that for
Proof. Consider the set of
The R.H.S. is the number of ways of choosing
numbers from .For any
, consider the ways of choosing numbers from such that is the highest number in the subset.Since
is already chosen and all other numbers must be less than , hence there are ways of choosing remaining numbers. can vary from to .Each term on the L.H.S. is the number of ways of choosing
numbers so that is the highest number.These are mutually exclusive cases.
Hence, L.H.S. is also the number of ways
numbers can be chosen from .
1.11.6.4. Vandermonde’s Identity#
(Vandermonde’s identity)
For any nonnegative integers
Proof. We shall use a combinatorial double counting proof.
Let
be a set of objects which can be split into two disjoint subsets of objects and of objects.For example, a committee of
people can be split into subgroups of men and women.The number of ways to select
objects from is given by .Each selection of
objects consists of objects from the subset and the remaining objects from the subset where .There are
ways of selecting objects from .There are
ways of selecting objects from .Hence, by the product rule, there are
ways of selecting
objects from and objects from .By the sum rule over possible values of
, the number of ways of choosing objects from is given byHence, L.H.S. an R.H.S. must be identical.
For any nonnegative integer
1.11.6.5. More Identities#
Consider two sets
Method 1
There are
ways of choosing objects out of the objects we have.There are
ways in which no object from the set has been selected.Hence, the number of ways to select at least one object from
is given by
Method 2
We can consider the following
different cases. objects from the set have been chosen where .For the
-th case, the total number of ways to choose objects from the set and the remaining objects from the set is given byHence, the total number of ways of choosing
objects from and with at least one object from isBy Theorem 1.46, we get the combinatorial identity
1.11.7. Counting with Repetitions#
We now consider a different type of problem.
Rather than selecting objects from a given
set of
(Two digit numbers)
How many 2 digit numbers are possible?
On the first digit, we can have one of the nine nonzero digits.
On the second digit, we can have any of the ten digits.
Hence, total number of two digit numbers is:
Readers can verify that this includes all the numbers from
to .We allow for repetition (e.g.
).
(Four digit pins)
We often use
1.11.7.1. Combinations with Repetitions#
The number of ways of choosing
Proof. The
We have
slots (or urns) for the categories.There are
bars between them.Suppose that
objects that have been chosen can be split as objects of the category , objects of categories and so on.Then we have
Note that some of the
may be zero also.Let each object be represented by the symbol
(dash).Then the arrangement may look something like
dashes followed by a bar, then dashes followed by a bar and so on.Different arrangements of
dashes and bars lead to different ways of selecting objects from categories of objects.We can think of the arrangement as a string of dashes and bars.
Then, the problem is equivalent to the counting the number of strings consisting of
dashes and bars.The total length of such strings is
.The number of strings with
dashes is .This is also same as the number of strings with
bars which is .
1.11.7.2. Multiset Permutations#
(Multiset permutations)
Let
Then, the number of permutations of these
Proof. Approach 1
If all
objects were distinct, then the number of permutations will have been .Now, when
of these objects are indistinguishable from each other, then all permutations of these objects are identical.Hence, making the
objects indistinguishable reduces the number of arrangements to .Similarly, making the next
objects indistinguishable from each other reduces the number of arrangements to .Continuing in the fashion, making the last
objects indistinguishable from each other reduces the number of arrangements to .
Approach 2
In any arrangement of
objects, there are slots.The number of ways we can choose
slots to place first objects of type (which are indistinguishable) is given by .The number of ways we can choose the next
slots to place next objects of type (which are indistinguishable) is given by .Continuing in the same manner, the number of ways to choose the last
slots to place the last objects of type (which are indistinguishable) is given by .By the product rule, the total number of ways is
This expands to
(Volunteer selection)
You have 3 projects A, B and C. You have a team of 20 volunteers available.
Project A needs 3 people.
Project B needs 5 people.
Project C needs 9 people.
How many ways, can you assign volunteers to projects?
We can introduce a fourth category D of volunteers who are not assigned to any project.
The D category has
volunteers.Thus, we need to split 20 volunteers into 4 groups of sizes 3,5,9, and 3 respectively.
A particular assignment might look like
Another assignment might look like
We can see that the assignment consists of permutations of 20 labels which are of 4 types (A, B, C, D).
Hence the number of permutations is given by
1.11.7.3. Multinomial Theorem#
(Multinomial coefficient)
For nonnegative integers
It is clear that the multinomial coefficient is
equal to the number of permutations of
Also note that for
(Multinomial theorem)
For arbitrary
The number of terms of the sum on the R.H.S. is given by
Proof. Consider the basic cases first.
For
, the result is trivial as there is exactly one term on the R.H.S. given by .For
, (1.4) reduces toWe replaced
by and by .This is the binomial theorem already proven in Theorem 1.43.
For
, both L.H.S. and R.H.S. reduce to .
We now consider the general case.
Each term on the R.H.S. is of the form
such that
and is some coefficient.There are
types of variables .In the product, there are total
variables.The number of ways
objects of types can be selected is given bydue to Theorem 1.51.
This establishes the number of terms on the R.H.S..
It remains to calculate
.We can see that
arises on the R.H.S. from the different permutations of variables of type , variables of type and so on up to variables of type .The number of permutations of
variables of types with counts is given bydue to Theorem 1.52.
Hence
as per the definition of the multinomial coefficient.
1.11.8. Recursion#
(Recursively defined sequence)
We say that a sequence
(Fibonacci sequence)
The famous Fibonacci sequence,
denoted by
. .for every
, we have
The sequence is attributed to the Italian mathematician Leonardo Pisano (“Fibonacci”) of the 13th century. However, it has been known to Indian mathematicians as early as the 6th century.
For recursive sequences, we aim to solve the following types of problems:
Devise a formula for
such that one doesn’t have to compute every term in the recursion to compute .If such a closed form solution is not possible, then develop some upper or lower bounds on the value of
.
1.11.9. Induction#
The principle of mathematical induction plays a major role in many important results in enumerative combinatorics. This is especially relevant for recursively defined sequences. We suggest the readers to review the definitions and results in Principle of Mathematical Induction.
We shall show that
for every integer
Base case: for
we have .Inductive hypothesis: assume that the statement is true for some
; i.e.,Inductive step:
For
, we haveSince
, hence .Hence
Since
, hence .Hence
.Hence
Thus, the inequality is true for
also.
Hence, by mathematical induction, the inequality holds for every
.
The sum for first
We show this equality using a recursively defined sequence.
Let
.Let
for every .We can see that
is a recursively defined sequence where the -th term represents the sum of first natural numbers.
We now prove that
For
, .Assume that the equality is true for some
.Then for
, we haveWe can see that the equality holds for
also.Hence, by mathematical induction, it holds for all
.
1.11.9.1. Strong Induction#
The following examples require the principle of strong induction (Theorem 1.22).
Consider the sequence
.For every
,
We can see that
. . .
We now claim that
We are given that
.By strong induction hypothesis, let us assume that
for every with .By the recursive relation, we have
Thus, the equality is true for
also.Hence, by principle of strong induction, it is true for every
.
You are given
We claim that it will take
Base case: for
, there is a single disk and it is the tower in itself. Hence nothing more is to be done. Number of moves required is .Strong induction hypothesis: Assume that for some
, you can make the tower of disks in moves for every .Induction step: Consider the problem of stacking
disks.We can see that the last step consists of stacking the last remaining two towers into a single tower.
Assume that the two remaining towers
and have and disks respectively.Both towers consist of at least
disk.Hence neither tower can have
disks.Clearly,
and .It will take
moves to form the tower by induction hypothesis.It will take
moves to form the tower by induction hypothesis.It will take
more move to stack and together.Hence total number of moves required is
Hence to stack a tower of
disks, we need moves.
We can see that by strong induction, for every
, it takes moves to stack the disks into a single tower.
1.11.10. Pigeonhole Principle#
Pigeonhole principle is one of the most powerful counting arguments.
(Pigeonhole principle)
If there are
If there are
Proof. We argue as follows.
Consider the first
objects.If any two of these objects belong to the same category, then we are done.
Otherwise, there is exactly one object for each of the
categories from this set of first objects.There are
objects still left. Hence there is at least one more object.This object must fall into one of the
categories.This category will then have at least
items.
(Sock-picking)
Assume that a drawer contains socks of two colors (blue and black). The socks can be worn on either foot. We are pulling the socks from the drawer without looking at them. What is the minimum number of socks we need to pull so that we are guaranteed to have a pair of same color?
Socks are the objects.
Each color can be considered as a category.
There are thus
categories.We need more than one sock in at least one category.
If
, then we have at least one color for which we have two or more socks.Minimum value of
satisfying is .Thus, we need to draw at least
socks to guarantee that we have one pair of same color.
(Hand-shaking)
Let there be
One person can shake hands with at the minimum
number of people and at the maximum number of people.We define the categories as the number of people to which one has shaken hands.
Thus, the categories are labeled
.We can see that there are
categories and people.However, the category
and category cannot both have a person simultaneously.Suppose there is someone who has shaken hands with no one.
Then there cannot be anyone who has shaken hands with everyone.
Hence if category
is nonempty, then category must be empty.Now suppose there is someone who has shaken hands with everyone.
Then there cannot be anyone who has shaken hands with no one.
Hence if category
is nonempty, then category must be empty.
Thus, either
or or both must be empty.Hence the
people must be fitted into at most categories.By pigeonhole principle, at least one of these categories must have more than one person.
(Hair counting)
At any given time there live at least two people in California with the same number of hairs on their heads.
The current population of California is around
million.Typical human head has an average of about
hairs.An upper bound on the number of hairs on human head is
million.Hence by pigeonhole principle, there must be people in California with the same number of hairs on their heads.
(Subset sum)
Consider the set
Let us first identify which pairs of numbers sum to
.We can see that
. There are such pairs.We now split the
numbers to categories as follows: .
Consider any subset of
of elements.Let its members be
.Put these numbers into the
categories above based on rule that a number should go into the category mapped for it.There are
categories and numbers.By pigeonhole principle, at least one of the categories should have more than one number.
Category
cannot have two numbers. It can only have .Hence, at least one of
has two numbers.But each of these categories consist of two numbers whose sum is
.Hence every
element subset of must contain at least two numbers whose sum is .
(Same color rectangle)
Let there be
To prove this, we need to discretize the problem first so that we can apply the pigeonhole principle. We can do this by creating a grid of points.
Consider an
grid of points.If there are enough number of rows, then we can guarantee that some of points in each column have same color.
Similarly, if there are enough number of columns, we can guarantee that some of the points in each row have same color.
If we can guarantee that two rows and two columns contain points of same color, we have found a rectangle of same color corners.
How many rows and columns do we need?
We consider a grid of points with
rows and columns.Let
. Hence, we have columns.Let us first examine the points each column.
There are
points in each column.There are only
colors which can be assigned to point.Hence, in each column, there exists a pair of points which has the same color.
Now examine the pair of points in each column.
Since there are
points, hence there are pairs of points in each column.There are
pairs of points and colors.Hence there are
ways of choosing a unique pair of points and a unique color.Thus, in at most
columns, a pair of points doesn’t appear at the same location with the same color.Hence if we have
columns, then there exist at least two columns such that the same color occupies the same two locations in both the columns.These four points form a rectangle whose points have the same color.
1.11.10.1. Generalized Pigeonhole Principle#
(Generalized pigeonhole principle)
If there are
Proof. .
Consider the first
objects.If
of them fall into the same category, we are done.Otherwise, exactly
of them must fall into the each category.Since
, hence there is one more object.This object must fall into one of these
categories.Since every category already has
objects, hence there will be objects in the category to which the -th object falls.
We show the application of the generalized pigeonhole principle to prove Erdős–Szekeres theorem.
(Erdős–Szekeres theorem)
For every pair of integers
Proof. Let
If there exists some
such that then we are done.Otherwise, we have that
for every .We note that for every
, there exists an increasing subsequence of length .Hence
for every .Hence we have
for every .Hence, there are
possible values of .Since
, hence there exists at least values of which have the same value of due to the generalized pigeonhole principle.Let
be a subsequence of such that is identical for every .We now claim that
is a decreasing subsequence of .Let
such that appears before in .Since all values in
are distinct, hence .Assume that
.Then by taking
and the increasing subsequence of of length starting at , we can form a subsequence of length starting from .This contradicts the fact that
.Hence
must hold.Hence for every
, such that , we have .Hence we have
.Hence there exists a decreasing subsequence of length
.
1.11.11. Inclusion Exclusion Principle#
Recall from Remark 1.23 that for finitely many mutually disjoint finite sets, the number of elements of their union is equal to the sum of the number of elements of individual sets.
Inclusion-exclusion principle is a way of counting the number of elements of unions of finite sets which may be overlapping.
For two sets, we add the counts of individual sets, then subtract the count of their intersection.
For three sets:
Add the counts of individual sets
Subtract the counts of their pairwise intersections
Add the count of their triple intersection.
For four sets:
Add individual counts
Subtract pairwise intersection counts
Add counts of intersections of every selection of three sets
Subtract the count of the intersection of all sets.
And so on.
(Inclusion-exclusion principle for 2 sets)
Let
Proof. .
Recall that
and are disjoint andHence
.Similarly
.Also recall that
and these three sets are disjoint.
Hence
.Substituting from previous identities
as desired.
We can now generalize the principle for a finite number of sets
Let
where
In general for every
One can see that there are
Proof. We prove this result by mathematical induction.
Base case: The statement is true for
, sinceInductive hypothesis: Assume that the statement is true for some
.We shall now prove it for
.Let
be a family of sets.Let
.Then
.By Theorem 1.57, we have
By inductive hypothesis:
where
Let
for .Then
.By inductive hypothesis:
where
We can now write
We now define
for as follows:For
we defineFor
we defineWe can see that the terms in
are the intersections of sets from not includingThe terms in
are intersections of sets from including .Hence the terms in
are the intersections of sets from . is indeed the sum of cardinalities of all -set intersections of .
For
we defineThis is nothing but the one and only intersection of all sets in
.
We can see that
where
Hence the inclusion-exclusion principle statement is true for
also.Hence by mathematical induction, the statement is true for all
.
1.11.12. Generating Functions#
A generating function is a way of encoding an
infinite sequence of numbers
(Ordinary generating function)
The ordinary generating function of a sequence
A generating function is not evaluated for any specific
value of
(Exponential generating function)
The exponential generating function of a sequence
1.11.12.1. Generalized Binomial Theorem#
Recall from Theorem 1.43
that for a nonnegative integer
We now wish to generalize it for negative
(Generalized binomial coefficient)
For any real
Note that for a nonnegative
(Binomial coefficient for negative integers)
If
Proof. We have
Factoring
out of each term in the R.H.S. numerator gives us
(Generalized binomial theorem)
For any
We shall show that
Let
.Then
.By Theorem 1.60,
By Theorem 1.59
Hence
But
.Putting back, we get