Permcomb
Permcomb
Permcomb
S. VISWANATH
2. Permutations
Given a set S of objects, a permutation of S is a way of arranging these
objects in a line. If S has n elements, a permutation can be formally defined
as a function f : {1, 2, · · · , n} → S such that f is injective (i.e., one-to-one).
Problem 3. (a) Convince yourself that this formal definition is the same as
the more intuitive notion of a permutation as an arrangement. (b) Suppose
A, B are finite sets with the same number of elements. Prove that a function
f : A → B is one-to-one if and only if it is onto. In other words, f is injective
if and only if f is bijective.
The number of permutations of n distinct objects is n(n−1)(n−2) · · · (2)(1).
This is defined to be the factorial of n and denoted n!. It is often convenient
to take the n distinct objects to simply be the numbers 1, 2, · · · , n. More
generally, if r is a number with 0 ≤ r ≤ n, then a permutation of n distinct
objects taken r at a time is an arrangement of any r out of the n objects in
a line.
Problem 4. Check that this is the same thing as a function f : {1, 2, · · · , r} →
S which is injective.
n!
The number of permutations of n objects taken r at a time is (n−r)! , and
is denoted nPr .
Example 3. Find the number of ways of placing 8 rooks on a chessboard
such that no two of the rooks can attack each other.
A chessboard is an 8 × 8 grid of squares, and a rook (or elephant) can
move horizontally or vertically on the board to attack other pieces. So, we
need to find the number of ways of choosing 8 squares on the chessboard
such that there is exactly one square in each row and exactly one square
in each column. Suppose we have one such configuration. We can encode
this in the following table, where we have noted down the coordinates (row,
column) of each rook.
Row 1 2 3 4 5 6 7 8
Col c1 c2 c3 c4 c5 c6 c7 c8
Now observe that c1 , c2 , · · · , c8 form a permutation of 1, 2, · · · , 8. Conversely
given such ci ’s, we obtain a non-attacking rook configuration. Thus, the
number of required configurations is equal to the number of permutations
of 8, which is 8!.
Problem 5. More generally, let k be an integer between 0 and 8. Find the
number of non-attacking configurations of k rooks on the chessboard.
Problem 6. In the previous problem, we are assuming that the rooks are
all identical. Redo the above problem under the assumption that the k rooks
are of k different colours (i.e., distinguishable).
3
3. Combinations
The number of ways of choosing r objects from n distinct objects is de-
noted n Cr . We have the formula:
n n!
Cr = .
r!( (n − r)!
Example 4. Let r be a positive integer. Show that the product of r con-
secutive natural numbers is always divisible by r!.
Let us denote the r consecutive numbers (in descending order) as n, n −
1, n − 2, · · · , n − r + 1. Then their product n(n − 1) · · · (n − r + 1) is exactly
nP
r
n!/(n − r)!, which is just nPr . So, we need to show that is an integer.
r!
n!
But observe that this is just r! (n−r)! = n Cr , which is clearly an integer.
Example 5. Consider all words (meaningful or not) that use only the letters
a, b. Find the number of such words of length n which have r occurrences
of a and (n − r) occurrences of b.
Any such word is specified uniquely once we know the positions in which
the letter a occurs. Thus, we need to pick r positions from the total available
n positions. The number of possibilities is thus n Cr .
The previous example gives a visual proof of the binomial theorem. Let
us consider two variables a, b and fully expand the product (a + b)n = (a +
b)(a + b) · · · (a + b). While expanding, let us avoid using the commutativity
property, i.e., we don’t allow ourselves to replace ab by ba. If we do this for
small values of n, say n = 2, 3, we get:
(a + b)(a + b) = aa + (ab + ba) + bb.
(a + b)(a + b)(a + b) = aaa + (aab + aba + baa) + (abb + bab + bba) + bbb.
For general n, the corresponding right hand side will be a sum of all words
of length n in a, b. Now, allowing ourselves commutativity of a, b again, we
observe that the term ar bn−r will occur in the expansion as many times as
there are words of length n in a, b which contain r occurrences of a (and
n − r occurrences of b). By the preceding example, this is just n Cr . We thus
obtain the binomial theorem:
Xn
n n
(a + b) = Cr ar bn−r .
r=0