To write “n choose k” in LaTeX, load amsmath and use \binom{n}{k}, which prints the binomial coefficient in parentheses and sizes itself for inline or display math; \dbinom and \tbinom force the large or small size. A factorial in LaTeX needs no command at all: n! is the letter and an exclamation mark, so the binomial formula is \frac{n!}{k!(n-k)!}. The table lists the combinatorics commands people use most, with the package each one needs; the full list of symbols follows below.
| Symbol | Command | Use | Package | Copy |
|---|---|---|---|---|
\binom{n}{k} | n choose k (binomial coefficient) | amsmath | ||
\dbinom{n}{k} | Display-size binomial, even inline | amsmath | ||
\tbinom{n}{k} | Text-size binomial, even in display | amsmath | ||
{n \choose k} | Plain TeX choose (avoid with amsmath) | built in | ||
n! | Factorial | built in | ||
n!! | Double factorial | built in | ||
\frac{n!}{k!(n-k)!} | Binomial coefficient formula | built in | ||
\binom{n}{k_1, k_2, \ldots, k_m} | Multinomial coefficient | amsmath | ||
P(n, k) = \frac{n!}{(n-k)!} | Permutations (nPr) | built in | ||
n^{\underline{k}} | Falling factorial | built in |
Permutations are usually spelled out as P(n, k) or written with the falling factorial (n)_k or n^{\underline{k}}; the rising factorial is n^{\overline{k}} or the Pochhammer symbol (a)_n. Stirling numbers use bracket and brace versions of a binomial, built with amsmath’s \genfrac: \genfrac{\{}{\}}{0pt}{}{n}{k} for the second kind. Sums and products over index sets are \sum_{k=0}^{n} and \prod_{i=1}^{n}, and the size of a finite set is |A| or \lvert A \rvert.
Add \usepackage{amsmath} for \binom, \genfrac and \lvert; nothing here requires amssymb. For sums, products and fractions in general, see our guide to mathematical expressions in LaTeX.
استخدم هذه الرموز في مستند حقيقي
افتح مستندًا مبدئيًا يحتوي على بعضها جاهزًا مع تحميل الحزم اللازمة. حرّره في Octree وشاهد ملف PDF دون أي تثبيت.
\binom{n}{k}C(n, k)P(n, k)\binom{n}{k_1, k_2, \ldots, k_m}(n)_kn^{(k)}\genfrac{[}{]}{0pt}{}{n}{k}\genfrac{\{}{\}}{0pt}{}{n}{k}B_nF_np(n)D_n(a)_n