Home

Awesome

Learning combinations vs permutations License: MIT

Just one of the things I'm learning. https://github.com/hchiam/learning

A reference: https://www.mathsisfun.com/combinatorics/combinations-permutations.html

Combinations are different from permutations. But did you know that there are actually different kinds of combinations and different kinds of permutations?

Number of: (n = options, r = choose)

  1. permutations with repeats allowed: n^r
  2. permutations without repeats (if r == n): n!
  3. permutations without repeats (if r != n): n! / (n-r)!
    • intuition: example: 5 pick 2 = 5*4, not 5*4*3*2*1
    • intuition: you're picking the first 2, hence 5*4
    • intuition: n! / (n-r)! is just a fancy math way of getting that 5*4
    • intuition: divide by (unwanteds) = (n-r)! = 3*2*1 in the example
  4. (combinations = permutations but order doesn't matter)
  5. combinations without repeats: n! / (n-r)! / r!
    • intuition: (permutations) / (ways to order r)
    • intuition: (permutations) = n! / (n-r)!
    • intuition: (ways to order r) = r!
  6. combinations with repeats allowed: (n-1 + r)! / (n-1)! / r!

To-do:

Understand why there's -1s in the equation for combinations with repeats allowed.

The rest of that last equation makes sense:

So why the -1 on the top and bottom?