Saturday, July 31, 2010

permutation and combination

1 permutation (the order does matter)


There are two types of permutation: repetition is allowed, no repititon.

1.1 with repetition

p(n, r) = n * n * n ...(r times) = nr
where it means r things are chosed from n things.

1.2 no repetition

p(n, r) = n * (n-1) * (n-2) ... (n-r+1) = n!/(n-r)!

2 combination (the order does not matter)


Two types: with repetition, no repitition

2.1 no repitition

c(n, r) = n!/r!(n-r)!

explain: all we need to do is adjust our permutations formula to reduce it by how many ways the objects could be in order (because we aren't interested in the order any more):

2.2 with repitition

c(n, r) = (r+n-1)!/r!(n-1)!

explain: Let us say there are five flavors of icecream: banana, chocolate, lemon, strawberry and vanilla. You can have three scoops. How many variations will there be? (n=5, r=3)
{c, c, c} (3 scoops of chocolate):
{b, l, v} (one each of banana, lemon and vanilla):
{b, v, v} (one of banana, two of vanilla):

So (being general here) there are r + (n-1) positions, and we want to choose r of them to have circles. This is like saying "we have r + (n-1) pool balls and want to choose r of them".


refer to mathsisfun for details.

Saturday, July 3, 2010

quit emacs in cygwin: solution to C-c C-x

problem: cannot quit emacs under cygwin.
find a refer to solutions.
1. type F10
2. type f
3. type q.