I am an eighth grader in need of some help. I was assigned a school project on making a java application that computes the total permutations of to given numbers where nPr and later on nCr. I understand the equation for permutations is n! divided by (r-1)!, but what is the equation for combinations by the terms of n and r?
Help with factorials, permutations, and combinations
-
1$n!\over (n-r)! r!$. For permutations you divide by $(n-r)!$, not $(r-1)!$. – 2011-12-16
-
0You could just look it up in [Wikipedia](http://en.wikipedia.org/wiki/Binomial_coefficient#Multiplicative_formula). $\displaystyle n\mathrm{C}r =\frac{n!}{r!(n-r)!}$. – 2011-12-16
-
0Alright, thank you guys so much! – 2011-12-16
-
0@CodeAdmiral: Note: your formula for $n\mathrm{P}r$ is **incorrect**: it should be $n!$ divided by $(n-r)!$, not divided by $(r-1)!$. – 2011-12-16
2 Answers
One way to derive the formula from the number of permutations, $n\mathrm{P}r$, is the following:
To count the number of permutations of $r$ elements out of $n$, you can first select the $r$ elements, which can be done in $n\mathrm{C}r$ ways; and then you can order them, which can be done in $r\mathrm{P}r$ ways (you are now only ordering the $r$ elements you chose). That is, $$n\mathrm{P}r = n\mathrm{C}r\times r\mathrm{P}r.$$ Since you already know that $n\mathrm{P}r = n!/(n-r)!$ and that $r\mathrm{P}r = r!$, then solving for $n\mathrm{C}r$ we get: $$n\mathrm{C}r = \frac{n\mathrm{P}r}{r\mathrm{P}r} = \frac{n!}{r!(n-r)!}$$
Just to complete writing a formal answer (as it has been answered in the comments):
$\displaystyle n\mathrm{P}r =\frac{n!}{(n-r)!}$
and
$\displaystyle n\mathrm{C}r =\frac{n!}{r!(n-r)!}$