0% found this document useful (0 votes)
446 views8 pages

Inclusion-Exclusion and Special Numbers: Theorem 1 (Inclusion-Exclusion Principle) - For Any Collection (A

The document discusses inclusion-exclusion and special numbers. It begins by presenting an alternative formulation of the inclusion-exclusion principle using summation notation. It then provides two programming exercises asking how many times a print statement would execute based on nested for loops representing terms in the inclusion-exclusion formula. The document continues discussing applications of inclusion-exclusion to counting onto functions, derangements, and combinations with repetition. It concludes by introducing Stirling numbers of the first and second kind and their relationships to permutations and set partitions.

Uploaded by

Bil Mafrouch
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
446 views8 pages

Inclusion-Exclusion and Special Numbers: Theorem 1 (Inclusion-Exclusion Principle) - For Any Collection (A

The document discusses inclusion-exclusion and special numbers. It begins by presenting an alternative formulation of the inclusion-exclusion principle using summation notation. It then provides two programming exercises asking how many times a print statement would execute based on nested for loops representing terms in the inclusion-exclusion formula. The document continues discussing applications of inclusion-exclusion to counting onto functions, derangements, and combinations with repetition. It concludes by introducing Stirling numbers of the first and second kind and their relationships to permutations and set partitions.

Uploaded by

Bil Mafrouch
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Inclusion-Exclusion and Special Numbers

1 Introduction
There are dierent ways to state the inclusion-exclusion principle. One which is dierent from
that in the text but which may be easier to follow is
Theorem 1 (Inclusion-Exclusion Principle). For any collection {A
i
}
n
i=1
of sets

n
_
i=1
A
i

=
n
_
i=1
|A
i
|
_
1i
1
<i
2
n
|A
i
1
A
i
2
| +
_
1i
1
<i
2
<i
3
n
|A
i
1
A
i
2
A
i
3
|
+(1)
n+1
|A
1
A
2
A
n
|
=
_
1jn
1i
1
<i
2
<<i
j
n
(1)
j+1

j
_
k=1
A
i
k

Proof. Let x
_
n
i=1
A
i
. Suppose x is in exactly k of the sets {A
i
}. Then we can count the
number of times x gets counted on the right-hand side of the equation by
_
k
1
_

_
k
2
_
+
_
k
3
_
(1)
n+1
_
k
n
_
=
_
k
1
_

_
k
2
_
+
_
k
3
_
(1)
k+1
_
k
k
_
= 1 (1 1)
k
= 1
Thus each element counted on the left side gets counted exactly once on the right.
Exercise 1: The second summation sign on the right-hand-side of the inclusion-exclusion equa-
tion involves an iteration that can be described by the following nested for loops. How many
times will the statement be printed in the following program?
for i = 1 to n-1;
for j = i+1 to n;
print("Hello class");
next j;
next i;
Exercise 2: The third summation sign on the right-hand-side of the inclusion-exclusion equa-
tion involves an iteration that can be described by the following three nested for loops. How
many times will the statement be printed in the following program?
MA 367 October 25, 2002
Inclusion-Exclusion Handout Page 2
for i = 1 to n-2;
for j = i+1 to n-1;
for k = j+1 to n;
print("Hello again class");
next k;
next j;
next i;
2 Onto Functions
Let N
n
= {1, 2, . . . , n}. The basic question for us here is how many functions f : N
m
N
n
are onto? We have looked at special cases of this question already. The general case can be
resolved by inclusion-exclusion.
Let A
i
= the set of functions from N
m
N
m
which omit the number i from their range.
Then
|A
i
| = (n1)
m

A
i
A
j

= (n2)
m
(if i = j)
etc.
So,

A
1
A
2
A
n

A
1
A
2
A
n

= n
m

_
n(n1)
m

_
n
2
_
(n2)
m
+ +(1)
n+1
_
n
n1
_
1
m
_
=
n1
_
i=0
(1)
i
_
n
i
_
(ni)
m
3 Stirling Numbers of the Second Kind
The number of surjective (onto) functions from N
m
N
n
is closely related to one of the
types of Stirling numbers. Stirling studied two important classes of numbers that occur as
coecients in special polynomials. The second type he studied occurs more naturally in this
context. We will discuss the rst type later. The Stirling numbers of the second kind, S(m, n),
are dened to be the number of ways to distribute m distinguishable objects into n identical
boxes with no box left empty. Equivalently, S(m, n) is the number of partitions of a set of size
m into n non-empty (disjoint) subsets. In order to understand this last statement, we need
some denitions.
Denition 1. A partition of a non-empty set S is a collection of non-empty subsets of S, A=
{A
1
, . . . , A
n
} so that
n
i=1
A
i
= S and the collection Ais pairwise disjoint, i.e., A
i
A
j
= for
all i = j.
MA 367 October 25, 2002
Inclusion-Exclusion Handout Page 3
Denition 2. For any function f : A B, the notation f
1
(b) denotes {a A|f(a) = b}. The
set f
1
(b) is called the set of pre-images of b under f.
Note that for any onto function f : A B, the collection {f
1
(b)|b B} is a partition of A
into |B| sets. Also note that, given any partition of A into |B| sets, there are |B|! ways to dene
a function from A to B so the pre-images match the partition sets.
Since S(m, n) =
1
n!
(number of onto functions fromN
m
N
n
), we have a formula for Stirling
numbers of the second kind:
S(m, n) =
1
n!
n1
_
i=0
(1)
i
_
n
i
_
(ni)
m
(1)
Exercise 3: Show that S(m, n) = S(m 1, n 1) + nS(m 1, n), i.e., devise a combinatorial
argument that shows this equation holds in general. Then make a table of values for 1 m 8
and 1 n m.
4 Derangements
Of the n! permutations of the elements in the set N
n
, some have an integer i in the i
th
position
(for some i) and some do not have any numbers in their correct position. We call those that
do not derangements. The number of derangements of a set of size n can be computed using
inclusion-exclution on the complementary event.
Exercise 4: Find a formula for the number of derangements, D
n
, of a set with n elements.
Exercise 5: A hat check person discovers that n peoples hats have been mixed up and returns
these hats to the owners at random.
1. In how many ways can the hats be returned so that all of the owners get the wrong hat?
2. What proportion of the total number of distributions do these represent?
3. What limiting value does this proportion have (as n )?
Exercise 6: Show that
D
n
= (n1)(D
n1
+D
n2
) for n 3 (2)
D
n
= nD
n1
+(1)
n
for n 2 (3)
5 Combinations with Repetition
For convenience, we introduce the notion of a multiset.
Denition 3. A multiset is an ordered pair (S, f) where S is a non-empty set and f : S N.
MA 367 October 25, 2002
Inclusion-Exclusion Handout Page 4
What the heck does that mean? Well, if we want to count the number of ways to select
three marbles from ve red ones and four green ones, we could phrase the problem as how
many 3-combinations are there from the multiset {5r, 4g}? Here, the underlying set is {r, g}
and the function is just f(r) = 5 and f(g) = 4. So multisets just provide a convenient nota-
tion/terminology for counting problems in which there is a limited supply of objects.
We already have formulfor the number of r-combinations of ndistinct objects and also for
the number of r-combinations of a multiset with k distinct objects each with innite repetition
number. This latter count can be modelled by placing r identical balls in k distinct boxes so
the number is
_
k+r1
r
_
.
Using inclusion-exclusion, we can now determine the number of r-combinations of a mul-
tiset where the repetition numbers are not innite. In other words, we can count the number
of ways r identical balls can be placed in k distinct boxes where we require that each box gets
no more than some particular number of balls. Before when we encountered problems of this
type, they we contrived so that they were not too complicated. Now we can handle the general
case of such problems.
Example 1: Find the number of 10-combinations of the multiset {5a, 4b, 3c}.
Solution: We can think of placing 10 identical balls into three distinct boxes where the rst box
gets 5 or fewer balls, the second gets 4 or fewer, etc. Let A be the set of distributions of 10 balls
into the three boxes so that the rst box has more than 5 balls, let B be the set of distributions
so that the second box has more than 4 balls, etc. Then

AB C

AB C

=
_
10 +3 1
10
_
|AB C|
=
_
12
10
_
[|A| +|B| +|C| |AB| |AC| |B C| +|AB C|]
=
_
12
10
_

__
6
4
_
+
_
7
5
_
+
_
8
6
_
0 1 3 +0
_
= 66 15 21 28 +1 +3
= 6
Example 2: Find the number of solutions to the equation
x
1
+x
2
+x
3
= 12
subject to the constraints
1 x
1
5
1 x
2
4
1 x
3
3
MA 367 October 25, 2002
Inclusion-Exclusion Handout Page 5
Solution: This is the same problem as the previous one.
Exercise 7: Use inclusion-exclusion to nd the number of integers between 1 and 10,000 in-
clusive which are not divisible by 4, 5, or 6.
Exercise 8: Determine the number of solutions of the equation x
1
+x
2
+x
3
= 14 in positive
integers not exceeding 8. Do the same problem for non-negative integers not exceeding 8.
Exercise 9: In how many ways can eight pieces of identical candy be passed out to three
children so that each child gets at least one piece but no child gets more than four pieces?
6 Stirling Numbers of the First Kind
Recall our notation for r-permutations of n objects: P(m, n) = m(m1) (mn+1).
If we regard P(m, n) as a polynomial in the formal variable x, we get P(x, n) = x(x
1) (x n+1) where m has been replaced by x to emphasize that we are regarding this as
a polynomial in (now) x. Expanding, we get a polynomial of degree n of the form P(x, n) =
a
n
x
n
+a
n1
x
n1
+ a
1
x +a
0
.
Denition 4. The Stirling numbers of the rst kind are dened by s(n, j) = a
j
where the a
j
s
are as above. In other words, the Stirling numbers of the rst kind, s(n, j), are the polynomial
coecients determinied by the equation
P(x, n) = x(x 1) (x n+1) =
n
_
j=1
s(n, j)x
j
. (4)
Exercise 10: Write P(x, 3) as a polynomial in standard form and read o the s(3, j) values.
Now calculate the s(4, j) values similarly.
The Stirling numbers of the rst kind satisfy a recurrence relation as follows.
Theorem 2. For any integers m, n 0,
s(m, n) = s(m1, n1) (m1)s(m1, n). (5)
Proof. Note that
m
_
j=0
s(m, j)x
j
= P(x, m)
= P(x, m1) (x m1)
=
m
_
i=0
s(m1, i) (x m+1)
=
m1
_
i=0
_
s(m1, i) x
i+1
(m1) s(m1, i) x
i
_
.
Equating coecients of like terms on the two sides gives the result.
MA 367 October 25, 2002
Inclusion-Exclusion Handout Page 6
Exercise 11: Construct a triangle (table) for the Stirling numbers of the rst kind.
Recall that Stirling numbers of the second kind, S(m, n), were dened earlier as the number
of set partitions of a set of size n into exactly m non-empty subsets. It turns out that these
Stirling numbers can also be view as polynomial coecients.
Theorem 3. For any positive integers, m and n,
n
m
=
n
_
j=0
S(m, j) P(n, j).
Proof. The proof relies on the following three observations:
1. The total number of functions f : N
m
N
n
is n
m
.
2. Each function f : N
m
N
n
is onto some subset of N
n
.
3. There are
_
n
k
_
of size k in N
n
.
Putting these observations together, we have
n
m
=
n
_
j=0
_
n
j
_
S(m, j) j!
=
n
_
j=0
n!
(nj)!
S(m, j)
=
n
_
j=0
S(m, j) P(n, j)
Corollary 1. The Stirling numbers S(n, j) can be used to re-write the monomial x
n
as a linear
combination of falling factorials
x
n
=
n
_
j=0
S(m, j) P(x, j).
Exercise 12: Write x
3
and x
4
as a sumof falling factorials, i.e., as a linear combination of terms
of the form P(x, j).
7 Eulerian Numbers
Recall that the binomial coecients
_
n
k
_
satisfy the property that

n
k=0
_
n
k
_
= 2
n
. In terms of
Pascals triangle, this says that the sum of the numbers on the n
th
row is 2
n
. In this section
we will examine a dierent collection of numbers that have properties similar to the binomial
coecients. They will be symmetric, they will t naturally in a triangle, but rows in the triangle
will sum to n!.
MA 367 October 25, 2002
Inclusion-Exclusion Handout Page 7
Denition 5. The Eulerian numbers, denoted
_
n
k
_
, are dened as the number of permutations
on N
n
that have exactly k rises. (A rise occurs when a number in a permutation is larger than
its predecessor.)
Some authors dene Euler numbers slightly dierently than the above denition, so you
always have to check the denition being used if you encounter Euler numbers elsewhere.
It is easy to construct a combinatorial argument that shows the Euler numbers satisfy a
recurrence relation of the form
_
n
k
_
= (nk)
_
n1
k 1
_
+(k +1)
_
n1
k
_
, n 0, k N, (6)
_
0
0
_
= 1,
_
0
k
_
= 0 (k = 0)
Exercise 13: Use the recurrence relation to make a table of Eulerian numbers, either as a right
triangle (table), or as an equilateral triangle (as is common in Pascals triangle). Check the sum
on each row and see what you get. Do you see a pattern?
Exercise 14: List the 24 permutations of N
4
(you may want to begin with N
3
as a warmup). For
each permutation, count the number of rises, i.e., count the number of times a given number is
larger than its predecessor. For example, the permutation 3412 has the form34 12 and has
2 rises. Now total the number of permutations that have 0 rises, then 1 rise, etc. Compare the
numbers you get to the fourth row in the Eulerian triangle computed in the previous exercise.
Make a conjecture.
Euler numbers are symmetric since the number of permutations with k rises equals the
number of k falls. This observation gives
_
n
k
_
=
_
n
nk 1
_
(7)
Euler numbers occur in solutions to several mathematical and statistical problems. One
well-known problem is the Smith College diploma problem described in [?]. They also occur
in several combinatorial formul. For example, the Euler numbers are the coecients needed
to express the monomial x
n
as a linear combination of binomial coecients:
x
n
=
n1
_
k=0
_
n
k
_
_
x +k
n
_
. (8)
The Euler numbers also can be expressed in a closed-form summation formula similar to
that of the Stirling numbers of the second kind.
_
n
m
_
=
m
_
k=0
_
n+1
k
_
(m+1 k)
n
(1)
k
(9)
Exercise 15: In [?], the following problem is posed. The notation has been adjusted to match
this handout. Show that
n1
_
j=0
2
j
_
n
j
_
=
n
_
j=1
S(n, j) j!.
MA 367 October 25, 2002
Inclusion-Exclusion Handout Page 8
References
[1] R.L. Graham, D.E. Knuth, and O. Patashnik, Concrete mathematics, Second Edition, Addison-
Wesley, Reading, MA, 1994.
[2] R. Maurer, Problem E2404, Amer. Math. Monthly 80 (1973), 316.
[3] Western Maryland College Problems Group, Problem 11007, Amer. Math. Monthly 110 (4),
April 2003, 340.
MA 367 October 25, 2002

You might also like