How many unique ways can you arrange a set of items?

Counting Permutations

Dylan | Jul 22, 2019

Post Thumbnail

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:

{Bob, Jane, Sally, Joe}

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:

{Joe, Jane, Sally, Bob}

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

Finding the Number of Possible Permutations

Possible Permutations = n*(n-1)*(n-2)*...*(n-(n-1))

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.

Pn,k = n!/(n-k)!; n = size of set, k = size of subset picked out

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

8!/(8-6)! = 8!/2! = (8x7x6x5x4x3x)(2x1)/(2x1) = 20,160


I hope this brief introduction to permutations and the factorial function has been insightful! As always, if anything was left unclear or you have any remaining questions please ask in the comments below and I’ll try my best to provide a helpful response! Thanks for reading and happy permuting.