94

6 Stirling Numbers

Author: versity.

Thomas A. Dowling, Department of Mathematics, Ohio State Uni-

Prerequisites: The prerequisites for this chapter are basic counting techniques and equivalence relations. See Sections 5.3 and 8.5 of Discrete Mathematics and Its Applications.

Introduction A set of objects can be classiﬁed according to many diﬀerent criteria, depending on the nature of the objects. For example, we might classify — accidents according to the day of the week on which they occurred — people according to their profession, age, sex, or nationality — college students according to their class or major — positions in a random sequence of digits according to the digit appearing there — misprints according to the page on which they occur — printing jobs according to the printer on which they were done. In each of these examples, we would have a function from the set of objects to the set of possible levels of the criterion by which the objects are classiﬁed. Suppose we want to know the number of diﬀerent classiﬁcations that are possible, 95

96

Applications of Discrete Mathematics

perhaps subject to additional restrictions. This would be necessary, for example, in estimating probabilities that a classiﬁcation satisﬁed certain conditions. Determining the number of functions between ﬁnite sets, based on the sizes of the sets and certain restrictions on the functions, is an enumeration problem considered in Section 7.6 of Discrete Mathematics and Its Applications. It may be the case, however, that the classiﬁcation need not distinguish the various levels of the criterion, if such a distinction is even possible. There could be many levels, but the actual level on which an object falls is of no concern. Of interest might be how the set of objects is partitioned into disjoint subsets, with two objects being in the same subset whenever they fall at the same level of the criterion. A classiﬁcation then represents a partition of the set of objects, where two objects belong to the same class of the partition whenever they fall at the same level. In this case, rather than counting functions, partitions of the set of objects would be counted. It is then that the Stirling numbers* become appropriate. Along with the binomial coeﬃcients C(n, k), the Stirling numbers are of fundamental importance in enumeration theory. While C(n, k) is the number of k-element subsets of an n-element set N , the Stirling number S(n, k) represents the number of partitions of N into k nonempty subsets. Partitions of N are associated with sets of functions deﬁned on N , and they correspond to equivalence relations on N . Because of their combinatorial interpretation, the numbers S(n, k) will be met ﬁrst, despite their name as the Stirling numbers of the second kind. After we establish their role in a classiﬁcation of functions deﬁned on N , we consider their part in relating two sequences of polynomials (as they were originally deﬁned by Stirling). We will then be led to the Stirling numbers s(n, k) of the ﬁrst kind. We will see why they are referred to as being of the ﬁrst kind, despite the fact that some of these integers are negative, and thus cannot represent the size of a set.

Occupancy Problems Many enumeration problems can be formulated as counting the number of distributions of balls into cells or urns. The balls here correspond to the objects and the cells to the levels. These counting problems are generally referred to as occupancy problems. Suppose n balls are to be placed in k cells, and assume that any cell could hold all of the balls. The question “In how many ways can this be done?” asks for the number of distributions of n balls to k cells. As posed, the question lacks suﬃcient information to determine what is meant by a distribution. It therefore cannot be correctly answered. The num* They are named in honor of James Stirling (1692–1770), an eighteenth century associate of Sir Isaac Newton in England.

Chapter 6

Stirling Numbers

97

ber of distributions depends on whether the n balls and/or the k cells are distinguishable or identical. And if the n balls are distinguishable, whether the order in which the balls are placed in each cell matters. Let us assume that the order of placement does not distinguish two distributions. Suppose ﬁrst that both the balls and the cells are distinguishable. Then the collection of balls can be interpreted as an n-element set N and the collection of cells as a k-element set K. A distribution then corresponds to a function f : N → K. The number of distributions is then k n . If, however, the balls are identical, but the cells are distinguishable, then a distribution corresponds to an n-combination with repetition from the set K of k cells (see Section 5.5 of Discrete Mathematics and Its Applications). The number of balls placed in cell j represents the number of occurrences of element j in the n-combination. The number of distributions in this case is C(k + n − 1, n). Occupancy problems can have additional restrictions on the number of balls that can be placed in each cell. Suppose, for example, that at most one ball can be placed in each cell. If both the balls and the cells are distinguishable, we would then be seeking the number of one-to-one functions f : N → K. Such a function corresponds to an n-permutation from a k-set, so the number is P (k, n) = k(k − 1) · · · (k − n + 1). If instead there must be at least one ball in each cell, we want the number of onto functions f : N → K. Using inclusion-exclusion, that number is equal to k−1

(−1)i C(k, i)(k − i)n .

i=0

(See Section 7.6 of Discrete Mathematics and Its Applications.)

Partitions and Stirling Numbers of the Second Kind An ordered partition of N with length k is a k-tuple (A1 , A2 , . . . , Ak ) of disjoint subsets Ai of N with union N . By taking K = {1, 2, · · · , k}, we can interpret any function f : N → K as an ordered partition of N with length k. We let Ai be the subset of N whose elements have image i. Then, since f assigns exactly one image in K to each element of N , the subsets Ai are disjoint and their union is N . Then Ai is nonempty if and only if i is the image of at least one element of N . Thus the function f is onto if and only if all k of the sets Ai are nonempty. Recall that a partition of a set N is a set P = {Ai |i ∈ I} of disjoint, nonempty subsets Ai of N that have union N . We shall call these subsets classes. An ordered partition of N of a given length may have empty subsets Ai , but the empty set is not allowed as a class in a partition. If it were, then even though the classes are disjoint, they would not necessarily be diﬀerent sets, since

98

Applications of Discrete Mathematics

the empty set might be repeated. Given an equivalence relation R on N , the distinct equivalence classes Ai are disjoint with union N . The reﬂexive property then implies that they are nonempty, so the equivalence classes form a partition of N . Conversely, given a partition P = {Ai |i ∈ I}, an equivalence relation R is deﬁned by aR b if and only if there is some class Ai of P containing a and b. Thus, there is a one-to-one correspondence between the set of partitions of N and the set of equivalence relations on N . A binary relation on N is deﬁned as a subset of the set N ×N . Since N ×N 2 has n2 elements, the number of binary relations on N is 2n . The number of these that are equivalence relations, which is equal to the number of partitions of N , is called a Bell number*, and denoted by Bn . For example, the number of ways that ten people can be separated into nonempty groups is the Bell number B10 . Two of the people satisfy the corresponding equivalence relation R if and only if they belong to the same group. Suppose we want instead the number of ways the ten people can be separated into exactly three nonempty groups. That is, how many equivalence relations are there on a ten-element set that have exactly three equivalence classes? More generally, of the Bn equivalence relations, we might ask how many have exactly k equivalence classes? Since this is the number of partitions of N into k classes, we are led to our deﬁnition of a Stirling number S(n, k) of the second kind. (Note that Bell number Bn is then the sum over k of the n these numbers, that is, Bn = k=1 S(n, k).) Definition 1 The Stirling number of the second kind, S(n, k), is the number of partitions of an n-element set into k classes. Example 1 Solution: set N are

Find S(4, 2) and S(4, 3). Suppose N = {a, b, c, d}. The 2-class partitions of the 4-element

({a, b, c}, {d}), ({a, b, d}, {c}), ({a, c, d}, {b}), ({b, c, d}, {a}) ({a, b}, {c, d}), ({a, c}, {b, d}), ({a, d}, {b, c}). It follows that S(4, 2) = 7. The 3-class partitions of N are ({a, b}, {c}, {d}), ({a, c}, {b}, {d}), ({a, d}, {b}, {c}) * We won’t pursue the Bell numbers here, but see any of the references and also Section 8.5, Exercise 68, of Discrete Mathematics and Its Applications for more about them.

Chapter 6

Stirling Numbers

99

({b, c}, {a}, {d}), ({b, d}, {a}, {c}), ({c, d}, {a}, {b}) We therefore have S(4, 3) = 6. In occupancy problems, a partition corresponds to a distribution in which the balls are distinguishable, the cells are identical, and there is at least one ball in each cell. The number of distributions of n balls into k cells is therefore S(n, k). If we remove the restriction that there must be at least one ball in each cell, then a distribution corresponds to a partition of the set N with at most k classes. By the sum rule the number of such distributions equals S(n, 1) + S(n, 2) + · · · + S(n, k). Since the classes Ai of a partition P = {Ai |i ∈ I} must be disjoint and nonempty, we have S(n, k) = 0 for k > n. Further, since ({S}) itself is the only partition of N with one class, S(n, 1) = 1 for n ≥ 1. Given these initial conditions, together with S(0, 0) = 1, S(n, 0) = 0 for n ≥ 1, the Stirling numbers S(n, k) can be recursively computed using the following theorem. Theorem 1

Let n and k be positive integers. Then S(n + 1, k) = S(n, k − 1) + k S(n, k).

(1)

Proof: We give a combinatorial proof. Let S be an (n + 1)-element set. Fix a ∈ S, and let S = S − {a} be the n-element set obtained by removing a from S. The S(n + 1, k) partitions of S into k classes can each be uniquely obtained from either (i) a partition P of S with k − 1 classes by adding a singleton class {a}, or (ii) a partition P of S with k classes by ﬁrst selecting one of the k classes of P and then adding a to that class. Since the cases are exclusive, we obtain S(n, k) by the sum rule by adding the number S(n, k − 1) of partitions of (i) to the number k S(n, k) of partitions in (ii). Example 2 Let P be one of the partitions of N = {a, b, c, d} in Example 1. Then P is obtained from the S(3, 1) = 1 one-class partition ({a, b, c}) of N = N −{d} = {a, b, c} by adding {d} as a second class, or from one of the S(3, 2) = 3 two-class partitions ({a, b}, {c}), ({a, c}, {b}), ({b, c}, {a})

100

Applications of Discrete Mathematics

of N by choosing one of these partitions, then choosing one of its two classes, and ﬁnally by adding d to the class chosen.

Example 3

Use Theorem 1 to ﬁnd S(5, 3).

Solution: We have S(4, 2) = 7 and S(4, 3) = 6 from Example 1. Then we ﬁnd by Theorem 1 that S(5, 3) = S(4, 2) + 3 S(4, 3) = 7 + 3 · 6 = 25. The Pascal recursion C(n + 1, k) = C(n, k − 1) + C(n, k) used to compute the binomial coeﬃcients has a similar form, but the coeﬃcient in the second term of the sum is 1 for C(n, k) and k for S(n, k). Using the recurrence relation in Theorem 1, we can obtain each of the Stirling numbers S(n, k) from the two Stirling numbers S(n−1, k−1), S(n−1, k) previously found. These are given in Table 1 for 1 ≤ k ≤ n ≤ 6. n\k 1 2 3 4 5 6 Table 1.

1 1 1 1 1 1 1

2

3

4

5

1 3 7 15 31

1 6 25 90

1 10 65

1 15

6

1

Stirling numbers of the second kind, S(n,k).

Inverse Partitions of Functions Recall that a function f : N → K is onto if every element b ∈ K is an image of some element a ∈ N , so b = f (a). If we denote the set of images by f (N ) = {f (a)|a ∈ N }, then f is onto if and only if f (N ) = K. Example 4 Suppose N = {a, b, c, d}, K = {1, 2, 3}, and the function f is deﬁned by f (a) = f (b) = f (d) = 2, f (c) = 1. Then f (N ) = {1, 2} = K, so f is not onto. Every function f : N → K determines an equivalence relation on N under which two elements of N are related if and only if they have the same image under f . Since the equivalence classes form a partition of N , we make the following deﬁnition.

Chapter 6 Stirling Numbers

101

Definition 2 The inverse partition deﬁned by a function f : N → K is the partition P (f ) of N into equivalence classes with respect to the the equivalence relation Rf deﬁned by aRf b if and only if f (a) = f (b). Given the function f , every element b ∈ f (N ) determines an equivalence class of Rf . Suppose we denote by f −1 (b) the set of elements in N that have b as their image*. Then f −1 (b) is an equivalence class, called the inverse image of b. It follows that a ∈ f −1 (b) if and only if b = f (a). Thus, the equivalence classes f −1 (b) for b ∈ f (N ) form the inverse partition P (f ) of N , and the number of equivalence classes is the size of the set f (N ). Therefore f : N → K is onto if and only if P (f ) has k classes. Example 5 Example 4.

Find the inverse partition of N deﬁned by the function f of

Solution: For the function f in Example 4, the set of elements of N with image 1 is f −1 (1) = {a, b, d}, while the set of elements with image 2 is f −1 (2) = {c}. Since no elements have 3 as an image, the set f −1 (3) is empty, so it is not an equivalence class. Thus the inverse partition of N deﬁned by f is the 2-class partition P (f ) = ({a, b, d}, {c}).

An Identity for Stirling Numbers We can classify the k n distributions of n distinguishable balls into k distinguishable cells by the number j of nonempty cells. Such a distribution is determined by a j-class partition P of the set of balls together with an injective function ϕ from the j classes of P to the k cells. The classiﬁcation obtained in this way leads to an identity involving the Stirling numbers of the second kind. Denote by F (N, K) the set of functions f : N → K. Recall that the size of F (N, K) is k n . Let us classify the functions f ∈ F (N, K) according to the size of their image sets f (N ), or equivalently, according to the number of classes in their inverse partitions P (f ). * What we have denoted by f −1 is actually a function from K to the power set P (N ) of N , and not the inverse function of f . The function f : N → K has an inverse function from K to N if and only if it is a one-to-one correspondence.

102

Applications of Discrete Mathematics

Given a j-class partition P = {A1 , , A2 , . . . , Aj } of N , consider the set of functions f ∈ F (N, K) for which P (f ) = P . Two elements in N can have the same image if and only if they belong to the same Ai . Hence a function f has P (f ) = P if and only if there is a one-to-one function ϕ : {A1 , A2 , . . . , Aj } → K such that f (a) = ϕ(Ai ) for all i and all a ∈ Ai . The number of one-to-one functions from a j-set to a k-set is the falling factorial (k)j = P (k, j) = k(k − 1) · · · (k − j + 1). Hence, for any j-class partition P , the number of functions f ∈ F (N, K) such that P (f ) = P is (k)j . Since there are S(n, j) j-class partitions of N , by the product rule there are S(n, j)(k)j functions f ∈ F (N, K) such that f (N ) has size j. Summing over j gives us kn =

k

S(n, j)(k)j .

(2)

j=1

The jth term in the sum is the number of functions f for which |f (N )| = j. We noted earlier that the onto functions correspond to distributions in the occupancy problem where the balls and the cells are distinguishable and there must be at least one ball in each cell. If we remove the restriction that there must be at least one ball in each cell, then a distribution corresponds to a function f : N → K. Classiﬁcation of the k n distributions according to the number of nonempty cells gives (2). If we consider the term where j = k in (2), and note that (k)k = k!, we have the following theorem. Theorem 2 The number of functions from a set with n elements onto a set with k elements is S(n, k)k!. The inclusion-exclusion principle can be used to show that the number of onto functions from a set with n elements to a set with k elements is k

(−1)i C(k, i)(k − i)n .

(3)

i=0

By Theorem 2, we may equate (3) to S(n, k)k!, and we obtain k

S(n, k) =

1 (−1)i C(k, i)(k − i)n . k! i=0

(4)

Example 6 Let n = 5, k = 3. Then if the 35 functions f : N → K are classiﬁed according to the number of classes in their inverse partitions, we

Chapter 6 Stirling Numbers

obtain 35 =

3

103

S(5, j)(3)j = 1 · 3 + 15 · 6 + 25 · 6 = 243,

j=1

which is of course easily veriﬁed. Theorem 2 shows that the number of these functions that are onto is S(5, 3)3! = 25 · 6 = 150. Alternatively, by the inclusion-exclusion expression (3), we have 3

(−1)k C(3, i)(3 − i)5 = 35 − 3 · 25 + 3 · 15

i=0

= 243 − 96 + 3 = 150. Before turning to polynomials in a real variable x, we need to write the summation in (2) in a diﬀerent form. Since S(n, j) = 0 for j > n and (k)j = 0 for an integer j > k, the term S(n, j)(k)j in (2) can be nonzero only when j ≤ n and j ≤ k. Thus we can replace the upper limit k in (2) by n, which gives kn =

n

S(n, j)(k)j .

(2 )

j=1

Stirling Numbers and Polynomials Recall that a polynomial of degree n in a real variable x is a function p(x) of the form p(x) = an xn + an−1 xn−1 + · · · + a0 , where an , an−1 , . . . , a0 are constants with an = 0. Suppose we extend the deﬁnition of the falling factorial (k)n from the set N × N to the set R × N by deﬁning the function (x)n for any real number x and any nonnegative integer n to be (x)n = 1 when n = 0 and (x)n = x(x − 1) · · · (x − n + 1) when n ≥ 1. Equivalently, deﬁne (x)n recursively by (x)0 = 1 and (x)n = (x − n + 1)(x)n−1 . As the product of n linear factors, (x)n is a polynomial of degree n. We can then replace k by x in (2 ) to obtain n

x =

n

S(n, j)(x)j .

(5)

j=1

Subtracting the right-hand side from each side gives xn −

n j=1

S(n, j)(x)j = 0.

(6)

104

Applications of Discrete Mathematics

But (x)j = x(x − 1) · · · (x − j + 1) is a polynomial of degree j, for 1 ≤ j ≤ n. Hence the left-hand side of (6) is a polynomial p(x) of degree at most n. But since p(x) = 0 for every positive integer x and since a polynomial of degree n has at most n real roots, p(x) must be identically zero. Then we obtain for every real number x xn =

n

S(n, j)(x)j .

(7)

j=1

Equation (7) represents (2 ) extended from positive integers k to arbitrary real numbers x. Since k does not appear in (7), we may replace the index variable j by k, rewriting (7) as n

x =

n

S(n, k)(x)k .

(7 )

k=1

Equation (7 ) represents (7) in a form convenient for comparison with (10) in the next section. Example 7 Let n = 3. Then (x)1 = x, (x)2 = x(x − 1) = x2 − x, and (x)3 = x(x − 1)(x − 2) = x3 − 3x2 + 2x. Substituting these into the right-hand side of (5) gives S(3, 1)(x)1 +S(3, 2)(x)2 + S(3, 3)(x)3 = 1 · x + 3 · (x2 − x) + 1 · (x3 − 3x2 + 2x) = x3 .

Stirling Numbers of the First Kind There is an interpretation of (7) that will be understood more readily by readers who are familiar with linear algebra. The set of polynomials p(x) with real coefﬁcients (or with coeﬃcients in any ﬁeld) forms a vector space*. A fundamental basis of this vector space is a sequence of polynomials {pk (x)|k = 0, 1, . . .} such that pk (x) has degree k. Every polynomial can be uniquely expressed as a linear combination of the polynomials in a fundamental basis. Two important fundamental bases are the standard basis {xk |k = 0, 1, . . .} and the falling factorial basis {(x)k |k = 0, 1, . . .}. The standard basis is in fact the one used in the deﬁnition of a polynomial in x, since a polynomial is deﬁned as a linear combination of the powers of x. Then Equation (7) expresses the basis {xk } in terms of the basis {(x)k }. * This vector space has infinite (but countable) dimension.

Chapter 6 Stirling Numbers

105

In fact, (7) was Stirling’s original deﬁnition of the numbers S(n, k) as the coeﬃcients in changing from the falling factorial basis {(x)k } to the standard basis {xk }. These numbers were said to be of the second kind since they change a basis to the standard basis. More commonly, we would be changing from the standard basis to another basis, and the coeﬃcients would be of the first kind. When the other basis is the sequence {(x)k } of falling factorial polynomials, we encounter the Stirling numbers of the ﬁrst kind. To illustrate these ideas, let us ﬁrst suppose we want to express the basis {(x − 1)k } in terms of the standard basis {xk }. Using the Binomial Theorem, we can express the polynomial (x − 1)n as (x − 1)n =

n

(−1)n−k C(n, k)xk .

(8)

k=0

The coeﬃcients (−1)n−k C(n, k) in (8), that change the standard basis to the other basis (and which are the coeﬃcients when the product (x − 1)n of n identical factors is expanded), by analogy would be called binomial coeﬃcients of the ﬁrst kind. On the other hand, if we express x as (x − 1) + 1 and apply the Binomial Theorem, we obtain xn = ((x − 1) + 1)n =

n

C(n, k)(x − 1)k .

(9)

k=0

Thus, the binomial coeﬃcients C(n, k) are used in (9) to change from the other basis to the standard basis, and would therefore be referred to as the binomial coeﬃcients of the second kind. The coeﬃcients needed to change the falling factorial basis {(x)k } to the standard basis {xk } can be obtained by simply expanding the product (x)n = x(x − 1) . . . (x − n + 1). Example 8

Write (x)3 in terms of the standard basis {xk }.

Solution: Let n = 3. Then expanding the product (x)3 and reversing the order of the terms gives (x)3 = x(x − 1)(x − 2) = x3 − 3x2 + 2x = 2x − 3x2 + x3 .

Let us now deﬁne the Stirling numbers of the ﬁrst kind.

106

Applications of Discrete Mathematics

Definition 3 satisfying

The Stirling numbers of the first kind s(n, k) are the numbers

(x)n =

n

s(n, k)xk .

(10)

k=0

That (10) uniquely determines the coeﬃcients s(n, k) follows either from the deﬁnition of multiplication of polynomials or from the fact that every polynomial can be uniquely expressed as a linear combination of the polynomials in a basis. Example 9 Find the Stirling numbers which express (x)3 in terms of the polynomials 1, x, x2 . Solution:

Using the deﬁnition of s(n, k) and Example 8, we have (x)3 = s(3, 0) · 1 + s(3, 1)x + s(3, 2)x2 + s(3, 3)x3 = 2x − 3x2 + x3 .

Hence, the Stirling numbers of the ﬁrst kind which express (x)3 in terms of the polynomials 1, x, x2 and x3 in the standard basis are s(3, 0) = 0, s(3, 1) = 2, s(3, 2) = −3, s(3, 3) = 1. Note that in Example 9 some of the Stirling numbers s(n, k) of the ﬁrst kind can be negative. Hence, unlike the Stirling numbers of the second kind, those of the ﬁrst kind cannot represent the sizes of sets. (But their absolute values do. See Exercise 16.) Consider for a ﬁxed n the sequence of numbers s(n, k). These are zero when n > k. We can determine their sum over 1 ≤ k ≤ n immediately from (10). The polynomial (x)n vanishes whenever x is a positive integer and n > x. Thus, on setting x = 1 in (10), we get n

s(n, k) = 0 for

n ≥ 2.

(11)

k=1

There is a recurrence relation for s(n, k) analogous to the recurrence relation in Theorem 1 for S(n, k), but we will obtain this one by a method diﬀerent from the combinatorial argument given there. We start by ﬁnding the boundary values where k = 0. Using the convention that (x)0 = 1 if x = 0 and 0 otherwise, we have s(0, 0) = 1. And since x is a factor of (x)n for n ≥ 1, the constant term is 0, so s(n, 0) for n ≥ 1. The analogue of Theorem 1 is then given by the following theorem.

Chapter 6 Stirling Numbers

Theorem 3

107

Let n and k be positive integers. Then s(n + 1, k) = s(n, k − 1) − n s(n, k).

(12)

Proof: We make use of the fact that (x)n+1 = x(x − 1) · · · (x − n + 1)(x − n) = (x − n)(x)n . Then by (10), (x)n+1 =

n+1

s(n + 1, k)xk .

(13)

k=0

But (x)n+1 = (x − n)(x)n n n = s(n, j)xj+1 − n s(n, j)xj . j=0

(14)

j=0

When we equate the coeﬃcients of xk in (13) and (14), we ﬁnd that s(n+1, k) = s(n, k − 1) − n s(n, k).

Example 10

Use recurrence relation (12) to ﬁnd s(5, 3).

Solution: We see from Example 9 that s(3, 1) = 2, s(3, 2) = −3, and s(3, 3) = 1. Thus, by (12), we ﬁnd s(4, 2) = 2−3·(−3) = 11 and s(4, 3) = −3−3·1 = −6. We then obtain s(5, 3) = 11 − 4 · (−6) = 35. The values of s(n, k) for 1 ≤ k ≤ n ≤ 6 shown in Table 2 were computed using (12). 1 2 3 4 5 6 n\k 1 1 2 -1 1 3 2 -3 1 4 -6 11 -6 1 5 24 -50 35 -10 1 6 -120 274 -225 85 -15 1 Table 2.

Stirling numbers of the first kind, s(n,k).

Comments When we observe the tables of values of the Stirling numbers for 1 ≤ k ≤ n ≤ 6, we notice that the numbers in certain columns or diagonals come from well-

108

Applications of Discrete Mathematics

known sequences. We will examine some of these. Proofs will be left for the exercises. First consider the numbers S(n, 2) in the second column of Table 1. For 2 ≤ n ≤ 6 these are 1, 3, 7, 15, 31. It appears that S(n, 2) has the form 2n−1 − 1 (Exercise 14). The numbers S(n, n − 1) just below the main diagonal in Table 1 are 1, 3, 6, 10, 15 for 2 ≤ n ≤ 6, suggesting (Exercise 13) that S(n, n − 1) is the triangular number 1 C(n, 2) = n(n − 1). 2 Next consider Table 2, which gives the values s(n, k) of the Stirling numbers of the ﬁrst kind. We can easily verify that the row sums are zero for 2 ≤ n ≤ 6, as given for all n ≥ 2 by (9). Observe that the numbers s(n, 1) in the ﬁrst column of Table 2 satisfy s(n, 1) = (−1)n−1 (n − 1)! for 1 ≤ n ≤ 6. This in fact holds for all n (Exercise 14). The numbers s(n, n − 1) just below the main diagonal in Table 2 are the negatives of the Stirling numbers S(n, n − 1) of the second kind, which are apparently the triangular numbers C(n, 2) (Exercise 13). Note also that the numbers s(n, k) alternate in sign in both rows and columns. It is not diﬃcult to prove (Exercise 16) that the sign of s(n, k) is (−1)n−k , so that the absolute value of s(n, k) is t(n, k) = (−1)n−k s(n, k). These integers t(n, k) are the signless Stirling numbers of the first kind. As nonnegative integers, these numbers have a combinatorial interpretation (Exercise 18).

Suggested Readings A basic treatment of the Stirling numbers is in reference [2]. A great deal of information about the generating functions of the Stirling numbers and further properties of these numbers can be found in the more advanced books [1], [3], [4], and [5]. 1. M. Aigner, Combinatorial Theory, Springer, New York, 1997. 2. K. Bogart, Introductory Combinatorics, Brooks/Cole, Belmont, CA, 2000. 3. L. Comtet, Advanced Combinatorics: The Art of Finite and Infinite Expansions, Springer, New York, 1974. 4. R. Stanley, Enumerative Combinatorics, Volume 1, Cambridge University Press, New York, 2000. 5. H. Wilf, generatingfunctionology, Third Edition, A K Peters, Wellesley, MA, 2005.

Chapter 6 Stirling Numbers

109

Exercises 1. For n = 7 and 1 ≤ k ≤ 7, ﬁnd the Stirling numbers S(n, k) and s(n, k). 2. Express (x)4 as a polynomial by expanding the product x(x−1)(x−2)(x−3). 3. Express the polynomial x4 as a linear combination of the falling factorial polynomials (x)k . 4. Find the number of onto functions from an eight-element set to a ﬁveelement set. 5. Let n = 3 and x = 3. Classify the xn = 27 functions f from N = {1, 2, 3} to X = {a, b, c} according to the size of the image set f (N ) to verify that there are S(3, j)(3)j such functions f with |f (N )| = j, for 1 ≤ j ≤ 3. 6. In how many ways can seven distinguishable balls be placed in four identical boxes so that a) there is at least one ball in each box? b) some box(es) may be empty? 7. Suppose each of a group of six people is assigned one of three tasks at random. Find the probability (to three decimal places) that a) task 3 is not assigned. b) all three tasks are assigned. c) exactly two of the tasks are assigned. 8. In how many ways can a set of 12 people be divided into three (nonempty) subsets. 9. Suppose a k-sided die is rolled until each of the numbers 1, 2, . . . , k have appeared at least once, at which time the rolls are stopped. Give an expression for the number of possible sequences of n rolls that satisfy the condition. 10. A computer is programmed to produce a random sequence of n digits. a) How many possible sequences are there? b) How many of these sequences have each of the 10 digits appearing? 11. A pool table has four corner pockets and two center pockets. There is one white ball (the cue ball) and 15 colored balls numbered 1, 2, . . . , 15. In a game each of the numbered balls is sunk into a pocket (and remains there) after being struck by the cue ball, which the player has propelled with a cue stick. Thus a game produces a distribution of the numbered balls in the set of pockets. a) Assuming the pockets are distinguishable, how many distributions are there?

110

Applications of Discrete Mathematics

b) Suppose we assume the corner pockets are identical and the center pockets are identical, but that a corner pocket is distinguishable from a center pocket. Give an expression for the number of distributions in which all of the numbered balls are sunk in corner pockets or they are all sunk in center pockets. 12. Let n n and k be positive integers with n + 1 ≥ k. Prove that S(n + 1, k) = j=0 C(n, j)S(n − j, k − 1). 13. Prove that a) S(n, n − 1) = C(n, 2). b) s(n, n − 1) = −C(n, 2). 14. Prove that a) S(n, 2) = 2n−1 − 1. b) s(n, 1) = (−1)n−1 (n − 1)!. 15. Let m and n be nonnegative integers with n ≤ m. The Kronecker delta function δ(m, n) is equal to 1 if m = n and 0 otherwise. Prove that m

S(m, k)s(k, n) = δ(m, n).

k=n

In Exercises 16–20, let n and k be positive integers with k ≤ n. 16. Prove that the sign of the Stirling number of the ﬁrst kind is (−1)n−k . (Thus the signless Stirling number of the ﬁrst kind t(n, k) = |s(n, k)| is equal to (−1)n−k s(n, k).) 17. Find a recurrence relation for the signless Stirling numbers t(n, k) of the ﬁrst kind similar to the recurrence relation (12) satisﬁed by the Stirling numbers s(n, k) of the ﬁrst kind. 18. A cyclic permutation (or cycle) of a set A is a permutation that cyclically permutes the elements of A. For example, the permutation σ, with σ(1) = 2, σ(2) = 4, σ(3) = 1, σ(4) = 5, σ(5) = 3, is cyclic, and denoted by (12453) or any of its cyclic equivalents, such as (24531) or (31245). It can be shown that every permutation of a set N can be expressed as a product of cycles that cyclically permute disjoint subsets of N , unique except for the order of the cycles. Thus, for example, (153)(24) is the cyclic decomposition of the permutation σ given by σ(1) = 5, σ(2) = 4, σ(3) = 1, σ(4) = 2, σ(5) = 3. Prove that t(n, k) is the number of permutations of an n-element set that have exactly k cycles in their cyclic decomposition. Hint: Use Exercise 17. 19. Suppose a computer is programmed to produce a random permutation of n diﬀerent characters.

Chapter 6 Stirling Numbers

111

a) Give an expression for the probability that the permutation will have exactly k cycles. b) Calculate the probabilities with n = 8 that the permutation will have two cycles and that it will have three cycles. Which is more likely? 20. Let a(n, k) be the sum of the products 1c1 2c2 · · · k ck , taken over all k-tuples (c1 , c2 , . . . , ck ) such that ci is a nonnegative integer for i = 1, 2, . . . , k and the sum of the ci s is n − k. Prove that a(n, k) satisﬁes the initial conditions and the recurrence relation (1) for the Stirling numbers S(n, k) of the second kind. (This shows that S(n, k) = a(n, k).) 21. (Requires calculus.) Let k be a ﬁxed positive integer. It can be shown that the ratios S(n, k − 1)/S(n, k) and s(n, k − 1)/s(n, k) both approach 0 as a limit as n approaches ∞. Use these facts to ﬁnd a) lim S(n + 1, k)/S(n, k). n→∞

b) lim s(n + 1, k)/s(n, k). n→∞

22. (Requires calculus.) The exponential generating function of a sequence (an ) is deﬁned to be the power series A∗ (x) =

∞ n=0

an

xn . n!

Let k be a ﬁxed positive integer and let an = S(n, k). Prove that A∗ (x) =

(ex − 1)k . k!

23. Find the expansion of the polynomial Pk (x) = (1 − x)(1 − 2x) . . . (1 − kx).

Computer Projects 1. Write a computer program that uses the recurrence relation (1) to compute Stirling numbers of the second kind. 2. Write a computer program that uses the recurrence relation (12) to compute Stirling numbers of the ﬁrst kind.