Bell number

In combinatorial mathematics, the Bell numbers count the possible partitions of a set. These numbers have been studied by mathematicians since the 19th century, and their roots go back to medieval Japan. In an example of Stigler's law of eponymy, they are named after Eric Temple Bell, who wrote about them in the 1930s.

The Bell numbers are denoted $$B_n$$, where $$n$$ is an integer greater than or equal to zero. Starting with $$B_0 = B_1 = 1$$, the first few Bell numbers are
 * $$1, 1, 2, 5, 15, 52, 203, 877, 4140, \dots$$.

The Bell number $$B_n$$ counts the different ways to partition a set that has exactly $$n$$ elements, or equivalently, the equivalence relations on it. $$B_n$$ also counts the different rhyme schemes for $$ n $$-line poems.

As well as appearing in counting problems, these numbers have a different interpretation, as moments of probability distributions. In particular, $$B_n$$ is the $$ n $$-th moment of a Poisson distribution with mean 1.

Set partitions
In general, $$B_n$$ is the number of partitions of a set of size $$n$$. A partition of a set $$S$$ is defined as a family of nonempty, pairwise disjoint subsets of $$S$$ whose union is $$S$$. For example, $$B_3 = 5$$ because the 3-element set $$\{a,b,c\}$$ can be partitioned in 5 distinct ways:


 * $$\{ \{a\}, \{b\}, \{c\} \},$$
 * $$\{ \{a\}, \{b, c\} \},$$
 * $$\{ \{b\}, \{a, c\} \},$$
 * $$\{ \{c\}, \{a, b\} \},$$
 * $$\{ \{a, b, c\} \}.$$

As suggested by the set notation above, the ordering of subsets within the family is not considered; ordered partitions are counted by a different sequence of numbers, the ordered Bell numbers. $$B_0$$ is 1 because there is exactly one partition of the empty set. This partition is itself the empty set; it can be interpreted as a family of subsets of the empty set, consisting of zero subsets. It is vacuously true that all of the subsets in this family are non-empty subsets of the empty set and that they are pairwise disjoint subsets of the empty set, because there are no subsets to have these unlikely properties.

The partitions of a set correspond one-to-one with its equivalence relations. These are binary relations that are reflexive, symmetric, and transitive. The equivalence relation corresponding to a partition defines two elements as being equivalent when they belong to the same partition subset as each other. Conversely, every equivalence relation corresponds to a partition into equivalence classes. Therefore, the Bell numbers also count the equivalence relations.

Factorizations
If a number $$N$$ is a squarefree positive integer, meaning that it is the product of some number $$n$$ of distinct prime numbers, then $$B_n$$ gives the number of different multiplicative partitions of $$N$$. These are factorizations of $$N$$ into numbers greater than one, treating two factorizations as the same if they have the same factors in a different order. For instance, 30 is the product of the three primes 2, 3, and 5, and has $$B_3$$ = 5 factorizations:
 * $$30 = 2\times 15=3\times 10=5\times 6=2\times 3\times 5$$

Rhyme schemes
The Bell numbers also count the rhyme schemes of an n-line poem or stanza. A rhyme scheme describes which lines rhyme with each other, and so may be interpreted as a partition of the set of lines into rhyming subsets. Rhyme schemes are usually written as a sequence of Roman letters, one per line, with rhyming lines given the same letter as each other, and with the first lines in each rhyming set labeled in alphabetical order. Thus, the 15 possible four-line rhyme schemes are AAAA, AAAB, AABA, AABB, AABC, ABAA, ABAB, ABAC, ABBA, ABBB, ABBC, ABCA, ABCB, ABCC, and ABCD.

Permutations
The Bell numbers come up in a card shuffling problem mentioned in the addendum to. If a deck of n cards is shuffled by repeatedly removing the top card and reinserting it anywhere in the deck (including its original position at the top of the deck), with exactly n repetitions of this operation, then there are nn different shuffles that can be performed. Of these, the number that return the deck to its original sorted order is exactly Bn. Thus, the probability that the deck is in its original order after shuffling it in this way is Bn/nn, which is significantly larger than the 1/n! probability that would describe a uniformly random permutation of the deck.

Related to card shuffling are several other problems of counting special kinds of permutations that are also answered by the Bell numbers. For instance, the nth Bell number equals the number of permutations on n items in which no three values that are in sorted order have the last two of these three consecutive. In a notation for generalized permutation patterns where values that must be consecutive are written adjacent to each other, and values that can appear non-consecutively are separated by a dash, these permutations can be described as the permutations that avoid the pattern 1-23. The permutations that avoid the generalized patterns 12-3, 32-1, 3-21, 1-32, 3-12, 21-3, and 23-1 are also counted by the Bell numbers. The permutations in which every 321 pattern (without restriction on consecutive values) can be extended to a 3241 pattern are also counted by the Bell numbers. However, the Bell numbers grow too quickly to count the permutations that avoid a pattern that has not been generalized in this way: by the (now proven) Stanley–Wilf conjecture, the number of such permutations is singly exponential, and the Bell numbers have a higher asymptotic growth rate than that.

Triangle scheme for calculations
The Bell numbers can easily be calculated by creating the so-called Bell triangle, also called Aitken's array or the Peirce triangle after Alexander Aitken and Charles Sanders Peirce.


 * 1) Start with the number one.  Put this on a row by itself. ($$ x_{0,1} = 1 $$)
 * 2) Start a new row with the rightmost element from the previous row as the leftmost number ($$x_{i,1} \leftarrow x_{i-1, r}$$ where r is the last element of (i-1)-th row)
 * 3) Determine the numbers not on the left column by taking the sum of the number to the left and the number above the number to the left, that is, the number diagonally up and left of the number we are calculating $$( x_{i,j} \leftarrow x_{i,j-1} + x_{i-1,j-1} )$$
 * 4) Repeat step three until there is a new row with one more number than the previous row (do step 3 until $$ j = r + 1 $$)
 * 5) The number on the left hand side of a given row is the Bell number for that row. ($$B_i \leftarrow x_{i,1}$$)

Here are the first five rows of the triangle constructed by these rules:

$$ \begin{array}{l} 1 \\ 1 &  2 \\  2 &  3 &  5 \\  5 &  7 & 10 & 15 \\ 15 &  20 &  27 &  37 & 52 \end{array} $$

The Bell numbers appear on both the left and right sides of the triangle.

Summation formulas
The Bell numbers satisfy a recurrence relation involving binomial coefficients:
 * $$B_{n+1}=\sum_{k=0}^{n} \binom{n}{k} B_k.$$

It can be explained by observing that, from an arbitrary partition of n + 1 items, removing the set containing the first item leaves a partition of a smaller set of k items for some number k that may range from 0 to n. There are $$\tbinom{n}{k}$$ choices for the k items that remain after one set is removed, and Bk choices of how to partition them.

A different summation formula represents each Bell number as a sum of Stirling numbers of the second kind
 * $$B_n=\sum_{k=0}^n \left\{{n\atop k}\right\}.$$

The Stirling number $$\left\{{n\atop k}\right\}$$ is the number of ways to partition a set of cardinality n into exactly k nonempty subsets. Thus, in the equation relating the Bell numbers to the Stirling numbers, each partition counted on the left hand side of the equation is counted in exactly one of the terms of the sum on the right hand side, the one for which k is the number of sets in the partition.

has given a formula that combines both of these summations:
 * $$B_{n+m} = \sum_{k=0}^n \sum_{j=0}^m \left\{{m\atop j}\right\} {n \choose k} j^{n-k} B_k.$$

Applying Pascal's inversion formula to the recurrence relation, we obtain

$$B_n = \sum_{k=0}^n \binom{n}{k} (-1)^{n-k} B_{k+1},$$

which can be generalized in this manner:

$$\sum_{j=0}^n \binom{n}{j} B_{k+j} = \sum_{i=0}^k \binom{k}{i} (-1)^{k-i} B_{n+i+1}.$$

Other finite sum formulas using Stirling numbers of the first kind include

$$\sum_{j=0}^n \binom{n}{j} a^j b^{n-j} B_j = \sum_{i=0}^k \left[{k \atop i}\right](-1)^{k-i} \sum_{j=0}^n \binom{n}{j} a^j (b-ak)^{n-j}B_{j+i},$$

which simplifies down with $$k=1$$ to

$$\sum_{j=0}^n \binom{n}{j} a^j b^{n-j} B_j = \sum_{j=0}^n \binom{n}{j} a^j (b-a)^{n-j}B_{j+1}$$

and with $$a=1$$, $$b=k$$ to

$$\sum_{j=0}^n \binom{n}{j} B_j k^{n-j} = \sum_{i=0}^k \left[{k \atop i}\right] B_{n+i} (-1)^{k-i}$$ which can be seen as the inversion formula for Stirling numbers applied to Spivey’s formula.

Generating function
The exponential generating function of the Bell numbers is
 * $$B(x) = \sum_{n=0}^\infty \frac{B_n}{n!} x^n = e^{e^x-1}.$$

In this formula, the summation in the middle is the general form used to define the exponential generating function for any sequence of numbers, and the formula on the right is the result of performing the summation in the specific case of the Bell numbers.

One way to derive this result uses analytic combinatorics, a style of mathematical reasoning in which sets of mathematical objects are described by formulas explaining their construction from simpler objects, and then those formulas are manipulated to derive the combinatorial properties of the objects. In the language of analytic combinatorics, a set partition may be described as a set of nonempty urns into which elements labelled from 1 to n have been distributed, and the combinatorial class of all partitions (for all n) may be expressed by the notation
 * $$\mathrm{S\scriptstyle ET}(\mathrm{S\scriptstyle ET}_{\ge 1}(\mathcal{Z})).$$

Here, $$\mathcal{Z}$$ is a combinatorial class with only a single member of size one, an element that can be placed into an urn. The inner $$\mathrm{S\scriptstyle ET}_{\ge 1}$$ operator describes a set or urn that contains one or more labelled elements, and the outer $$\mathrm{S\scriptstyle ET}$$ describes the overall partition as a set of these urns. The exponential generating function may then be read off from this notation by translating the $$\mathrm{S\scriptstyle ET}$$ operator into the exponential function and the nonemptiness constraint ≥1 into subtraction by one.

An alternative method for deriving the same generating function uses the recurrence relation for the Bell numbers in terms of binomial coefficients to show that the exponential generating function satisfies the differential equation $$B'(x) = e^{x}B(x)$$. The function itself can be found by solving this equation.

Moments of probability distributions
The Bell numbers satisfy Dobinski's formula
 * $$B_n=\frac{1}{e}\sum_{k=0}^\infty \frac{k^n}{k!}.$$

This formula can be derived by expanding the exponential generating function using the Taylor series for the exponential function, and then collecting terms with the same exponent. It allows Bn to be interpreted as the nth moment of a Poisson distribution with expected value 1.

The nth Bell number is also the sum of the coefficients in the nth complete Bell polynomial, which expresses the nth moment of any probability distribution as a function of the first n cumulants.

Modular arithmetic
The Bell numbers obey Touchard's congruence: If p is any prime number then
 * $$B_{p+n} \equiv B_n+B_{n+1} \pmod p$$

or, generalizing
 * $$B_{p^m+n} \equiv mB_n+B_{n+1} \pmod p.$$

Because of Touchard's congruence, the Bell numbers are periodic modulo p, for every prime number p; for instance, for p = 2, the Bell numbers repeat the pattern odd-odd-even with period three. The period of this repetition, for an arbitrary prime number p, must be a divisor of
 * $$\frac{p^p-1}{p-1}$$

and for all prime $$p \leq 101$$ and $$ p = 113, 163, 167 $$, or $$173$$ it is exactly this number.

The period of the Bell numbers to modulo n are
 * 1, 3, 13, 12, 781, 39, 137257, 24, 39, 2343, 28531167061, 156, 25239592216021, 411771, 10153, 48, 51702516367896047761, 39, 109912203092239643840221, 9372, 1784341, 85593501183, 949112181811268728834319677753, 312, 3905, 75718776648063, 117, 1647084, 91703076898614683377208150526107718802981, 30459, 568972471024107865287021434301977158534824481, 96, 370905171793, 155107549103688143283, 107197717, 156, ...

Integral representation
An application of Cauchy's integral formula to the exponential generating function yields the complex integral representation
 * $$ B_n = \frac{n!}{2 \pi i e} \int_{\gamma} \frac{e^{e^z}}{z^{n+1}} \, dz. $$

Some asymptotic representations can then be derived by a standard application of the method of steepest descent.

Log-concavity
The Bell numbers form a logarithmically convex sequence. Dividing them by the factorials, Bn/n!, gives a logarithmically concave sequence.

Growth rate
Several asymptotic formulas for the Bell numbers are known. In the following bounds were established:
 * $$ B_n < \left( \frac{0.792 n}{\ln( n+1)} \right)^n $$ for all positive integers $$n$$;

moreover, if $$ \varepsilon>0 $$ then for all $$ n > n_0(\varepsilon) $$,
 * $$ B_n < \left( \frac{e^{-0.6 + \varepsilon} n}{\ln(n+1)}\right)^n $$

where  $$ ~n_0(\varepsilon) = \max\left\{e^4,d^{-1}(\varepsilon) \right\}~ $$   and $$ ~d(x):= \ln \ln (x+1) - \ln \ln x + \frac{1+e^{-1}}{\ln x}\,. $$ The Bell numbers can also be approximated using the Lambert W function, a function with the same growth rate as the logarithm, as
 * $$B_n \sim \frac{1}{\sqrt{n}} \left( \frac{n}{W(n)} \right)^{n + \frac{1}{2}} \exp\left(\frac{n}{W(n)} - n - 1\right). $$

established the expansion
 * $$B_{n+h} = \frac{(n+h)!}{W(n)^{n+h}} \times \frac{\exp(e^{W(n)} - 1)}{(2\pi B)^{1/2}} \times \left( 1 + \frac{P_0 + hP_1 + h^2P_2}{e^{W(n)}} + \frac{Q_0 + hQ_1 + h^2Q_2 + h^3Q_3 + h^4Q_4}{e^{2W(n)}} + O(e^{-3W(n)}) \right)$$

uniformly for $$h = O(\ln(n))$$ as $$n \rightarrow \infty$$, where $$B$$ and each $$P_i$$ and $$Q_i$$ are known expressions in $$W(n)$$.

The asymptotic expression



\begin{align} \frac{\ln B_n}{n} & = \ln n - \ln \ln n - 1 + \frac{\ln \ln n}{\ln n} + \frac{1}{\ln n} + \frac{1}{2}\left(\frac{\ln \ln n}{\ln n}\right)^2 + O\left(\frac{\ln \ln n}{(\ln n)^2} \right) \\ & {} \qquad \text{as }n\to\infty \end{align} $$

was established by.

Bell primes
raised the question of whether infinitely many Bell numbers are also prime numbers. These are called Bell primes. The first few Bell primes are:
 * 2, 5, 877, 27644437, 35742549198872617291353508656626642567, 359334085968622831041960188598043661065388726959079837

corresponding to the indices 2, 3, 7, 13, 42 and 55. The next Bell prime is B2841, which is approximately 9.30740105 &times; 106538.

History
The Bell numbers are named after Eric Temple Bell, who wrote about them in 1938, following up a 1934 paper in which he studied the Bell polynomials. Bell did not claim to have discovered these numbers; in his 1938 paper, he wrote that the Bell numbers "have been frequently investigated" and "have been rediscovered many times". Bell cites several earlier publications on these numbers, beginning with which gives Dobiński's formula for the Bell numbers. Bell called these numbers "exponential numbers"; the name "Bell numbers" and the notation Bn for these numbers was given to them by.

The first exhaustive enumeration of set partitions appears to have occurred in medieval Japan, where (inspired by the popularity of the book The Tale of Genji) a parlor game called genji-ko sprang up, in which guests were given five packets of incense to smell and were asked to guess which ones were the same as each other and which were different. The 52 possible solutions, counted by the Bell number B5, were recorded by 52 different diagrams, which were printed above the chapter headings in some editions of The Tale of Genji.

In Srinivasa Ramanujan's second notebook, he investigated both Bell polynomials and Bell numbers. Early references for the Bell triangle, which has the Bell numbers on both of its sides, include and.