# Counting Permutations

Dylan | Jul 22, 2019

This post will answer the following questions through examples.

- What are permutations?
- Why are permutations important?
- How can we calculate the total number of permutations?
- How can we calculate the possible permutations of a subset?

### What is a Permutation?

Simply put, a permutation is a unique ordering of a set or subset of data. Imagine the following set of 4 people: Imagine the four individuals above are standing in a line. What’s another way the four people could be arranged to create a new and unique line? Perhaps Bob and Joe could switch places:

This arrangement is an example of one possible permutation (unique ordering) of the dataset.

### Finding the Number of Possible Permutations

To find the total number of possible permutations of a set, we can multiply the size of the set by every integer less than the size of the set and greater than zero.

Returning to our example with Bob, Jane, Sally, and Joe, the number of possible ways to arrange the four people is equal to 4x3x2x1, which equals 24.

There are 24 unique ways to arrange these 4 people, this little trick saves us a lot of time drawing out all of the possible ways to arrange them and counting them by hand! This is especially true when you begin to increase the number of people in the line. If we added just one more person, the possible ways you could arrange them would be 5x4x3x2x1 which is 120. We definitely wouldn’t want to solve that by drawing 120 different lines!

The name of this function is the factorial function and it is denoted by an exclamation mark (!). In our original example with 4 people, we calculated that 4! = 24 and later with 5 people that 5! = 120.

Intuitively, what’s happening when we solve 4! = 4x3x2x1, in the beginning there are 4 possible people who could fill the first spot. Once we fill the first position, there are only 3 left who can fill the second position. After filling the second position, there are only 2 options left to fill the third position. Finally, after filling every position except the last, there is only 1 person left to fill it.

### Finding Possible Permutations of a Subset

Now we know how to find the possible permutations of a line of 8 people. 8! = 8x7x6x5x4x3x2x1 = 40,320, great! Now what if we had 8 people but were curious how many ways we could arrange them in a 6-person line?We could continue with our intuitive idea from the previous section of looking at the first position in the 6-person line and recognizing that we have 8 people to choose from. After selecting a person, the second position has 7 to choose from. We can continue this until the final (6th) position in the line in which case we’ll have 3 people to choose from which finally results in 8x7x6x5x4x3 = 20,160. Although punching all of these numbers into our calculator will result in the correct answer, generally the following formula is preferred.

What you’ll find with this calculation is that the remaining unused choices, 2 and 1 in our example are canceled out.