Stirling number

In mathematics, Stirling numbers arise in a variety of analytic and combinatorial problems. They are named after James Stirling, who introduced them in a purely algebraic setting in his book Methodus differentialis (1730). They were rediscovered and given a combinatorial meaning by Masanobu Saka in 1782.

Two different sets of numbers bear this name: the Stirling numbers of the first kind and the Stirling numbers of the second kind. Additionally, Lah numbers are sometimes referred to as Stirling numbers of the third kind. Each kind is detailed in its respective article, this one serving as a description of relations between them.

A common property of all three kinds is that they describe coefficients relating three different sequences of polynomials that frequently arise in combinatorics. Moreover, all three can be defined as the number of partitions of n elements into k non-empty subsets, where each subset is endowed with a certain kind of order (no order, cyclical, or linear).

Notation
Several different notations for Stirling numbers are in use. Ordinary (signed) Stirling numbers of the first kind are commonly denoted:


 * $$ s(n,k)\,.$$

Unsigned Stirling numbers of the first kind, which count the number of permutations of n elements with k disjoint cycles, are denoted:


 * $$ \biggl[{n \atop k}\biggr] =c(n,k)=|s(n,k)|=(-1)^{n-k} s(n,k)\,$$

Stirling numbers of the second kind, which count the number of ways to partition a set of n elements into k nonempty subsets:


 * $$ \biggl\{{\!n\! \atop \!k\!}\biggr\} = S(n,k) = S_n^{(k)} \,$$

Abramowitz and Stegun use an uppercase $$S$$ and a blackletter $$\mathfrak S$$, respectively, for the first and second kinds of Stirling number. The notation of brackets and braces, in analogy to binomial coefficients, was introduced in 1935 by Jovan Karamata and promoted later by Donald Knuth. (The bracket notation conflicts with a common notation for Gaussian coefficients. ) The mathematical motivation for this type of notation, as well as additional Stirling number formulae, may be found on the page for Stirling numbers and exponential generating functions.

Another infrequent notation is $$s_1(n,k)$$ and $$s_2(n,k)$$.

Expansions of falling and rising factorials
Stirling numbers express coefficients in expansions of falling and rising factorials (also known as the Pochhammer symbol) as polynomials.

That is, the falling factorial, defined as $$\ (x)_{n} = x(x-1)\ \cdots(x-n+1)\ ,$$ is a polynomial in $x$ of degree $n$ whose expansion is


 * $$(x)_{n}\ =\ \sum_{k=0}^n\ s(n,k)\ x^k\ $$

with (signed) Stirling numbers of the first kind as coefficients.

Note that $$\ (x)_0 \equiv 1\ ,$$ by convention, because it is an empty product. The notations for the falling factorial and  for the rising factorial are also often used. (Confusingly, the Pochhammer symbol that many use for falling factorials is used in special functions for rising factorials.)

Similarly, the rising factorial, defined as $$\ x^{(n)}\ =\ x(x+1)\ \cdots(x+n-1)\ ,$$ is a polynomial in $x$ of degree $n$ whose expansion is


 * $$ x^{(n)}\ =\ \sum_{k=0}^n\ \biggl[{n \atop k}\biggr]\ x^k\ =\ \sum_{k=0}^n\ (-1)^{n-k}\ s(n,k)\ x^k\ ,$$

with unsigned Stirling numbers of the first kind as coefficients. One of these expansions can be derived from the other by observing that $$\ x^{(n)} = (-1)^n (-x)_{n} ~.$$

Stirling numbers of the second kind express the reverse relations:


 * $$\ x^n\ =\ \sum_{k=0}^n\ S(n,k)\ (x)_k\ $$

and


 * $$\ x^n\ =\ \sum_{k=0}^n\ (-1)^{n-k}\ S(n,k)\ x^{(k)} ~.$$

As change of basis coefficients
Considering the set of polynomials in the (indeterminate) variable x as a vector space, each of the three sequences
 * $$x^0,x^1,x^2,x^3,\dots \quad (x)_0,(x)_1,(x)_2,\dots \quad x^{(0)},x^{(1)},x^{(2)},\dots$$

is a basis. That is, every polynomial in x can be written as a sum $$a_0 x^{(0)} + a_1 x^{(1)} + \dots + a_n x^{(n)}$$ for some unique coefficients $$a_i$$ (similarly for the other two bases). The above relations then express the change of basis between them, as summarized in the following commutative diagram:
 * Stirling numbers as polynomial basis changes.png give coefficients for changing one basis of polynomials to another ]]

The coefficients for the two bottom changes are described by the Lah numbers below. Since coefficients in any basis are unique, one can define Stirling numbers this way, as the coefficients expressing polynomials of one basis in terms of another, that is, the unique numbers relating $$x^n$$ with falling and rising factorials as above.

Falling factorials define, up to scaling, the same polynomials as binomial coefficients: $\binom{x}{k} = (x)_k/k!$. The changes between the standard basis $$\textstyle x^0, x^1, x^2, \dots$$ and the basis $\binom{x}{0}, \binom{x}{1}, \binom{x}{2}, \dots$ are thus described by similar formulas:
 * $$x^n=\sum_{k=0}^n \biggl\{{\!n\! \atop \!k\!}\biggr\} k! \binom{x}{k} \quad \text{and} \quad \binom{x}{n}=\sum_{k=0}^n \frac{s(n,k)}{n!} x^k$$.

Example
Expressing a polynomial in the basis of falling factorials is useful for calculating sums of the polynomial evaluated at consecutive integers. Indeed, the sum of falling factorials with fixed k can expressed as another falling factorial (for $$k\ne-1$$)


 * $$\sum_{0\leq i < n} (i)_k = \frac{(n)_{k+1}}{k+1} $$

This can be proved by induction.

For example, the sum of fourth powers of integers up to n (this time with n included), is:


 * $$\begin{align}

\sum_{i=0}^{n} i^4 & = \sum_{i=0}^n \sum_{k=0}^4 \biggl\{{\!4\! \atop \!k\!}\biggr\} (i)_k = \sum_{k=0}^4 \biggl\{{\!4\! \atop \!k\!}\biggr\} \sum_{i=0}^n (i)_k = \sum_{k=0}^4 \biggl\{{\!4\! \atop \!k\!}\biggr\} \frac{(n{+}1)_{k+1}}{k{+}1} \\[10mu] & = \biggl\{{\!4\! \atop \!1\!}\biggr\} \frac{(n{+}1)_{2}}2 + \biggl\{{\!4\! \atop \!2\!}\biggr\} \frac{(n{+}1)_{3}}3 + \biggl\{{\!4\! \atop \!3\!}\biggr\} \frac{(n{+}1)_{4}}4 + \biggl\{{\!4\! \atop \!4\!}\biggr\} \frac{(n{+}1)_{5}}5 \\[8mu] & = \frac12 (n{+}1)_{2} + \frac73 (n{+}1)_{3} + \frac64 (n{+}1)_{4} + \frac15 (n{+}1)_{5}\,. \end{align}$$

Here the Stirling numbers can be computed from their definition as the number of partitions of 4 elements into k non-empty unlabeled subsets.

In contrast, the sum $\sum_{i=0}^n i^k$ in the standard basis is given by Faulhaber's formula, which in general is more complicated.

As inverse matrices
The Stirling numbers of the first and second kinds can be considered inverses of one another:


 * $$\sum_{j=k}^n s(n,j) S(j,k) = \sum_{j=k}^n (-1)^{n-j} \biggl[{n \atop j}\biggr] \biggl\{{\!j\! \atop \!k\!}\biggr\} = \delta_{n,k}$$

and


 * $$\sum_{j=k}^n S(n,j) s(j,k) = \sum_{j=k}^n (-1)^{j-k} \biggl\{{\!n\! \atop \!j\!}\biggr\} \biggl[{j \atop k}\biggr]= \delta_{n,k},$$

where $$\delta_{nk}$$ is the Kronecker delta. These two relationships may be understood to be matrix inverse relationships. That is, let s be the lower triangular matrix of Stirling numbers of the first kind, whose matrix elements $$s_{nk}=s(n,k).\,$$ The inverse of this matrix is S, the lower triangular matrix of Stirling numbers of the second kind, whose entries are $$S_{nk}=S(n,k).$$ Symbolically, this is written


 * $$s^{-1} = S\,$$

Although s and S are infinite, so calculating a product entry involves an infinite sum, the matrix multiplications work because these matrices are lower triangular, so only a finite number of terms in the sum are nonzero.

Lah numbers
The Lah numbers $$L(n,k) = {n-1 \choose k-1} \frac{n!}{k!}$$ are sometimes called Stirling numbers of the third kind. By convention, $$L(0,0)=1$$ and $$L(n,k)=0$$ if $$n<k$$ or $$k = 0 < n$$.

These numbers are coefficients expressing falling factorials in terms of rising factorials and vice versa:
 * $$x^{(n)} = \sum_{k=0}^n L(n,k) (x)_k\quad$$ and $$\quad(x)_n = \sum_{k=0}^n (-1)^{n-k} L(n,k)x^{(k)}.$$

As above, this means they express the change of basis between the bases $$(x)_0,(x)_1,(x)_2,\cdots$$ and $$x^{(0)},x^{(1)},x^{(2)},\cdots$$, completing the diagram. In particular, one formula is the inverse of the other, thus:


 * $$\sum_{j=k}^n (-1)^{j-k} L(n,j) L(j,k) = \delta_{n,k}.$$

Similarly, composing the change of basis from $$x^{(n)}$$ to $$x^n$$ with the change of basis from $$x^n$$ to $$(x)_{n}$$ gives the change of basis directly from $$x^{(n)}$$ to $$(x)_{n}$$:


 * $$ L(n,k) = \sum_{j=k}^n \biggl[{n \atop j}\biggr] \biggl\{{\!j\! \atop \!k\!}\biggr\} ,$$

and similarly for other compositions. In terms of matrices, if $$L$$ denotes the matrix with entries $$L_{nk}=L(n,k)$$ and $$L^{-}$$ denotes the matrix with entries $$L^{-}_{nk}=(-1)^{n-k}L(n,k)$$, then one is the inverse of the other: $$ L^{-} = L^{-1}$$. Composing the matrix of unsigned Stirling numbers of the first kind with the matrix of Stirling numbers of the second kind gives the Lah numbers: $$L = |s| \cdot S$$.

Enumeratively, $\left\{{\!n\! \atop \!k\!}\right\}, \left[{n \atop k}\right], L(n,k)$ can be defined as the number of partitions of n elements into k non-empty unlabeled subsets, where each subset is endowed with no order, a cyclic order, or a linear order, respectively. In particular, this implies the inequalities:
 * $$\biggl\{{\!n\! \atop \!k\!}\biggr\} \leq \biggl[{n \atop k}\biggr] \leq L(n,k).$$

Inversion relations and the Stirling transform
For any pair of sequences, $$\{f_n\}$$ and $$\{g_n\}$$, related by a finite sum Stirling number formula given by


 * $$g_n = \sum_{k=0}^{n} \left\{\begin{matrix} n \\ k \end{matrix} \right\} f_k, $$

for all integers $$n \geq 0$$, we have a corresponding inversion formula for $$f_n$$ given by


 * $$f_n = \sum_{k=0}^{n} \left[\begin{matrix} n \\ k \end{matrix} \right] (-1)^{n-k} g_k. $$

The lower indices could be any integer between $0$ and $n$.

These inversion relations between the two sequences translate into functional equations between the sequence exponential generating functions given by the Stirling (generating function) transform as


 * $$\widehat{G}(z) = \widehat{F}\left(e^z-1\right)$$

and


 * $$\widehat{F}(z) = \widehat{G}\left(\log(1+z)\right). $$

For $$D = d/dx$$, the differential operators $$x^nD^n$$ and $$(xD)^n$$ are related by the following formulas for all integers $$n \geq 0$$:



\begin{align} (xD)^n &= \sum_{k=0}^n S(n, k) x^k D^k \\ x^n D^n &= \sum_{k=0}^n s(n, k) (xD)^k = (xD)_n = xD(xD - 1)\ldots (xD - n + 1) \end{align} $$

Another pair of "inversion" relations involving the Stirling numbers relate the forward differences and the ordinary $$n^{th}$$ derivatives of a function, $$f(x)$$, which is analytic for all $$x$$ by the formulas


 * $$\frac{1}{k!} \frac{d^k}{dx^k} f(x) = \sum_{n=k}^{\infty} \frac{s(n, k)}{n!} \Delta^n f(x)$$


 * $$\frac{1}{k!} \Delta^k f(x) = \sum_{n=k}^{\infty} \frac{S(n, k)}{n!} \frac{d^n}{dx^n} f(x). $$

Similar properties
See the specific articles for details.

Symmetric formulae
Abramowitz and Stegun give the following symmetric formulae that relate the Stirling numbers of the first and second kind.


 * $$ \left[{ n \atop k } \right] = \sum_{j=n}^{2n-k} (-1)^{j-k} \binom{j-1}{k-1} \binom{2n-k}{j} \left\{{ j-k \atop j-n} \right\} $$

and



\left\{{n \atop k}\right\} = \sum_{j=n}^{2n-k} (-1)^{j-k} \binom{j-1}{k-1} \binom{2n-k}{j} \left[{j-k \atop j-n } \right] $$

Stirling numbers with negative integral values
The Stirling numbers can be extended to negative integral values, but not all authors do so in the same way. Regardless of the approach taken, it is worth noting that Stirling numbers of first and second kind are connected by the relations:


 * $$\biggl[{n \atop k}\biggr] = \biggl\{{\!-k\! \atop \!-n\!}\biggr\} \quad \text{and} \quad

\biggl\{{\!n\! \atop \!k\!}\biggr\} = \biggl[{-k \atop -n}\biggr]$$

when n and k are nonnegative integers. So we have the following table for $$\left[{-n \atop -k}\right]$$:

Donald Knuth defined the more general Stirling numbers by extending a recurrence relation to all integers. In this approach, $ \left[{n \atop k}\right]$ and $\left\{{\!n\! \atop \!k\!}\right\}$ are zero if n is negative and k is nonnegative, or if n is nonnegative and k is negative, and so we have, for any integers n and k,
 * $$\biggl[{n \atop k}\biggr] = \biggl\{{\!-k\! \atop \!-n\!}\biggr\} \quad \text{and} \quad

\biggl\{{\!n\! \atop \!k\!}\biggr\} = \biggl[{-k \atop -n}\biggr].$$

On the other hand, for positive integers n and k, David Branson defined $ \left[{-n \atop -k}\right]\!,$ $\left\{{\!-n\! \atop \!-k\!}\right\}\!,$ $ \left[{-n \atop k}\right]\!,$  and $\left\{{\!-n\! \atop \!k\!}\right\}$ (but not $ \left[{n \atop -k}\right]$  or $\left\{{\!n\! \atop \!-k\!}\right\}$ ). In this approach, one has the following extension of the recurrence relation of the Stirling numbers of the first kind:


 * $$ \biggl[{-n \atop k}\biggr]

= \frac{(-1)^{n+1}}{n!}\sum_{i=1}^{n}\frac{(-1)^{i+1}}{i^k} \binom ni $$,

For example, $\left[{-5 \atop k}\right] = \frac1{120}\Bigl(5-\frac{10}{2^k}+\frac{10}{3^k}-\frac 5{4^k}+\frac 1{5^k}\Bigr).$  This leads to the following table of values of $\left[{n \atop k}\right]$  for negative integral n.

In this case $\sum_{n=1}^{\infty}\left[{-n \atop -k}\right]=B_{k} $ where $$B_{k}$$ is a Bell number, and so one may define the negative Bell numbers by $\sum_{n=1}^{\infty}\left[{-n \atop k}\right]=:B_{-k}$.

For example, this produces $\sum_{n=1}^{\infty}\left[{-n \atop 1}\right]=B_{-1}=\frac 1e\sum_{j=1}^\infty\frac1{j\cdot j!}=\frac 1e\int_0^1\frac{e^t-1}{t}dt=0.4848291\dots$, generally $B_{-k}=\frac 1e\sum_{j=1}^\infty\frac1{j^kj!} $.