Sunday, February 19, 2012

When working with combinations and permutations remember that with permutations order matters and with combinations, order does not matter.  Suppose we want to arrange 5 books on a shelf.  How many ways can those books be arranged?  You could put any of the 5 books on the far left. After a book is placed, any of the remaining 4 books can be placed next to it. Then any of the 3 remaining books can be placed next to that and so on.  The calculation for this is 5 * 4 * 3 * 2 * 1 = 120 or 5!  The symbol ! means factorial.  10! would be 10 *9 *8 *7 *6..... * 1.

Now supposed you have 5 books on the shelf and you want to randomly choose 2 of those books. How many ways can you choose 2 books from the 5 if order that the books are chosen does not matter?  What I mean by order not mattering is choosing "Moby Dick" first and "A Tale of Two Cities" second would be the same as choosing "A Tale of Two Cities" first and "Moby Dick" second.

The formula for combinations is n!/r!(n-r)! , where n is the number objects to choose from and r is the number of objects chosen.

So in this example we'd have 5!/(2! * 3!) = 120/12 = 10

To simplify this, 5!/(2! * 3!) =   (5 * 4 * 3 * 2 * 1)/(2 * 1 * 3 * 2 * 1)

Notice 3 * 2 * 1 in the denominator cancels with 3 * 2* 1 in the numerator which leaves us with

(5 * 4)/(2 * 1).  The 2 in the denominator divides into the 4 in the numerator twice to leave us with

(5 * 2) = 10