Anda di halaman 1dari 24

Permutations

&
Combinations
• Principles of Counting
o Sum rule
o Product rule
o Principle of Inclusion-Exclusion
o Pigeon-hole principle

• Factorial notation
• Permutations
• Binomial Theorem
• Combinations
Principles of Counting.
Sum Rule
If A and B are disjoint finite sets, then:
|A ∪ B| = |A| + |B|.
In other words,
if an event A can occur in m ways and another event B,
mutually exclusive to A can occur in n ways, then A or B can
occur in m+n ways.

Similarly, for n disjoint sets, if A ,A ,…A are disjoint sets, then:


1 2 n

|A ∪ A ∪ … ∪ A |=|A |+|A |+…+|A |.


1 2 n 1 2 n
Example :
Determine the value of the variable count after
execution of the following program :
int i=1, j=1, count=0;
for( i=1; i≤5; i++)
count=count+1;
for( j=1; j≤5; j++)
count=count+1;

In the above program, both the for loops are


independent of each other( ie., they cannot be
executed simultaneously), after the execution i=5
and j=5. Therefore value of count=i+j ⇒ count=10.
Product Rule
If A and B are two sets, then:
A × B = {(a,b) | a∈A, b∈B}
In other words,
if an event A can occur in m ways and another event B,
independent of A, can occur in n ways, then the
event(A and B) can be accomplished in m×n ways.

Similarly, for n sets, if A ,A ,…A are sets, then:


1 2 n

|A × A × … × A |=|A | × |A | × … × |A |.
1 2 n 1 2 n
Example :
Determine the value of the variable count after
execution of the following program :
int i=1, j=1, count=0;
for( i=1; i≤5; i++)
for( j=1; j≤5; j++)
count=count+1;

In the above program, the inner for loop is dependent


on the outer for loop(ie., they are executed
simultaneously), after the execution i=5 and j=5.
Therefore value of count=i×j ⇒ count=25.
Principle of Inclusion-Exclusion
Let A and B be two sets, not necessarily disjoint, then
|A ∪ B|=|A|+|B|-|A∩B|
Similarly, if there exist three sets A,B,C, not necessarily disjoint, then
|A ∪ B ∪ C |=|A|+|B|+|C|-|A∩B|-|A∩C|-|B∩C|+|A∩B∩C|

Example :
A Computer laboratory of 50 computers has 20 computers working
on MS windows operating system and 45 computers working on
Linux operating system. Compute how many computers work on
both windows and linux operating system.
A=20, B=45, A∪B=50
50=20+45-|A∩B|
Therefore, 15 computers work on both operating systems.
Pigeon-hole principle
If k+1 or more pigeons are distributed among k
pigeonholes, then at least one pigeonhole contains
two or more pigeons.
Example :
51 points are scattered inside a square of side 1m.
Prove that some set of 3 of these points will be
covered by a square of side 20cm.
Divide the square into 25 smaller squares of side 20cm
each. Now if we distribute the 51 points among 25
squares, we shall definitely end-up with one square
having atleast 3 points in it.
Factorial Notation
The factorial of a natural number n is the product of
the positive integers less than or equal to n. This is
represented as n! and read as ‘n factorial’.

For example,
4! = 4×3×2×1 = 24.
Lemma : The factorial of zero is one.
0! = 1.
Permutations

• Simple permutations
• Permutations with repetitions
• Circular permutations
Simple Permutations
A PERMUTATION of a finite set is an arrangement of its
elements. Here the arrangement considers the order of
elements.
If there are n distinct objects, denoted a1,a2 ,…, an, and r is an
integer, with 0≤ r ≤ n, then by the rule of product, the number
of permutations of size r for the n objects, nPr =
n×(n-1)×(n-2)×…×(n-r+1)
= n!
(n-r)!
nPr is also denoted as P(n,r)

For r = 0, P(n,0) = 1 = n!/(n-0)!


For r = n, P(n,n) = n! = n!/(n-n)!
Simple Permutations
Example :
Consider a main memory with four frames of fixed
size, 10KB each.
(d) If four processes of 10KB, 6KB, 8KB and 9KB
enter, in how many ways can they be allocated
memory.
(b) If two process of 8KB and 9KB enter, in how many
ways can they be allocated memory.
(a) Four processes and four frames, hence r = n, n = 4,
P(n,n) = P(4,4) = 4!
(b) Two process and four frames, hence r = 2, n = 4,
P(n,r) = P(4,2) = 4!/(4-2)! = 4!/2! = 4×3 = 12
Simple Permutations
with repetitions
If there are n objects with n1 of first type, n2 of a second
type,……,and nr of an rth type, where n1+n2+…+ nr=
n, then there are
n!
( n1! n2!…nr! )
Example :
Consider a main memory with six fixed size frames of
10KB each. If three processes, A with 2pages, B
with 1page and C with 3pages enter, in how may
ways can they be allocated memory.
6!
2! 1! 3!
Circular Permutations
The number of ways to arrange n objects along a fixed circle is
(n-1)!
The number is (n-1)! instead of the usual n! since all cyclic
permutations are equivalent because the circle can be rotated.

Considering the above diagram, all the arrangements are similar


is we traverse the circle in clockwise direction starting from
A. Hence the number of circular permutations of the A,B,C,D
& E along a circle is (5-1)! = 4!
Circular Permutations
If clockwise and anti-clockwise orders are taken as not different,
then the total number of circular permutations is given by
(n-1)!
2!

Example :
Compute permutations of the following graph.

The above graph can be traversed in either clockwise or anti-


clockwise ways. Hence the number of its circular
permutations is (6-1)!
2!
Binomial Theorem

If a and b are variables and n is a positive integer, then

where,
Combinations

• Simple combinations
• Combinations with repetitions
Simple Combinations
An arrangement of r objects, WITHOUT regard to ORDER and
without repetition, selected from n distinct objects is called a
combination of n objects taken r at a time.
It is denoted as :

n
nCr = C(n, r) =
r = n! = nPr
(n-r)! r! r!

That is, the number of permutations of size 2 of A,B,C is 3P2 = 6


(AB,AC,BA,BC,CA,CB), while the number of combinations of
size 2 of A,B,C without repetitions is 3C2 = 3 (AB,BC,AC)
Simple Combinations
Example :
Consider certain arrangements, in which strings of length 10 are
made from the three integers 0, 1 & 2. If x = x1x2…x10 is one of
the strings, we define the weight of x, wt(x), as wt(x) =
x1+x2+…+ x10. For example, wt(1101111011) = 8. Now
determine how many such strings of even weight can be
formed.

The string is of length 10 and each of the 10 locations can be


filled by one of the three integers 0, 1 & 2, this implies that
every location in the string has 3 options. Hence there can be
310 such strings.
For this, there are the following six different cases to consider :
Simple Combinations
(ii) If the string contains no 1’s, then each of the 10 locations of
the string can be filled with either 0 or 2, then the number of
such strings possible are - 10C0 210
(iii) If the string contains two 1’s, then each of the remaining 8
locations of the string can be filled with either 0 or 2, then
the number of such strings possible are - 10C2 28
(iv) If the string contains four 1’s, then each of the remaining 6
locations of the string can be filled with either 0 or 2, then
the number of such strings possible are - 10C4 26
(v) If the string contains six 1’s, then each of the remaining 4
locations of the string can be filled with either 0 or 2, then
the number of such strings possible are - 10C6 24
Simple Combinations
(ii) If the string contains eight 1’s, then each of the remaining 2
locations of the string can be filled with either 0 or 2, then
the number of such strings possible are - 10C8 22
(iii) If the string contains ten 1’s, then no 0 or 2 can be
accommodated in the string, then the number of such strings
possible are - 10C10 20

Hence the total number of such string of length 10 of even


weight are 10C0 210+ 10C2 28+ 10C4 26 +10C6 24 +10C8 22 +10C10 20
Combinations with repetitions
The number of combinations of n objects taken r at a time, with
repetition, is
Cr = (n + r – 1)!
n+r-1

r! (n-1)!

Example :
A message is made up of 12 different symbols and is to be
transmitted through a communication channel. In addition to
the 12 symbols, the transmitter will also send a total of 45
blank spaces, with at least three spaces between each pair of
consecutive symbols. In how may ways can the transmitter
send such a message ?
Combinations with repetitions
The 12 different symbols can be arranged in 12! ways.
Now there are 11 locations between the 12 symbols and each
location must have at least three blank spaces, hence 33 of
the 45 blank spaces are used and the remaining 12 must be
located.
This is now a selection, with repetition, of size 12(blank spaces)
from a collection of size 11(locations), and can be
accomplished in
11+12-1C12 = 22C12 ways.

Therefore, the number of ways by which the transmitter can send


such a message is
12! × 22C12
References
3) Discrete and Combinatorial Mathematics – Ralph P. Grimaldi
4) Introduction to Probability & Statistics – Schaum series
5) http://ocw.mit.edu/OcwWeb/Electrical-Engineering-and-Computer-
Science/6-042JMathematics-for-Computer-
ScienceFall2002/CourseHome/index.htm
6) http://www.themathpage.com/aPreCalc/permutations-combinations.htm
7) http://mathforum.org/dr.math/faq/faq.comb.perm.html
8) http://www.andrews.edu/~calkins/math/webtexts/prod02.htm