Permutation and Combinations (CSCI 2824, Spring 2015)

This page covers the notions of permutations and combinations. These are structures that do not allow for repetitions.

Permutation

Permutation

A permutation from {1,2,ldots,n} of length r is an ordered list of length r whose elements are drawn from {1,2,ldots,n} without repetitions.

More generally, given a set A = {a_1,ldots,a_n} of n elements, a permutation of  1 leq m leq n elements is a sequence of elements a_{i_1},ldots,a_{i_m} of m distinct elements chosen from A:

  • No element can be chosen twice.

  • The order in which we choose the elements matter.

Eg., What are all the permutations of 2 elements chosen from the set {1,2,3}. Answer:

  • 1,2

  • 2,1

  • 1,3

  • 3,1

  • 2,3

  • 3,2 This gives rise to 6 permutations.

Number of permutations of length r

P(n,r) denotes the number of permutations from {1,2,ldots,n} of length r.

(Equivalent notations include P^n_r, {}_n P_r, {}^nP_r.)

What does the number P(n,r) mean?

  • n choices for the first element in the permutation.

  • n-1 choices for the second.

  • n-2 for the third.

  • cdots

  • n-r+1 choices for the r^{text{th}} element.

That gives us by product rule n * (n-1) * ... * (n-r+1) choices overall. We can write the number P(n,r) as

P(n,r)  = n * (n-1) * ... * (n-r+1) = begin{cases} frac{n!}{(n-r)!} & text{ if } rleq n,  0 & text{ otherwise}. end{cases}.

Here are the some simple examples:

P(10,3)=10times 9times 8. (3 factors, counting backwards from 10 to 9 to 8.)

P(52,5)=52times 51times 50times 49times 48. (5 factors, counting backwards from 52 to 48.)

Some more examples…

Example 1

How many 4 digit numbers can we form from the digits {1,2,3,7,9}, where we need to use each digit precisely once?

In other words we are looking for a permutation of 4 elements from a set with 5 elements. The answer is P(5,4) which is frac{5!}{(5-4)!} = 5! = 120.

Example 2

How many four digit numbers can be formed wherein (a) the digits in {1,2,3,7,9} are never used, or (b) if some digit is used it is used multiple times?

Weird problem? But can you find a connection between what is asked in Example 1 and Example 2? Often looking at the complement of a set that we need to count can be easier. :-)

Example 3

Let A,B be two sets where |A| = |B| = n. How many one-to-one correspondences can exist between A and B?

Answer: Let us write A to be {a_1,a_2...,a_n}. Let B be the set {b_1,...,b_n}.

  • Choose a permutation of all the n elements of B.

  • Once the permutation is chosen, link a_1 to the first element in the permutation, a_2 to second,…,a_n to the n^{th}.

Each one-to-one correspondence can be formed in this manner.

Therefore there are n! functions.

Question: Let us say professor X says that this is the wrong way to do this. He objects that we did not permute A. So in his technique:

  • We take each permutation of A, each permutation of B and link the corresponding elements of the permutations. Thus, he reasons that there should be (n!)^2 one-to-one correspondences.

What is the flaw in his argument?

Combinations

We will now talk about combinations. Note that in permutations the order in which we choose things matter. When doing combinations the order does not matter.

A choice or combination of r elements out of a set with n elements is one where

  1. we choose r elements (by definition, no element can be chosen twice).

  2. the order in which we choose things do not matter.

Combinations

An r-combination from {1,2,ldots,n} is a subset of {1,2,ldots,n} of size r.

C(n,r) denotes the number of distinct r-combinations from {1,2,ldots,n}.

Equivalent notations include begin{pmatrix}nrend{pmatrix}, C^n_r, {}_n C_r, {}^nC_r.

The formula for C(n,r) is

C(n,r)=frac{P(n,r)}{r!} = frac{n!}{r!(n-r)!}.

The reason behind C(n,r)=frac{P(n,r)}{r!} is that we don't care about ordering, and the r! counts the number of repeated permutations of length r with the same contents. For instance, 125 and 512 are considered the same combination even though they are different permutations; note that there are 3! permutations of the three digits 1,2,5.

Note that in general, whenever 0leq r leq n,

C(n,r) = C(n,n-r).

Here are some simple examples:

C(6,3)=frac{6times 5times 4}{1times 2times 3}.

C(14,5)=frac{14times 13times 12times 11times 10}{1times 2times 3times 4 times 5}.

Example 4

Take the set A ={1,2,3,5}. How many ways are there of choosing a subset with 2 elements?

Obviously, in a subset, we do not care if we choose {1,2} or {2,1} they are the same subset.

Let us first write down the permutations of 2 elements

  • 1,2 and 2,1

  • 1,3 and 3,1

  • 1,5 and 5,1

  • 2,3 and 3,2

  • 2,5 and 5,2

  • 3,5 and 5,3

Now notice that the number of choices in our problem is exactly half the number of permutations.

Since {1,2} is the same as {2,1}

{1,3} is the same as {3,1} and so on.

So the answer should be 6.

Example 5

How many bit strings of length 5 contains exactly two 1's (whose positions are unrestricted)?

We can represent the possible positions of the two 1's as a subset of {1,2,3,4,5} of size 2. For instance,

  • the subset {3,4} corresponds to the bit string 00110;

  • the subset {1,4} corresponds to the bit string 10010; etc.

So counting such bit strings boils down to counting the number of subsets of {1,2,3,4,5} of size 2, which is C(5,2)=10.

Example 6

From a group of 10 men and 10 women, how many ways are there to form a committee with 6 members if the committee must have the 2 men and 4 women?

Note that to get the configuration we want, it boils down to picking 2 out of 10 men and 4 out of 10 women.

  • There are C(10,2) ways to pick 2 out of 10 men.

  • There are C(10,4) ways to pick 4 out of 10 women.

Since we have to do both tasks and they can be done independently, using the product rule, the answer is

C(10,2) C(10,4).