Stirling Number of the Second Kind

DOWNLOAD Mathematica Notebook

The number of ways of partitioning a set of n elements into m nonempty sets (i.e., m set blocks), also called a Stirling set number. For example, the set {1,2,3} can be partitioned into three subsets in one way: {{1},{2},{3}}; into two subsets in three ways: {{1,2},{3}}, {{1,3},{2}}, and {{1},{2,3}}; and into one subset in one way: {{1,2,3}}.

The Stirling numbers of the second kind are variously denoted S(n,m) (Riordan 1980, Roman 1984), S_n^((m)) (Fort 1948; Abramowitz and Stegun 1972, p. 822), S_n^m (Jordan 1965), s_n^((m)), S_2(n,m), or Knuth's notation {n; m} (Graham et al. 1994; Knuth 1997, p. 65). Abramowitz and Stegun (1972, p. 822) summarize the various notational conventions, which can be a bit confusing. The Stirling numbers of the second kind are implemented in the Wolfram Language as StirlingS2[n, m], and denoted S_n^((m)).

The Stirling numbers of the second kind for three elements are

S(3,1)=1
(1)
S(3,2)=3
(2)
S(3,3)=1.
(3)

Since a set of n elements can only be partitioned in a single way into 1 or n subsets,

 S(n,1)=S(n,n)=1.
(4)

Other special cases include

S(n,0)=delta_(n0)
(5)
S(n,2)=2^(n-1)-1
(6)
S(n,3)=1/6(3^n-3·2^n+3)
(7)
S(n,n-1)=(n; 2).
(8)

The triangle of Stirling numbers of the second kind is

 1
1  1
1  3  1
1  7  6  1
1  15  25  10  1
1  31  90  65  15  1
(9)

(OEIS A008277), the nth row of which corresponds to the coefficients of the Bell polynomial phi_n(x).

The Stirling numbers of the second kind can be computed from the sum

 S(n,k)=1/(k!)sum_(i=0)^k(-1)^i(k; i)(k-i)^n,
(10)

with (n; k) a binomial coefficient, or the generating functions

x^n=sum_(m=0)^(n)S(n,m)(x)_m
(11)
=sum_(m=0)^(n)S(n,m)x(x-1)...(x-m+1),
(12)

where (x)_m is the falling factorial (Roman 1984, pp. 60 and 101),

 sum_(n=k)^inftyS(n,k)(x^n)/(n!)=1/(k!)(e^x-1)^k,
(13)

and

sum_(n=1)^(infty)S(n,k)x^n=sum_(n=k)^(infty)S(n,k)x^n
(14)
=(x^k)/((1-x)(1-2x)...(1-kx))
(15)
=((-1)^k)/(((x-1)/x)_k)
(16)

for z<1/m (Abramowitz and Stegun 1972, p. 824; Stanley 1997, p. 57), where (x)_m is a Pochhammer symbol. Another generating function is given by

 sum_(k=1)^nS(n,k)(k-1)!z^k=(-1)^nLi_(1-n)(1+1/z)
(17)

for n>=2, where Li_n(z) is the polylogarithm.

Stirling numbers of the second kind are intimately connected with the Poisson distribution through Dobiński's formula

 B_n(x)=sum_(k=0)^nx^kS(n,k)
(18)

where B_n(x) is a Bell polynomial.

StirlingNumberSecondKind

The above diagrams (Dickau) illustrate the definition of the Stirling numbers of the second kind S(n,m) for n=3 and 4. Stirling numbers of the second kind obey the recurrence relations

S(n,k)=S(n-1,k-1)+kS(n-1,k)
(19)
S(n,k)=sum_(m=k)^(n)k^(n-m)S(m-1,k-1).
(20)

The Stirling numbers of the first kind s(n,m) are connected with the Stirling numbers of the second kind S(n,m). For example, the matrices (s)_(i,j) and (S)_(i,j) are inverses of each other, where (A)_(ij) denotes the matrix with (i,j)th entry aAi,j) for i,j=1, ..., n (G. Helms, pers. comm., Apr. 28, 2006).

Other formulas include

 s(n,i)=sum_(k=i)^nsum_(j=0)^ks(n,k)s(k,j)S(j,i)
(21)
 S(n,i)=sum_(k=i)^nsum_(j=0)^kS(n,k)S(k,j)s(j,i)
(22)

(Roman 1984, p. 67), as well as

 S(n,m)=sum_(k=0)^(n-m)(-1)^k(k+n-1; k+n-m)(2n-m; n-k-m)s(k-m+n,k)
(23)
 s(n,m)=sum_(k=0)^(n-m)(-1)^k(k+n-1; k+n-m)(2n-m; n-k-m)S(k-m+n,k)
(24)
 sum_(l=0)^(max(k,j)+1)s(l,j)S(k,1)=delta_(jk)
(25)
 sum_(l=0)^(max(k,j)+1)s(k,l)S(l,j)=delta_(jm).
(26)

Identities involving Stirling numbers of the second kind are given by

 sum_(m=1)^n(-1)^m(m-1)!S(n,m)=0
(27)
 sum_(k=0)^nk!(m+1; k+1)S(n,k)=H_(m,-n),
(28)

where H_(n,r) is a generalized harmonic number, and

f(m,n)=sum_(k=1)^(infty)k^n(m/(m+1))^k
(29)
=(m+1)sum_(k=1)^(n)k!S(n,k)m^k.
(30)

The sequence f(1,n) is given by 2, 6, 26, 150, 1082, 9366, 94586, 1091670, ... (OEIS A000629; Konhauser et al. 1996, p. 174), and can have only 0, 2, or 6 as a last digit (Riskin 1995). An additional curious identity due to K. A. Penson (pers. comm., April 10, 2002) is given by

 sum_(k=0)^inftyk^n[k+1-(Gamma(k+2,1))/(Gamma(k+1))]=sum_(k=0)^n(S(n,k))/(k+2)
(31)

for n=0, 1, ..., where Gamma(a,x) is an incomplete gamma function, Gamma(x) is a gamma function, and k^n is taken to be 1 for k,n=0.

Stirling numbers of the second kind also occur in identities involving the differential operator theta=zd/dz.

Wolfram Web Resources

Mathematica »

The #1 tool for creating Demonstrations and anything technical.

Wolfram|Alpha »

Explore anything with the first computational knowledge engine.

Wolfram Demonstrations Project »

Explore thousands of free applications across science, mathematics, engineering, technology, business, art, finance, social sciences, and more.

Computerbasedmath.org »

Join the initiative for modernizing math education.

Online Integral Calculator »

Solve integrals with Wolfram|Alpha.

Step-by-step Solutions »

Walk through homework problems step-by-step from beginning to end. Hints help you try the next step on your own.

Wolfram Problem Generator »

Unlimited random practice problems and answers with built-in Step-by-step solutions. Practice online or make a printable study sheet.

Wolfram Education Portal »

Collection of teaching and learning tools built by Wolfram education experts: dynamic textbook, lesson plans, widgets, interactive Demonstrations, and more.

Wolfram Language »

Knowledge-based programming for everyone.