Search code examples
mathcomputer-sciencesymbolic-math

Looking for a good reference on calculating permutations


As a programmer, I frequently need to be able to know the how to calculate the number of permutations of a set, usually for estimation purposes.

There are a lot of different ways specify the allowable combinations, depending on the problem at hand. For example, given the set of letters A,B,C,D

  1. Assuming a 4 digit result, how many ways can those letters be arranged?

  2. What if you can have 1,2,3 or 4 digits, then how many ways?

  3. What if you are only allowed to use each letter at most once? twice?

  4. What if you must avoid the same letter appearing twice in a row, but if they are not in a row, then twice is ok?

Etc. I'm sure there are many more.

Does anyone know of a web reference or book that talks about this subject in terms that a non-mathematician can understand?

Thanks!


Solution

  • Assuming a 4 digit result, how many ways can those letters be arranged?

    when picking the 1st digital , you have 4 choices ,which is one of A, B , C and D ; it is the same when picking the 2nd, 3rd ,4th since repetition is allowed: so you have total : 4*4*4*4 = 256 choices.

    What if you can have 1,2,3 or 4 digits, then how many ways?

    It is easy to deduce from question 1.

    What if you are only allowed to use each letter at most once?

    When pick the 1st digital , you have 4 choices ,which is one of A , B , c and D ; when picking the 2nd , you have 3 choice except the one you have picked for the 1st ; and 2 choices for 3rd , 1 choices for the 4th. So you have total : 4 * 3 * 2 * 1 = 24 choice.

    The knowledge involving here include combination , permutation and probability. Here is a good tutorial to understand their difference.