In this tutorial, we will cover the binomial coefficient in three ways using LaTeX.
First, I will use the \binom
command and with it the \dbinom
command for text mode.
\documentclass{article}
\usepackage{amsmath}
\begin{document}
$$ \binom{n}{k}=\frac{n!}{k!(n-k)!} $$
$$ \dbinom{8}{5}=\frac{8!}{5!(8-5)!} $$
% Use \tbinom command for text mode
$$ \tbinom{n}{k} $$
\end{document}
Output :
Second, I will use {n\choose k}
syntax to represent this symbol. You can use this syntax instead of using the \binom
command.
In both cases, you will return the same output.
\documentclass{article}
\newcommand{\binomial}[2]{{#1\choose #2}}
\begin{document}
$$ {n\choose k}=\frac{n!}{k!(n-k)!}$$
% Use \newcommand for binomial coefficent
$$ \binomial{n}{k},\binomial{n^\prime}{k^\prime} $$
$$ \binomial{p}{q}=\frac{p!}{q!(p-q)!} $$
\end{document}
Output :
Use \genfrac command for binomial coefficient in LaTeX
amsmath package contains an interesting command. In the first two arguments, you have to use left and right parentheses.
And lastly, two arguments of binomial coefficient have to be used.
\documentclass{article}
\usepackage{amsmath}
\newcommand{\binomial}[2]{\genfrac{(}{)}{0pt}{}{#1}{#2}}
\begin{document}
$$ \genfrac{(}{)}{0pt}{}{n}{k}=\frac{n!}{k!(n-k)!} $$
% Use \newcommand for easy to write
$$ \binomial{a}{b},\binomial{p}{q} $$
\end{document}
Output :