Sie sind auf Seite 1von 8

Permutations and Combinations By the end of this Lecture you should

Suggested Reading for this lecture: Discrete


be able to
Mathematics and its Applications §4.3, 4.4 • The the definitions of n Pr and n Cr to calculate
Module Website: quantities.
http://www.cs.nott.ac.uk/∼lad/MC2 • Calculate coefficients in the binomial
NB. I only rarely answer queries sent by email. expansion.
Please use the module noticeboard.
• Calculate n Cr without using factorials and
Weekly tutorial groups appear on the website implement a recursive algorithm to to this for
where you can change your tutorial time. you.

Permutations
Don’t Panic A permutation of a set of distinct objects is an
I show a number of proofs in this lecture in order ordered arrangement of these objects. We also
to explain why certain formulae are used. You will are interested in ordered arrangements of some
not need to know these proofs in the exam – only
how to apply the formulae correctly. of the elements of a set. An ordered arrangement
of r elements of a set is called an r-permutation.
L EARN THIS DEFINITION
n Pr
Example Theorem 1 The number of r-permutations of set
Let S = {1, 2, 3}. The arrangement 3, 1, 2 is a with n distinct elements is
permutation of S. The arrangement 3, 2 is a
2-permutation of S. n Pr = n(n − 1)(n − 2) · · · (n − r + 1)
L EARN THIS THEOREM

Proof
• The first element of the permutation can be
chosen in n ways.
Using Factorials
• There are n − 1 ways to choose the second
n!
element ... and so on. n Pr =
(n − r)!
• There are n − (r − 1) = n − r + 1 ways to In particular, note that n Pn = n!.
choose the rth element.
• There are n(n − 1)(n − 2) · · · (n − r + 1)
(product rule) r-permutations of the set.
Example
How many ways are there to select a first-prize Example
winner, a second-prize winner, and a third prize
Suppose that a saleswoman has to visit eight
winner from 100 different people who have
different cities. She must begin her trip in a
entered a contest?
specified city, but she can visit the other seven
Solution: cities in any order she wishes. How many
• The order in which people are selected possible orders can the saleswoman use when
matters so we want a 3-permutation. visiting these cities?

• 100 P3 = 100.99.98 = 970, 200

Solution:
• The number of possible paths is the number of
Example
permutations of seven elements. How many permutations are there of the letters
• 7! = 7.6.5.4.3.2.1 = 5040. ABCDEFGH contain the string ABC?
Solution: Because the letters ABC must occur as
• If we wanted the route with the minimum a block, we can find the answer by finding the
distance (the travelling salesman problem) we number of permutations of six objects, namely
the block ABC and the individual letters D, E, F, G
must consider a total of 5040 paths. and H. Because these six objects can occur in
any order, there are 6! = 720 permutations of the
• The travelling salesman problem has many
letters, ABCDEFGH in which ABC occurs as a
applications such as designing printed circuit block.
boards and aeroplane route scheduling.
Example
Combinations
Let S be the set {1, 2, 3, 4}. Then {1, 3, 4} is a
An r-combination of elements of a set is an
unordered selection of r elements from the set. 3-combination from S. The 3-combination
Thus, an r-combination is simply a subset of the {1, 3, 4} is identical to the 3-combination {4, 1, 3}
set with r elements. even though the 3-permutations 134 and 413 are
different.

n Cr Proof
The number of r-combinations of a set with n The r-permutations of the set can be obtained by
distinct elements is denoted by n Cr . forming the n Cr r-combinations of the set, and
Theorem 2 The number of r-combinations of a then ordering their elements (n Pr ways).
set with n elements, where n is a nonnegative = n C r . r Pr
n Pr
integer and r is an integer with 0 ≤ r ≤ n, equals
So
n! n!
n Cr = n Pr (n−r)! n!
r!(n − r)! n Cr = = r!
=
r Pr (r−r)!
r!(n − r)!
L EARN THIS FORMULA
Example
How many ways are there to select five players
Corollary
from a 10-member tennis team to make a trip to Theorem 3 Let n and r be nonnegative integers
a match at another school? with r ≤ n. Then n Cr = n Cn−r .
Solution: The answer is given by the number of Proof:
5-combinations of a set with ten elements. n! n!
n Cn−r = = = n Cr
10! (n − r)!(n − (n − r))! r!(n − r)!
C
10 5 = = 252
5!5!

Calculating nCr
Example
• It is difficult to calculate large factorials
There are 30 people trained as astronauts to go
accurately (see how far you can get with your
on the first mission to Mars. How many ways are
calculator).
there to select a crew of six people to go on this
• In practice to calculate n Cr we perform mission?
canceling before multiplication.
Solution: 30 C6 because the order in which these
Example
people are chosen does not matter.
How many ways are there to select a committee
30!
30 C6 = to develop a discrete mathematics course if the
6!24!
30.29.28.27.26.25.24! committee is to consist of three lecturers from the
=
6!24! mathematics department (9 lecturers) and four
30.29.28.27.26.25 from the computer science department (11
=
6.5.4.3.2.1
= 593, 775 lecturers)?

The Binomial Theorem: Some


Terminology
Solution: Using product rule and combinations:
Binomial Expression A sum of two terms: x + y.
9! 11!
9 C3 .11 C4 = . Expansion x2 + 2xy + y 2 is the expansion of
3!6! 4!7!
9.8.7 11.10.9.8 (x + y)2 .
= . = 84.330 = 27, 720
3.2.1 4.3.2.1 Binomial Coefficient The numbers beside each
expression of xs and y in the expansion (eg. 1
2 and 1) are the coefficients for (x + y)2 .
The Binomial Theorem Proof
Theorem 4 Let x and y be variables, and let n be • The terms in the product when it is expanded
a nonnegative integer. Then are xn−j y j for j = 0, 1, 2, . . . , n.
X
n
• To get a term xn−j y j you must chose n − j xs
n n−j j
(x + y) = n Cj x y
j=0 from (x + y)(x + y) . . . (x + y) (so that the other
= n C0 x
n
+ n C1 xn−1 y + n C2 xn−2 y 2 + j terms in the product are ys).
· · · + n Cn−1 xy n−1 + n Cn y n • There are n (x + y)s so there are n Cn−j = n Cj
L EARN THIS FORMULA ways to do this.

Example
What is the expansion of (x + y)4 ?
Pascal’s Identity
Solution:
Theorem 5 Let n and k be positive integers with
X
4
(x + y)4 = 4 Cj x
4−j j
y n ≥ k. Then
j=0
4 4−1 2 2 3 4 n+1 Ck = n Ck−1 + n Ck .
= 4 C0 x + 3 C1 x y + 4 C2 x y + 4 C3 xy + 4 C4 y
= x4 + 4x3 y + 6x2 y 2 + 4xy 3 + y 4
Proof
• Let T be a set with n + 1 elements, a ∈ T and
S = T − {a}.
• There are n+1 Ck subsets of T with k elements.
So What?
Recall that we have problems calculating n! for
• A k-subset of T either contains a and k − 1 large n and so will have trouble calculating n Cr .
elements of S or k elements of S but not a. The identity allows us to define a recursive
function using only addition to calculate n Cr .
• S has n Ck−1 subsets with k − 1 elements and
n Ck subsets with k elements.

• By Sum Rule therefore n+1 Ck = n Ck−1 + n Ck .

An Algorithm Summary

procedure comb (n, r): n ≥ r • Permutations – choosing groups where the


order matters or there are different roles.
if
• Combinations – where the order doesn’t
n = r or r = 0
matter or all elements are treated the same.
then
• The Binomial Theorem – using combinations
return 1
to calculate coefficients.
else
• Pascal’s Identity – an algorithm for calculating
return comb(n − 1, r − 1) + comb(n − 1, r)
combinations.

Das könnte Ihnen auch gefallen