Permutations

Table of Contents

 What is a permutation

A permutation is a sequence of ordered, unique items. For example, the books in a library are arranged in one particular permutation. If you take several books from a shelf and do not return them in their original places, you have just created another permutation of the books. Permutations are used to calculate the total number of possible sequences of n items.

The most basic permutation is a sequence of n ordered items. In this case all of the items are used in the sequence. Later we will discuss r-permutations where only r of the n items are used in a particular sequence. The following example explains how such a permutation is calculated.

Basic permutation example:

Assume that you have 4 marbles. The marbles are colored red, green, blue and yellow. We will use the letters R, G, B, and Y to represent them. How many possible permutations of marbles are there?

First let's try to answer this question intuitively by making several permutations of the marbles. If we take the marbles as given, we already have one permutation:
RGBY

Then, if we switch the last two items, we have another permutation.
RGBY
RGYB

These two permutations both start with a red and a green marble. Now let's look at all of the permutations that start with a red marble. Notice that for every color that follows red (the colors in the second column), there are only 2 possible permutations. Since there are three other colors that can follow red, there must be 3 x 2 or 6 total permutations that begin with red. They are listed in the following table.
RGBY
RGYB
RBGY
RBYG
RYGB
RYBG

From here, you can easily see that if there are 6 possible permutations for red, there must be 6 times the number of all colors or 6 x 4 total permutations.
1234 12
RGBY RG
RGYB
RBGYB
RBYG
RYGBY
RYBG
GRBYGR
GRYB
GBRYB
GBYR
GYRBY
GYBR
BRGYBR
BRYG
BGRYG
BGYR
BYRGY
BYGR
YRGBYR
YRBG
YGRBG
YGBR
YBRGB
YBGR

If we look at the table above, we can see that there is a very nice method of calculating the total number of permutations for 4 unique marbles. If we look at the first column, we can see that a sequence can begin with any one of the 4 available marbles. After we select one of the marbles to be first, we are left with 3 marbles to choose from in the second column. For every one of those marbles, there are 2 left to choose from and one remaining for the last colunm. This means that for 4 marbles there are 4 x 3 x 2 x 1 or 24 possible permutations. This can also be expressed by the factorial 4!, which is also 24. We can generalize this way of calculating permutation for n number of items to:

Total number of permutations of n items = n!

Back to Table of Contents

 r-permutations

Another kind of permutation is an r-permutation. An r-permutation or n items is an ordered sequence that contains r of the n unique items. In this case, not all of the items are used in every sequence. The r-permutation is defined by the function P(n,r) where n is the number of unique items and r is the length of the sequence. The following example explains how such a permutation is calculated.

r-permutation example:

Assume that we have 7 marbles, red , green , blue , cyan , magenta, yellow and white. Find all ordered sequences of 3 marbles?

This means that we are looking for P(7,3) since we have 7 items (marbles) and we need sequences of length 3. Let's first find the basic permutation of the marbles. Since n=7, it is 7!. How can we use this to find the r-permutation of the marbles? It is simple. Look at the chart below.
Marbles 
  
   
    
     
      
       
Position1st2nd3rd4th5th6th7th

If this is the basic permutation, where we select all n items, the r-permutation for r = 3 would look like this:
Marbles 
  
   
    X
    X X
    X X X
    X X X X
Position1st2nd3rd4th5th6th7th

As you can see the last 4 columns have been removed from the table. This means that all sequences that begin with 3 specific marbles now have only one permutation instead of 4 x 3 x 2 x 1 or 4! permutations. Therefore, if we simply divide the total number of permutations, which it 7!, by the number of permutations that begin with 3 specific marbles, which is 4!, we would remove all of the permutations that are not needed. We can again generalize this method for a sequence of n items of length r. Since we removed 4, or (n-r) columns from the table, the r-permutation P(n,r) for any n and r when r<n is:

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

Back to Table of Contents

 Permutation with some identical objects

A permutation with some identical objects is an basic permutation where k groups of nk object are interchangeable. This means that the same sequence can be generated by selecting any one of the nk objects. A permutation where all of the objects are identical is called a combination. The following example explains how such a permutation is calculated.

Example of a basic permutation with some identical objects:

Assume that we have 3 red marbles, 2 green marbles and a blue marble. How many sequences of n marbles are possible?

Since every permutation must contain all of the marbles, we will use one of the permutations to find all equivalent permutations that have the identical objects interchanged. Then we will remove the duplicated and we will be left with all of the possible permutations. Since there are 3 red marbles, there are 3! or 6 ways to arrange the red marbles. There are also 2 ways of arranging the green marbles. The table below lists all possible ways that the same permutation can be generated:
R1R2R3G1G2B
R1R2R3G2G1B
R1R3R2G1G2B
R1R3R2G2G1B
R2R1R3G1G2B
R2R1R3G2G1B
R2R3R1G1G2B
R2R3R1G2G1B
R3R1R2G1G2B
R3R1R2G2G1B
R3R2R1G1G2B
R3R2R1G2G1B

In order to remove all of the duplicate permutations, we simply have to divide the total number of permutations by the number of identical permutations. The number of identical permutations can be found by multiplying the number of permutations for each of the k groups together. In this example that is 3! x 2! or 12. Then we divide the total number of permutations, which is 6!, by this number. The final answer is 6!/(3! x 2!) or 60. The generalization of this idea for n objects and k groups is:

Basic permutation with some identical objects = n!/(n1! x n2! ... nk!)

Back to Table of Contents

 Question

How many ways can you stack 3 different sets of plates? The first set has 4 plates, the second set has 9 plates and the third set has 5 plates.

Back to Table of Contents


Boian Berberov, CSCE235, Homework 8