{
  "id": "bell-number",
  "title": "Bell Number",
  "lang": "en",
  "source_lang": "en",
  "summary": "A Bell number counts the ways to partition a finite set into nonempty, unordered blocks, forming a fundamental sequence in combinatorics.",
  "category": "mathematics",
  "subcategory": "discrete-logic",
  "type": "concept",
  "aliases": [
    "Bell numbers",
    "exponential numbers"
  ],
  "generated_at": "2026-11-05",
  "model": "pro/gpt-6.1-sol",
  "url": "https://aiwiki.page/en/bell-number/",
  "translations": {
    "zh-Hans": {
      "url": "https://aiwiki.page/zh/bell-number/",
      "json": "https://aiwiki.page/zh/bell-number.json"
    }
  },
  "sections": [
    {
      "heading": "",
      "text": "The Bell number \\(B_n\\) is the number of ways to partition a set of \\(n\\) distinct elements into nonempty, mutually disjoint blocks. Neither the order of the blocks nor the order of elements within a block matters. Bell numbers are fundamental in combinatorics and arise in the study of equivalence relations, generating functions, probability, and classification problems. The sequence begins\n\n\\[B_0,B_1,B_2,\\ldots = 1,1,2,5,15,52,203,877,4140,21147,115975,\\ldots.\\]"
    },
    {
      "heading": "Definition and examples",
      "text": "A set partition of a finite set \\(S\\) is a collection of nonempty subsets, called blocks, such that each element of \\(S\\) belongs to exactly one block. The number of such partitions depends only on the number of elements of \\(S\\), not on their identities.\n\nFor \\(S=\\{a,b,c\\}\\), the five partitions are\n\n\\[\\begin{aligned} &\\{\\{a,b,c\\}\\},\\\\ &\\{\\{a,b\\},\\{c\\}\\},\\\\ &\\{\\{a,c\\},\\{b\\}\\},\\\\ &\\{\\{b,c\\},\\{a\\}\\},\\\\ &\\{\\{a\\},\\{b\\},\\{c\\}\\}. \\end{aligned}\\]\n\nThus \\(B_3=5\\).\n\nBy convention, \\(B_0=1\\): the empty set has exactly one partition, the empty collection of blocks. This is different from a collection containing an empty block, which is not a valid partition.\n\nEvery partition determines an equivalence relation: two elements are equivalent precisely when they lie in the same block. Conversely, the equivalence classes of an equivalence relation form a partition. Consequently, \\(B_n\\) also counts the equivalence relations on an \\(n\\)-element set.\n\nBell numbers should not be confused with counts of integer partitions. In a set partition the elements are distinguishable; in an integer partition only the sizes of the parts matter."
    },
    {
      "heading": "Recurrence relation",
      "text": "The Bell numbers satisfy the recurrence relation\n\n\\[B_{n+1}=\\sum_{k=0}^{n}\\binom{n}{k}B_k, \\qquad B_0=1,\\]\n\nwhere \\(\\binom{n}{k}\\) is a binomial coefficient.\n\nTo establish this identity, distinguish one element in a set of \\(n+1\\) elements. Choose the \\(k\\) elements that do not belong to its block. These can be chosen in \\(\\binom{n}{k}\\) ways and partitioned in \\(B_k\\) ways. All remaining elements belong to the distinguished element’s block. Summing over \\(k\\) counts every partition exactly once.\n\nFor example,\n\n\\[B_4 =\\binom30B_0+\\binom31B_1+\\binom32B_2+\\binom33B_3 =1+3+6+5=15.\\]\n\nBell triangle\n\nAn elementary way to compute the sequence is the Bell triangle, also called the Aitken triangle:\n\n\\[\\begin{array}{rrrrrr} 1\\\\ 1&2\\\\ 2&3&5\\\\ 5&7&10&15\\\\ 15&20&27&37&52\\\\ 52&67&87&114&151&203 \\end{array}\\]\n\nEach row begins with the final entry of the preceding row. Each subsequent entry is the sum of the entry immediately to its left and the entry above-left. With rows numbered from zero, the first entry of row \\(n\\) is \\(B_n\\), and the last is \\(B_{n+1}\\).\n\nThe triangle computes all Bell numbers through \\(B_n\\) using \\(O(n^2)\\) additions and \\(O(n)\\) stored integers if only the current row is retained. These bounds count arithmetic operations and stored integers; they do not account for the increasing number of digits in the entries."
    },
    {
      "heading": "Connection with Stirling numbers",
      "text": "The Stirling number of the second kind \\(S(n,k)\\) counts partitions of an \\(n\\)-element set into exactly \\(k\\) nonempty blocks. Therefore,\n\n\\[B_n=\\sum_{k=0}^{n}S(n,k).\\]\n\nThe Stirling numbers satisfy\n\n\\[S(n+1,k)=kS(n,k)+S(n,k-1).\\]\n\nThe new element either joins one of \\(k\\) existing blocks or forms a singleton block.\n\nA related identity expresses an ordinary power in terms of falling factorials:\n\n\\[x^n=\\sum_{k=0}^{n}S(n,k)x^{\\underline{k}},\\]\n\nwhere\n\n\\[x^{\\underline{k}}=x(x-1)\\cdots(x-k+1), \\qquad x^{\\underline0}=1.\\]\n\nThe Touchard polynomial\n\n\\[T_n(x)=\\sum_{k=0}^{n}S(n,k)x^k\\]\n\nrecords the number of blocks by a variable. Bell numbers are its values at \\(x=1\\):\n\n\\[T_n(1)=B_n.\\]"
    },
    {
      "heading": "Exponential generating function",
      "text": "The exponential generating function of the Bell numbers is\n\n\\[F(x)=\\sum_{n=0}^{\\infty}B_n\\frac{x^n}{n!} =\\exp(e^x-1),\\]\n\nwhere \\(n!\\) denotes the factorial of \\(n\\).\n\nThe inner expression\n\n\\[e^x-1=\\sum_{m=1}^{\\infty}\\frac{x^m}{m!}\\]\n\nrepresents a nonempty block of labeled elements. The outer exponential function accounts for an unordered collection of such blocks.\n\nDifferentiating gives\n\n\\[F'(x)=e^xF(x).\\]\n\nComparing coefficients recovers the Bell recurrence. The identity can be treated as an identity of formal power series; analytically, the series converges for every complex \\(x\\).\n\nMore generally, the Touchard polynomials have generating function\n\n\\[\\sum_{n=0}^{\\infty}T_n(t)\\frac{x^n}{n!} =\\exp\\!\\bigl(t(e^x-1)\\bigr).\\]"
    },
    {
      "heading": "Dobiński’s formula and probability",
      "text": "Dobiński’s formula expresses each Bell number as an infinite sum:\n\n\\[B_n=\\frac1e\\sum_{k=0}^{\\infty}\\frac{k^n}{k!}.\\]\n\nHere \\(e\\) is Euler’s number. For \\(n=0\\), the term \\(0^0\\) is interpreted as \\(1\\).\n\nThe formula follows by expanding the generating function:\n\n\\[\\exp(e^x-1) =\\frac1e\\sum_{k=0}^{\\infty}\\frac{e^{kx}}{k!}\\]\n\nand comparing coefficients of \\(x^n/n!\\).\n\nIt also has a direct probabilistic interpretation. If \\(X\\) has a Poisson distribution with parameter \\(1\\), then\n\n\\[\\Pr(X=k)=\\frac{e^{-1}}{k!},\\]\n\nso\n\n\\[\\mathbb E[X^n]=B_n.\\]\n\nThus Bell numbers are the raw moments of a Poisson random variable with mean \\(1\\), where \\(\\mathbb E\\) denotes expected value. More generally, if \\(X\\) has a Poisson distribution with parameter \\(\\lambda\\), then\n\n\\[\\mathbb E[X^n]=T_n(\\lambda).\\]\n\nAlthough Dobiński’s formula is exact, its infinite sum and noninteger intermediate quantities generally make recurrence-based methods more convenient for exact integer computation."
    },
    {
      "heading": "Growth and congruences",
      "text": "Bell numbers grow faster than any fixed-base exponential \\(c^n\\), but more slowly than \\(n!\\). A useful logarithmic estimate is\n\n\\[\\log B_n = n\\log n-n\\log\\log n-n + O\\!\\left(\\frac{n\\log\\log n}{\\log n}\\right), \\qquad n\\to\\infty.\\]\n\nHere \\(\\log\\) denotes the natural logarithm, and the error term uses big-O notation. The estimate describes growth on a logarithmic scale; it is not by itself a relative-error approximation for \\(B_n\\).\n\nBell numbers also satisfy identities in modular arithmetic. Touchard’s congruence states that, for every prime \\(p\\) and every integer \\(n\\geq0\\),\n\n\\[B_{n+p}\\equiv B_n+B_{n+1}\\pmod p.\\]\n\nFor \\(p=2\\), this becomes\n\n\\[B_{n+2}\\equiv B_n+B_{n+1}\\pmod2.\\]\n\nStarting from \\(B_0\\equiv B_1\\equiv1\\), the parity pattern repeats as \\(1,1,0\\). Hence \\(B_n\\) is even exactly when \\(n\\equiv2\\pmod3\\)."
    },
    {
      "heading": "Applications and related counts",
      "text": "Bell numbers measure the number of possible groupings when objects are distinguishable but groups are unlabeled.\n\n- Clustering: There are \\(B_n\\) possible partitions of \\(n\\) observations if any number of nonempty clusters is allowed. This is the unconstrained combinatorial search space for cluster analysis, not the number of outputs of a particular clustering algorithm.\n- Relations and classification: Equivalence relations on a finite set correspond exactly to its partitions.\n- Graph theory: In graph theory, \\(B_n\\) counts labeled simple graphs on \\(n\\) vertices whose connected components are all complete graphs. Each block specifies one complete component.\n- Probability: Bell numbers arise as Poisson moments and in formulas that organize products of random variables by partitions.\n\nDifferent conventions lead to different counts. If exactly \\(k\\) unlabeled nonempty groups are required, the count is \\(S(n,k)\\). If those \\(k\\) groups receive distinct labels, the count becomes \\(k!S(n,k)\\). If every group must have size two, only pair partitions are counted, not all Bell partitions."
    },
    {
      "heading": "Historical background",
      "text": "The sequence is named after Eric Temple Bell, who studied these numbers in the 1930s under the name “exponential numbers.” The partition-counting sequence and several of its formulas predate his work. Dobiński’s infinite-series formula dates to 1877."
    }
  ],
  "links": [
    "combinatorics",
    "set-partition",
    "empty-set",
    "equivalence-relation",
    "recurrence-relation",
    "binomial-coefficient",
    "generating-function",
    "factorial",
    "exponential-function",
    "e-mathematical-constant",
    "poisson-distribution",
    "expected-value",
    "natural-logarithm",
    "big-o-notation",
    "modular-arithmetic",
    "cluster-analysis",
    "graph-theory"
  ],
  "sources": [],
  "license": "https://creativecommons.org/licenses/by/4.0/"
}