Download permutations and combinations

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Fisher–Yates shuffle wikipedia , lookup

Transcript
MAS113 Introduction to Probability and Statistics –
Supplementary Notes
Counting
Firstly, recap that for a positive integer n,
n! := n × (n − 1) × (n − 2) × . . . 2 × 1.
Here n! is read as n factorial. The simple observation that n! = n × (n − 1)!
is very useful. To be consistent with this, when n = 1, we define 0! := 1.
The multiplication principle
Multiplication plays a fundamental role in counting problems. If an operation
consists of several different stages, and each stage can be performed in a
number of different ways, then the number of ways in which the overall
operation can be performed is the product of these numbers.
Case A: with repetition, order matters
If we make r successive choices from a set of n elements, allowing repetition
but with order mattering, the number of outcomes is nr . To see this, choose
the r elements from n one at a time. The first may be chosen in n ways; the
second may be chosen in n ways, and so on, the number of choices at each
of the r stages always being n. By the multiplication principle, the total
number of possible ways of making the overall choice is
n × n × . . . n = nr .
Example. The number of outcomes HHHHHH, HHHHHT, . . . , TTTTTT
when a coin is tossed six times is 26 = 64.
Example. The number of outcomes (6, 6, 6), (6, 6, 5),... (1, 1, 1) when a die
is rolled three times is 63 = 216.
1
Case B: no repetition, order matters (Permutations)
If we make r successive choices from a set of n elements, not allowing repetition and with order mattering, the number of outcomes is
n(n − 1)(n − 2)...(n − r + 1) =
n!
.
(n − r)!
This number is called n Pr , the P referring to the fact that choices of this kind
are called permutations of r elements from n. In particular, taking r = n,
the number of ways of putting n objects in order is n!.
Case C: no repetition, order doesn’t matter (Combinations)
If we make r successive choices from a set of n elements, not allowing rep-
etition and with order not mattering, the number of outcomes is called nr
or n Cr , the C referring to the fact that choices of this kind are called combinations of r elements from n. For every combination, there must be r!
permutations, as the r elements within each choice can be arranged in r!
ways. Therefore
n
n
Pr =
× r!
r
and thus
n
n!
.
=
r
r!(n − r)!
Example. The number of ways of choosing 5 playing cards from a pack of
52 cards is
52!
52.51.50.49.48
52
C5 =
=
= 52.51.5.49.4 = 2598960.
47! × 5!
5.4.3.2.1
This example
illustrates the cancellations that occur in calculations of the
numbers nr . We can always write
n
n(n − 1) . . . (n − r + 1)
=
r!
r
2
by cancelling the factors of (n − r)! top and bottom. In particular,
n
n(n − 1)
,
=
2
2
n
n(n − 1)(n − 2)
=
3
6
and so on.
3