Lec 06
Lec 06
?
Nitin Saxena
IIT Kanpur
[ X
U− Ai = (−1)|I| · |AI | .
i∈[n] I⊆[n]
Proof of the principle. We will show the equality by finding the count of an element of U in RHS. If an
element u ∈ U is not contained in any of the sets AI then it will be counted exactly once (namely, by the
term |A∅ |).
So we only need to show that every other element is counted 0 times (overall). Suppose an element u ∈ U
is contained in Aj ’s for every j ∈ J, where J is the maximal nonempty subset of [n]. Then, the number of
times u gets counted in RHS is,
X
cJ := (−1)|I| · 1 .
I⊆J
This proves that every element of U is counted exactly once if it is not in any of the Ai ’s, and not counted
otherwise. This proves the inclusion-exclusion principle.
Example 1. Derangements: Suppose we have n letters and n envelopes with one envelope marked for one
particular letter. In how many ways could you place letter in envelopes (one letter goes to exactly one
envelope), s.t., no letter goes to the correct envelope?
This is the standard application of inclusion-exclusion and known as derangements. There are n! ways to
put letters into envelopes and that is our universe U . Suppose Ai is the set of ways when letter i goes to its
correct envelope. Hence, we are interested in U − ∪i∈[n] Ai .
placing |I| letters in the correct
To apply the inclusion-exclusion formula, we need to calculate AI . After
position, we have (n − |I|)! ways to place remaining letters. There are ni subsets of size i. Then the number
of derangements are,
n n
(−1)i
X n X
(−1)i (n − i)! = n! .
i=0
i i=0
i!
?
Edited from Rajat Mittal’s notes.
1 Recurrence relations
Recursion is a very helpful tool to solve problems in computer science and mathematics. We will look at
recursion as an aid to counting.
Suppose rabbit population needs to be introduced to an island. A pair of rabbits does not breed in its
first month, and produces a pair of offspring in each subsequent month (assume that there are no deaths).
Starting with one newborn pair, what will be the number of pairs after n months ?
Say, we denote the number of pairs in the nth month by Fn (F0 := 1, F1 := 1). There will be two kinds
of rabbit-pairs making up Fn : new-born (≤ 1 month old) and older. Fn−2 will be the new-born pairs, while
Fn−1 would be the older ones. So,
Fn = Fn−1 + Fn−2 .
This is called a recurrence relation for Fn . We gave a combinatorial argument for its proof. With the
initial condition (F0 = F1 = 1), this recurrence gives us an easy algorithmic way to compute the population
in the n-th month.
Many a times, it is hard to come up with an explicit formula for a mathematical quantity, but recurrence
relation gives us valuable information about it.
F0 + F1 + F2 + · · · + Fn = Fn+2 − 1.
The above sequence is very special and is known as Fibonacci sequence. That is, the numbers Fn are
called Fibonacci if they satisfy the recurrence Fn = Fn−1 + Fn−2 with the initial condition F0 = F1 = 1.
Exercise 4. There are n seating positions in a line. What is the number of ways of choosing a subset with
no consecutive positions?
If n is chosen then n − 1 isn’t. Thus, Fn = Fn−1 + Fn−2 .
Exercise 5. Write the recurrence relation for Sn – the number of subsets of a set with n elements.
Either n is chosen or not. Thus, Sn = Sn−1 + Sn−1 .
References
1. P. J. Cameron. Combinatorics: Topics, Techniques and Algorithms. Cambridge University Press, 1994.
2. K. H. Rosen. Discrete Mathematics and Its Applications. McGraw-Hill, 1999.