Chapter 4
Some Counting Problems; Multinomial Coe cients, The Inclusion-Exclusion Principle, Sylvester’s Formula, The Sieve Formula
4.1 Counting Permutations and Functions
In this short section, we consider some simple counting problems.
Let us begin with permutations. Recall that a permutation of a set, A,isanybijectionbetweenA and itself.
427 428 CHAPTER 4. SOME COUNTING PROBLEMS; MULTINOMIAL COEFFICIENTS If A is a finite set with n elements, we mentioned earlier (without proof) that A has n!permutations,wherethe factorial function, n n!(n N), is given recursively by: 7! 2 0! = 1 (n +1)!= (n +1)n!.
The reader should check that the existence of the func- tion, n n!, can be justified using the Recursion Theo- rem (Theorem7! 2.5.1).
Proposition 4.1.1 The number of permutations of a set of n elements is n!.
Let us also count the number of functions between two finite sets.
Proposition 4.1.2 If A and B are finite sets with A = m and B = n, then the set of function, BA, from| | A to B has| | nm elements. 4.1. COUNTING PERMUTATIONS AND FUNCTIONS 429 As a corollary, we determine the cardinality of a finite power set.
Corollary 4.1.3 For any finite set, A, if A = n, then 2A =2n. | | | |
Computing the value of the factorial function for a few inputs, say n =1, 2 ...,10, shows that it grows very fast. For example, 10! = 3, 628, 800.
Is it possible to quantify how fast factorial grows com- pared to other functions, say nn or en?
Remarkably, the answer is yes. A beautiful formula due to James Stirling (1692-1770) tells us that n n n! p2⇡n , ⇠ e which means that ⇣ ⌘ n! lim n =1. n p n !1 2⇡n e 430 CHAPTER 4. SOME COUNTING PROBLEMS; MULTINOMIAL COEFFICIENTS
Figure 4.1: Jacques Binet, 1786-1856 Here, of course, 1 1 1 1 e =1+ + + + + + 1! 2! 3! ··· n! ··· the base of the natural logarithm.
It is even possible to estimate the error. It turns out that n n n!=p2⇡n e n, e where ⇣ ⌘ 1 1 <