Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|cite|improve this question
$n!\over (n-r)! r!$. For permutations you divide by $(n-r)!$, not $(r-1)!$. – David Mitra Dec 16 '11 at 17:51
You could just look it up in Wikipedia. $\displaystyle n\mathrm{C}r =\frac{n!}{r!(n-r)!}$. – Arturo Magidin Dec 16 '11 at 17:51
Alright, thank you guys so much! – fr00ty_l00ps Dec 16 '11 at 17:53
@CodeAdmiral: Note: your formula for $n\mathrm{P}r$ is incorrect: it should be $n!$ divided by $(n-r)!$, not divided by $(r-1)!$. – Arturo Magidin Dec 16 '11 at 18:12
up vote 3 down vote accepted

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)!}$$

share|cite|improve this answer

Just to complete writing a formal answer (as it has been answered in the comments):

$\displaystyle n\mathrm{P}r =\frac{n!}{(n-r)!}$


$\displaystyle n\mathrm{C}r =\frac{n!}{r!(n-r)!}$

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.