Stirling Second Kind in LaTeX (\genfrac{\{}{\}}{0pt}{}{n}{k})

{nk}\genfrac{\{}{\}}{0pt}{}{n}{k}
LaTeX command
\genfrac{\{}{\}}{0pt}{}{n}{k}
Package
Add to your preamble:\usepackage{amsmath}
Mode
Math mode only

Try Stirling Second Kind in a real LaTeX document

Open a ready-to-compile document that already uses \genfrac{\{}{\}}{0pt}{}{n}{k}, with the right packages loaded. Edit it and see the PDF, no install needed.

Where it is used

Stirling number of the second kind: ways to partition an n-element set into k nonempty blocks, in brace notation.

Here \genfrac draws escaped braces \{ and \} as delimiters with a 0pt bar, producing the brace notation popularized by Knuth. The numbers obey S(n+1, k) = k\,S(n, k) + S(n, k-1), sum over k to the Bell number B_n, and convert powers to falling factorials: x^n = \sum_k {n \brace k}(x)_k. Because the braces must be escaped, a missing backslash is the usual compile error. Wrap it in a macro like \stirlingII{n}{k}. The alternative notation S(n, k) is simpler to type and common in computer science texts.

Minimal compilable example

Paste this into an empty .tex file and compile it with pdfLaTeX, XeLaTeX or LuaLaTeX.

{42}=7\genfrac{\{}{\}}{0pt}{}{4}{2} = 7
\documentclass{article}
\usepackage{amsmath}
\begin{document}
Stirling Second Kind: $\genfrac{\{}{\}}{0pt}{}{n}{k}$

\[ \genfrac{\{}{\}}{0pt}{}{4}{2} = 7 \]
\end{document}

Related symbols

All التوافقيات →

Frequently asked questions

How do I write Stirling Second Kind in LaTeX?
Type \genfrac{\{}{\}}{0pt}{}{n}{k} in math mode, for example $\genfrac{\{}{\}}{0pt}{}{4}{2} = 7$. Load amsmath first with \usepackage{amsmath}.
Which package do I need for \genfrac{\{}{\}}{0pt}{}{n}{k}?
\genfrac{\{}{\}}{0pt}{}{n}{k} needs amsmath: add \usepackage{amsmath} to your preamble before the document starts.
Can I use \genfrac{\{}{\}}{0pt}{}{n}{k} in text mode, or only in math mode?
Only in math mode. Outside $...$ LaTeX stops with "Missing $ inserted", so write $\genfrac{\{}{\}}{0pt}{}{n}{k}$ in running text.
Math poweredاكتب LaTeX باستخدام الذكاء الاصطناعي

أفضل محرر LaTeX بالذكاء الاصطناعي، بديل Overleaf

يساعد Octree الباحثين من أكثر من 15 جامعة على كتابة أوراق البحث بشكل أسرع باستخدام الذكاء الاصطناعي

  • أنشئ رسوم TikZ جميلة باستخدام الذكاء الاصطناعي
  • ارفع صورة وحولها إلى LaTeX بسلاسة
  • احصل على مساعدة فورية في كتابة وتنسيق أوراق البحث