Write permutation and combination in LaTeX
In this tutorial, we will learn how to write the permutation and combination in LaTeX.
I will show you both of those one by one.
Permutation in LaTeX
We will start with writing the permutation formula in LaTeX.
\documentclass{article} \usepackage{amsmath} \begin{document} The number of permutations of $n$ objects taken $r$ at a time is given by: \[ _{n}P_{r} = \frac{{n!}}{{(n-r)!}} \] \end{document}
Output:
The most popular form of permutation can be written in LaTeX like this:
\documentclass{article} \usepackage{amsmath} \begin{document} Permutation formula: \[ ^nC_r = \frac{{n!}}{{(n-r)!}} \] \end{document}
Output:
You can see the space between n and C is a little bit higher. We can reduce this by using \!
just like this:
^n\!C\!_r = \frac{{n!}}{{(n-r)!}}
We can represent the permutation in many different ways. Let’s check one by one:
\documentclass{article} \usepackage{amsmath} \begin{document} Permutation Formula: \[ P(n,r) = \frac{{n!}}{{(n-r)!}} \] \end{document}
Output:
We can also represent permutation like this:
\documentclass{article} \usepackage{amsmath} \begin{document} Permutation Formula: \[ P^n_r = \frac{{n!}}{{(n-r)!}} \] \end{document}
Output:
Here is the last one.
P_n,_r = \frac{{n!}}{{(n-r)!}}
Output:
Combination in LaTeX
\documentclass{article} \usepackage{amsmath} \begin{document} Combination formula: \[ ^nC_k = \frac{{n!}}{k!{(n-k)!}} \] \end{document}
Other forms of combination:
\documentclass{article} \usepackage{amsmath} \begin{document} Combination formula: \[ \binom{n}{k}={^n}C_k = \frac{{n!}}{k!{(n-k)!}} \] \end{document}
Output:
You can check: How to write binomial coefficient in LaTeX?
Leave a Reply