Stirling numbers of the second kind
In mathematics, particularly in combinatorics, a Stirling number of the second kind is the number of ways to partition a set of n objects into k non-empty subsets and is denoted by or. Stirling numbers of the second kind occur in the field of mathematics called combinatorics and the study of partitions.
Stirling numbers of the second kind are one of two kinds of Stirling numbers, the other kind being called Stirling numbers of the first kind. Mutually inverse triangular matrices can be formed from the Stirling numbers of each kind according to the parameters n, k.
Definition
The Stirling numbers of the second kind, written or or with other notations, count the number of ways to partition a set of labelled objects into nonempty unlabelled subsets. Equivalently, they count the number of different equivalence relations with precisely equivalence classes that can be defined on an element set. In fact, there is a bijection between the set of partitions and the set of equivalence relations on a given set. Obviously,as the only way to partition an n-element set into n parts is to put each element of the set into its own part, and the only way to partition a nonempty set into one part is to put all of the elements in the same part.
They can be calculated using the following explicit formula:
The Stirling numbers of the second kind may also be characterized as the numbers that arise when one expresses powers of an indeterminate x in terms of the falling factorials
In particular, one has
Notation
Various notations have been used for Stirling numbers of the second kind. The brace notation was used by Imanuel Marx and Antonio Salmeri in 1962 for variants of these numbers. This led Knuth to use it, as shown here, in the first volume of The Art of Computer Programming. However, according to the third edition of The Art of Computer Programming, this notation was also used earlier by Jovan Karamata in 1935. The notation S was used by Richard Stanley in his book Enumerative Combinatorics.Relation to Bell numbers
Since the Stirling number counts set partitions of an n-element set into k parts, the sumover all values of k is the total number of partitions of a set with n members. This number is known as the nth Bell number.
Analogously, the ordered Bell numbers can be computed from the Stirling numbers of the second kind via
Table of values
Below is a triangular array of values for the Stirling numbers of the second kind :0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | |
0 | 1 | - | - | - | - | - | - | - | - | - | - |
1 | 0 | 1 | - | - | - | - | - | - | - | - | - |
2 | 0 | 1 | 1 | - | - | - | - | - | - | - | - |
3 | 0 | 1 | 3 | 1 | - | - | - | - | - | - | - |
4 | 0 | 1 | 7 | 6 | 1 | - | - | - | - | - | - |
5 | 0 | 1 | 15 | 25 | 10 | 1 | - | - | - | - | - |
6 | 0 | 1 | 31 | 90 | 65 | 15 | 1 | - | - | - | - |
7 | 0 | 1 | 63 | 301 | 350 | 140 | 21 | 1 | - | - | - |
8 | 0 | 1 | 127 | 966 | 1701 | 1050 | 266 | 28 | 1 | - | - |
9 | 0 | 1 | 255 | 3025 | 7770 | 6951 | 2646 | 462 | 36 | 1 | - |
10 | 0 | 1 | 511 | 9330 | 34105 | 42525 | 22827 | 5880 | 750 | 45 | 1 |
As with the binomial coefficients, this table could be extended to , but those entries would all be 0.
Properties
Recurrence relation
Stirling numbers of the second kind obey the recurrence relationfor k > 0 with initial conditions
for n > 0.
For instance, the number 25 in column k=3 and row n=5 is given by 25=7+, where 7 is the number above and to the left of 25, 6 is the number above 25 and 3 is the column containing the 6.
To understand this recurrence, observe that a partition of the objects into k nonempty subsets either contains the -th object as a singleton or it does not. The number of ways that the singleton is one of the subsets is given by
since we must partition the remaining objects into the available subsets. In the other case the -th object belongs to a subset containing other objects. The number of ways is given by
since we partition all objects other than the -th into k subsets, and then we are left with k choices for inserting object. Summing these two values gives the desired result.
Some more recurrences are as follows:
Lower and upper bounds
If and, thenwhere
and
Maximum
For fixed, has a single maximum, which is attained for at most two consecutive values of k. That is, there is an integer such thatWhen is large
and the maximum value of the Stirling number of second kind is
Parity
The parity of a Stirling number of the second kind is equal to the parity of a related binomial coefficient:This relation is specified by mapping n and k coordinates onto the Sierpiński triangle.
More directly, let two sets contain positions of 1's in binary representations of results of respective expressions:
One can mimic a bitwise AND operation by intersecting these two sets:
to obtain the parity of a Stirling number of the second kind in O time. In pseudocode:
where is the Iverson bracket.
Simple identities
Some simple identities includeThis is because dividing n elements into sets necessarily means dividing it into one set of size 2 and sets of size 1. Therefore we need only pick those two elements;
and
To see this, first note that there are 2 ordered pairs of complementary subsets A and B. In one case, A is empty, and in another B is empty, so ordered pairs of subsets remain. Finally, since we want unordered pairs rather than ordered pairs we divide this last number by 2, giving the result above.
Another explicit expansion of the recurrence-relation gives identities in the spirit of the above example.
These examples can be summarized by the recurrence
Explicit formula
The Stirling numbers of the second kind are given by the explicit formula:This formula is a special case of the kth forward difference of the monomial evaluated at x = 0:
Because the Bernoulli polynomials may be written in terms of these forward differences, one immediately obtains a relation in the Bernoulli numbers:
Generating functions
For a fixed integer n, the ordinary generating function for the Stirling numbers of the second kind is given bywhere are Touchard polynomials.
If one sums the Stirling numbers against the falling factorial instead, one can show the following identities, among others:
and
For a fixed integer k, the Stirling numbers of the second kind have
rational ordinary generating function
and have exponential generating function given by
A mixed bivariate generating function for the Stirling numbers of the second kind is
Asymptotic approximation
For fixed value of the asymptotic value of the Stirling numbers of the second kind as is given byOn the other side, if then
A uniformly valid approximation also exists: for all such that, one has
where, and is the main branch of the Lambert W function. Relative error is bounded by about.
Applications
Moments of the Poisson distribution
If X is a random variable with a Poisson distribution with expected value λ, then its nth moment isIn particular, the nth moment of the Poisson distribution with expected value 1 is precisely the number of partitions of a set of size n, i.e., it is the nth Bell number.
Moments of fixed points of random permutations
Let the random variable X be the number of fixed points of a uniformly distributed random permutation of a finite set of size m. Then the nth moment of X isNote: The upper bound of summation is m, not n.
In other words, the nth moment of this probability distribution is the number of partitions of a set of size n into no more than m parts.
This is proved in the article on random permutation statistics, although the notation is a bit different.
Rhyming schemes
The Stirling numbers of the second kind can represent the total number of rhyme schemes for a poem of n lines. gives the number of possible rhyming schemes for n lines using k unique rhyming syllables. As an example, for a poem of 3 lines, there is 1 rhyme scheme using just one rhyme, 3 rhyme schemes using two rhymes, and 1 rhyme scheme using three rhymes.Variants
Associated Stirling numbers of the second kind
An r-associated Stirling number of the second kind is the number of ways to partition a set of n objects into k subsets, with each subset containing at least r elements. It is denoted by and obeys the recurrence relationThe 2-associated numbers appear elsewhere as "Ward numbers" and as the magnitudes of the coefficients of Mahler polynomials.
Reduced Stirling numbers of the second kind
Denote the n objects to partition by the integers 1, 2,..., n. Define the reduced Stirling numbers of the second kind, denoted, to be the number of ways to partition the integers 1, 2,..., n into k nonempty subsets such that all elements in each subset have pairwise distance at least d. That is, for any integers i and j in a given subset, it is required that. It has been shown that these numbers satisfy. Observe, that, the familiar Stirling numbers of the second kind.