[Tex/LaTex] command to write the form of a combination or permutation?

math-mode

I'm trying to write

^nP_k=\frac{n!}{(n-k)!}  
\binom nk=^nC_k=\frac{n!}{k!(n-k)!}

but when compiled the n is a little far away from the P and C for my liking. Is there a command to write this? I know there is a \binom so I was hopeful. If not, is there a way to force the n to be closer?

\documentclass{article}  
\begin{document}  
$ ^nP_k=\frac{n!}{(n-k}!} - permutation \\  
\binom nk=^nC_k=\frac{n!}{k!(n-k)!} - combination $  
end{document}

Best Answer

You could use the \prescript command from the mathtools package and define two commands; something along the following lines:

\documentclass{article}
\usepackage{mathtools}

\newcommand\Myperm[2][^n]{\prescript{#1\mkern-2.5mu}{}P_{#2}}
\newcommand\Mycomb[2][^n]{\prescript{#1\mkern-0.5mu}{}C_{#2}}

\begin{document}

\[
\Myperm{k} = \frac{n!}{(n-k)!}\quad
\Mycomb{k} = \frac{n!}{k!(n-k)!}\quad
\Myperm[m]{k} = \frac{m!}{(m-k)!}\quad
\Mycomb[m]{k} = \frac{m!}{k!(m-k)!}\quad
\]

\end{document}

enter image description here

Related Question