User:Tokenzero/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 the 18th century. 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, with different ways of counting orderings within each subset.

Notation
Several different notations for Stirling numbers are in use. Common notations are:


 * $$ \left[{n \atop k}\right]=c(n,k)=|s(n,k)|\,$$

for unsigned Stirling numbers of the first kind, which count the number of permutations of n elements with k disjoint cycles,


 * $$ s(n,k)=(-1)^{n-k} \left[{n \atop k}\right]\,$$

for ordinary (signed) Stirling numbers of the first kind, and


 * $$ \left\{\begin{matrix} n \\ k \end{matrix}\right\} = S(n,k) = S_n^{(k)} \,$$

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

For example, the sum $$\sum_{k=0}^n \left[{n \atop k}\right] = n!$$ is the number of all permutations, while the sum $$\sum_{k=0}^n \left\{\begin{matrix} n \\ k \end{matrix}\right\} = B_n$$ is the nth Bell number.

Abramowitz and Stegun use an uppercase S and a blackletter 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.

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 = 1 because it is an empty product. Combinatorialists also sometimes use the notation for the falling factorial, and  for the rising factorial. (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 \left[{n \atop k}\right] x^k$$

with unsigned Stirling numbers of the first kind as coefficients.

Stirling numbers of the second kind express reverse relations:


 * $$x^n = \sum_{k=0}^n \left\{\begin{matrix} n \\ k \end{matrix}\right\}(x)_k$$

and


 * $$x^n = \sum_{k=0}^n (-1)^{n-k} \left\{\begin{matrix} n \\ k \end{matrix}\right\}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,\cdots \quad (x)_0,(x)_1,(x)_2,\cdots \quad x^{(0)},x^{(1)},x^{(2)},\cdots$$

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 change.svg

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.

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


 * $$\sum_{j\geq 0} s(n,j) S(j,k) = \sum_{j\geq 0} (-1)^{n-j} \begin{bmatrix}n\\j\end{bmatrix} \begin{Bmatrix}j\\k\end{Bmatrix} = \delta_{nk}$$

and


 * $$\sum_{j\geq 0} S(n,j) s(j,k) = \sum_{j\geq 0} (-1)^{j-k} \begin{Bmatrix}n\\j\end{Bmatrix} \begin{bmatrix}j\\k\end{bmatrix} = \delta_{nk},$$

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.

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 a falling factorial is simply expressed as another falling factorial (for k≠-1)


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

This is analogous to the integral $$\textstyle\int_0^n x^k = \frac{n^{k+1}}{k+1}$$, though the sum should be over integers i strictly less than n.

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 \begin{Bmatrix}4\\k\end{Bmatrix} (i)_4 = \sum_{k=0}^4 \begin{Bmatrix}4\\k\end{Bmatrix} \frac{(n+1)_{k+1}}{k+1} =\\ & =\frac{\{\begin{smallmatrix}4\\1\end{smallmatrix}\}}{2} (n+1)_{2} + \frac{\{\begin{smallmatrix}4\\2\end{smallmatrix}\}}{3} (n+1)_{3} + \frac{\{\begin{smallmatrix}4\\3\end{smallmatrix}\}}{4} (n+1)_{4} + \frac{\{\begin{smallmatrix}4\\4\end{smallmatrix}\}}{5} (n+1)_{5} =\\ & = \frac{1}{2} (n+1)_{2} + \frac{7}{3} (n+1)_{3} + \frac{6}{4} (n+1)_{4} + \frac{1}{5} (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 complex.

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} L(n,j) \cdot (-1)^{j-k} L(j,k) = \delta_{nk}.$$

Similarly, composing for example 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} \begin{bmatrix}n\\j\end{bmatrix} \begin{Bmatrix}j\\k\end{Bmatrix},$$

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}$$. Similarly, 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$$.

The numbers $$\textstyle\begin{Bmatrix}n\\k\end{Bmatrix}, \begin{bmatrix}n\\k\end{bmatrix}, L(n,k)$$ can be defined as the number of partitions of n elements into k non-empty subsets, each of which is unordered, cyclically ordered, or linearly ordered, respectively. In particular, this implies the following inequalities:
 * $$\begin{Bmatrix}n\\k\end{Bmatrix} \leq \begin{bmatrix}n\\k\end{bmatrix} \leq L(n,k).$$

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


 * $$s(n,k) = \sum_{j=0}^{n-k} (-1)^j {n-1+j \choose n-k+j} {2n-k \choose n-k-j} S(n-k+j,j)$$

and


 * $$S(n,k) = \sum_{j=0}^{n-k} (-1)^j {n-1+j \choose n-k+j} {2n-k \choose n-k-j} s(n-k+j,j).$$

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:


 * $$ \left[{n \atop k}\right]=\left\{\begin{matrix} -k \\ -n \end{matrix}\right\}\, \qquad\text{and}\qquad \left\{\begin{matrix} n \\ k \end{matrix}\right\}=\left[{-k \atop -n}\right]$$

when n and k are nonnegative integers. So we have 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\{\begin{matrix} n \\ k \end{matrix}\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,
 * $$ \left[{n \atop k}\right]=\left\{\begin{matrix} -k \\ -n \end{matrix}\right\}\, \qquad\text{and}\qquad \left\{\begin{matrix} n \\ k \end{matrix}\right\}=\left[{-k \atop -n}\right]$$.

On the other hand, for positive integers n and k, David Branson defined $$ \left[{-n \atop -k}\right]$$, $$ \left\{\begin{matrix} -n \\ -k \end{matrix}\right\}$$, $$ \left[{{-n} \atop k}\right]$$, and $$ \left\{\begin{matrix} -n \\ k \end{matrix}\right\}$$ (but not $$ \left[{n \atop -k}\right]$$ or $$ \left\{\begin{matrix} n \\ -k \end{matrix}\right\}$$). In this approach, from


 * $$ \left[{-n \atop k}\right]=\frac{(-1)^{n+1}}{n!}\sum_{i=1}^{n}(-1)^{i+1}\frac{n \choose i}{i^k} $$,

which is a generalizarion of the Recurrence relation of the Stirling numbers of the first kind, e.g. $$ \left[{-5 \atop k}\right]=(5-10/2^k+10/3^k-5/4^k+1/5^k)/120 $$,

we have following table for $$\left[{-n \atop k}\right]$$:

Note that: $$\sum_{n=-1}^{-\infty}\left[{-n \atop k}\right]=B_{-k} \qquad\text{and}\qquad \sum_{n=-1}^{-\infty}\left[{-n \atop -k}\right]=B_{k} $$

where $$B_{k}$$ is the Bell number of $$k$$, e.g. $$\sum_{n=-1}^{-\infty}\left[{-n \atop 2}\right]=B_{-2}=0.421773\ldots$$