Download Weeks 9 and 10 - Shadows Government

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

Georg Cantor's first set theory article wikipedia , lookup

Addition wikipedia , lookup

Foundations of mathematics wikipedia , lookup

Infinity wikipedia , lookup

History of the function concept wikipedia , lookup

Wiles's proof of Fermat's Last Theorem wikipedia , lookup

Mathematical proof wikipedia , lookup

Fundamental theorem of calculus wikipedia , lookup

Theorem wikipedia , lookup

Non-standard calculus wikipedia , lookup

Fundamental theorem of algebra wikipedia , lookup

Elementary mathematics wikipedia , lookup

Order theory wikipedia , lookup

Naive set theory wikipedia , lookup

Proofs of Fermat's little theorem wikipedia , lookup

Transcript
Weeks 9 and 10
Techniques of Counting (Combinatorics)
Counting the cardinality of finite sets
Definition 1. Let A be a set. We say that A is a finite set if either A is empty or A has
a finite number of elements. We say that A is an infinite set if A is not finite. When A
is finite, the number of its elements, denoted by |A|, is called the cardinality of A.
For example, |{a, b, c, d}| = 4, || = 0,  = {0, 1, 2, …} is infinite.
For any nonempty set X, X is finite with |X| = n if and only if X can be written
X = {a1, a2, …, an}; X is infinite if and only if there is a subset B  X such that
B = { a0, a1, a2, …, an, …}.
Definition 2. Let A and B be two nonempty sets and f : A  B be a function. We say
that f is one-to-one (an injection) if a  b implies f(a)  f(b) for any a, b  A; f is
onto (a surjection) if for every b  B there is an a  A such that f(a) = b (i.e. every
element of B is an image of f); f is a bijection if it is one-to-one and onto.
For example, the function f :    given by f(n) = 2n + 1 is one-to-one but not onto
since even numbers are not images of f. Thus f is not a bijection. The function
g : {a, b, c}  {1, 2} given by g(a) = 2, g(b) = 1, g(c) = 2 is onto but not one-to-one
since a  b but g(a) = g(b). Thus g is not a bijection. Let B = {1, 3, 5, …}, the set of
odd natural numbers. Then the function f :   B given by f(n) = 2n + 1 is a bijection.
Let Nn be the set {1, 2, 3, … , n}.
Theorem 1. For any nonempty set X, X is finite with |X| = n if and only if there is a
bijection f : Nn  X, X is infinite if and only if there is a one-to-one function
f :   X.
Proof. X is finite with |X| = n if and only if we can write X = {a1, a2, …, an}. In this
case, the function f : Nn  X defined by f(k) = ak for k  Nn is obviously a bijection.
X is an infinite set if and only if we can choose a subset B = {a0, a1, a2, …, an, …}  X.
In this case, the function f :   X defined by f(n) = an for all n   is one-to-one.
Example 1. Illustrate the cardinality of the set V of vowels in the alphabet by finding a
bijection.
Solution. For V = {a, e, i, o, u} we have |V| = 5 and a bijection f: N5  V is given by
f(1) = a, f(2) = e, f(3) = i, f(4) = o and f(5) = u.
42
Example 2. Show that the set A of even natural numbers is infinite.
Proof. We define a function g:   A by g(r) = 2r for all r  . Then g is a one-toone function. By theorem 1, A is infinite.
Principles of counting
Theorem 2 (Addition principle). Let A and B be two finite disjoint (A  B = Ø)
sets. Then
|A  B| = |A| + |B|.
Proof. If A = Ø then |A  B| = |B| = 0 + |B| = |A| + |B|. If B = Ø then
|A  B| = |A| = |A| + 0 = |A| + |B|. Assume that A and B are non-empty. As they are
finite, we have |A| = n and |B| = m for some positive integers n and m so we can write
A = {a1, a2, …, an} and B = {b1, b2, …, bm}
As A and B are disjoint it follows that A  B = {a1, a2, …, an, b1, b2, …, bm}.
Therefore |A  B| = n + m = |A| + |B|.
Corollary (Generalised addition principle). If A1, A2, …, An are n finite disjoint sets
then
| A1  A2  …  An| = |A1| + |A2| + … + |An|.
(See exercises Q2).
The pigeonhole principle given below follows from this result.
Theorem 3 (The Pigeonhole principle).
If m objects are placed into n boxes, where m > nr for some positive integer r, then
at least one box contains at least r + 1 objects.
Proof. Let A1, A2, …, An be the sets of objects contained in the n boxes. Since there
are altogether m objects and the n sets are disjoint, by the above corollary, we have
m = | A1  A2  …  An| = |A1| + |A2| + … + |An|.
If |Ak|  r for all k  {1, 2, …, n}, then m  nr, a contradiction to the condition
m > nr. Thus we must have |Ak| > r for some k, i.e. at least one box has more than r
objects.
Example 3. Show that in any group of six people there are either 3 mutual friends or 3
mutual strangers. (By mutual friends we just mean a group of people who all know each
other.)
43
Proof. Let a, b, c, d, e, f be the six people. Distribute b, c, d, e, f between two boxes,
the first to contain those who are friends of a and the second those who do not know a.
Since the number of people to be distributed is 5 > 2 x number of boxes (= 2 x 2), by
the pigeonhole principle one box must contain at least 2 + 1 = 3 people.
Suppose the friends box contains b, c and d (and possibly others). If any two of {b, c,
d} know each other, say b and c then {a, b, c} forms a set of mutual friends. But if
none of {b, c, d} know each other then they form a set of mutual strangers. If it is the
strangers box which contains at least three people, say b, c and d (and possibly others),
and if any two of {b, c, d} do not know each other, say b and c, then a, b, and c are
mutual strangers. Otherwise, b, c and d are mutual friends.
Example 4. Show that if any 10 points are chosen within an equilateral triangle of side
length one then there are two of them whose distance apart is at most 1/3.
Solution. Divide the triangle into 9 equilateral triangles each of side length 1/3 and apply
pigeonhole principle.
Since 10 > 1  9, there is one small triangle containing at least 2 points, the distance of
these two pints is at most 1/3.
Theorem 4 (Modified Addition Principle).
For any two finite sets A and B we have
|A  B| = |A| + |B|  |A  B|.
Proof. Consider sets A and B (not necessarily disjoint). Let
A – B = X, B – A = Z and A ∩ B = Y .
Then A  B = X  Y  Z and X  Y = , Y  Z = , X  Z = . So by the addition
principle |A  B| = |X| + |Y| + |Z|. Now Y  X = A implies |A| = |X| + |Y| by the
addition principle, and Y  Z = B implies |B| = |Y| + |Z| by the addition principle.
Therefore we have
|A  B| = |X| + |Y| + |Z|
= (|X| + |Y|) + (|Y| + |Z|)  |Y|
= |A| + |B|  | A  B |.
Example 5 (Addition principle for tree sets) Show that
|A  B  C| = |A| + |B| + |C|  |A  B|  |B  C|  |A  C| + |A  B  C| .
44
Proof. We have |A  B  C| = |(A  B)  C| and, using the modified addition
principle repeatedly, we have,
|A  B  C|
= |A  B| + |C|  |(A  B)  C|
= |A| + |B|  |A  B| + |C|  |(A  C)  (B  C)|
= |A| + |B| + |C|  |A  B|  |A  C|  |B  C| + |(A  C)  (B  C)|
= |A| + |B| + |C|  |A  B|  |A  C|  |B  C| + |(A  B  C)|.
Recall that a product set is defined by A  B = {(a, b) : aAbB}. For any
(a, b), (c, d)  A  B, (a, b) = (c, d) if and only if a = c and b = d. In general,
(a, b)  (b, a) unless a = b, and A  B  B  A unless A = B .
Theorem 5 (Multiplication principle).
For any two finite sets A and B we have
|A  B| = |A|  |B|.
Proof. If either A or B is empty then the equality obviously holds. Assume that both A
and B are nonempty. Since they are finite with |A| = n and |B| = m for some positive
integers n and m, we may write
A = {a1, a2, …, an} and B = {b1, b2, …, bm}
Let Bai be the subset of A  B containing all pairs which start with ai, i = 1, 2, … , n .
Then
Bai = {( ai, b1), (ai, b2), …, (ai, bm)},
A  B = Ba1  Ba2  …  Ban and Bai  Baj =  , i j.
By the generalised addition principle,
|A  B| = |Ba1  Ba2  …  Ban| = |Ba1| + |Ba2| + … + |Ban| .
Now |Bai| = |B| = m for all i = 1, 2, … , n. Hence |A  B| = n  m = |A|  |B|.
Corollary (Generalised multiplication plrinciple).
For any positive integer n and finite sets A1, A2, …, An, we have
|A1  A2  …  An| = | A1|  | A2|  …  | An|.
45
(Exercise Q8)
Note. We can apply similar reasoning to a subset S of A  B. Let
A = {a1, a2, …, an} and B = {b1, b2, …, bm},
Bai(S) = {(ai , bj) : bjB, (ai , bj) S
Abj(S) = {(ai , bj) : aiA, (ai , bj) S
m
n
Then |S| =
B
i 1
ai
(S ) =
A
j 1
bj
(S )
(Total of rows = Total of columns).
To illustrate this, we consider the sets A = {u, v, w, r}, B = {1, 2, 3, 4, 5} and
S = {(u, 2), (v, 1), (v, 4), (w, 1), (w, 2), (w, 5), (r, 2), (r, 3), (r, 4)}. The set A  B is given
by the following table:
AxB
u
v
w
r
1
(u, 1)
(v, 1)
(w, 1)
(r, 1)
2
(u, 2)
(v, 2)
(w, 2)
(r, 2)
3
(u, 3)
(v, 3)
(w, 3)
(r, 3)
4
(u, 4)
(v, 4)
(w, 4)
(r, 4)
5
(u, 5)
(v, 5)
(w, 5)
(r, 5)
Then Bu(S) = {(u, 2)}, Bv(S) = {(v, 1), (v, 4)}, Bw(S) = {(w, 1), (w, 2), (w, 5)},
Br(S) = {(r, 2), (r, 3), (r, 4)}, A1(S) = {(v, 1), (w, 1)}, A2(S) = {(u, 2), (w, 2), (r, 2)},
A3(S) = {(r, 3)}, A4(S) = {(v, 4), (r, 4)}, A5(S) = {(w, 5)}. Thus,
|S| = | Bu(S)| + | Bv(S)| + | Bw(S)| + | Br(S)| = 1 + 2 + 3 + 3 = 9,
|S| = | A1(S)| + | A2(S)| + | A3(S)| + | A4(S)| + | A5(S)| = 2 + 3 + 1 + 2 + 1 = 9.
Example 6. In a class of 32 boys each boy knows 5 girls from the girls class and each girl
knows 8 boys. How many girls are there?
Solution. Let B be the set of boys with |B| = 32 and let G be the set of girls with
|G| = n. Consider the set S of pairs (b, g) such that boy b B and girl g G know
each other:
S = {(b, g) : b B, g G, b and g know each other}.
|Gb(S)| = 5, for all b B and |Bg(S)| = 8, for all g G.
Therefore using the 'Total of rows = Total of columns' equation in the special case
where the row total is constant for all rows and the column total is constant for all
columns we have, |S| = 5 x 32 = 8n. Thus n = 20 .
46
Functions and selections (Ordered selections)
1. Ordered selections with repetition
To select r objects from n objects, if repetition is allowed and order matters, then how
many different ordered selections are there? This can be converted to the following.
Let X = {1, 2, … , r} and Y = {a1, a2, …, an}. How many different functions f : X  Y
are there?
Each such function corresponds to an r-tuple (f(1), f(2), … , f(r)), which is an element
of Y  Y  …  Y = Y r . Thus each distinct element of Y r defines a different function
f from X to Y. So the number of possible functions f : X  Y is
| Y r | = |Y|  |Y|  …  |Y| = |Y|r = |Y||X|
It follows that the number of ordered selections with repetition of r objects from n
objects is nr. (Note that there is no restriction on r, it can be r  n or r > n.)
Theorem 6. There are nr ordered selections with repetition of r objects from n objects.
Example 7. How many words of length 3 can we construct from the alphabet {a, b}?
(eg abb, aab, aba etc.)
Or equivalently how many functions are there mapping {1, 2, 3} to {a, b}?
Solution. Each such word is an ordered selection with repetition of 3 objects from 2
objects. By Theorem 6, 23 = 8 words can be constructed. In fact, the eight words of
length 3 are: aaa, aab, aba, baa, abb, bab, bba, bbb.
2. Ordered selections without repetition.
We have seen that an ordered selection with repletion of r objects from a nonempty finite
set A (|A| = n) corresponds to a function from Nr to A. If the ordered selection is
without repetition then this function must be one-to-one. Thus the number of ways of
selecting r objects without repetition from a set A with |A| = n is equal to the number
of one-to-one functions from Nr to A and this is n!/(n-r)! .
n  (n-1)  (n-2)  …  (n-r+1) = n!/(n-r)! .
__
__
__
…
__
1
2
3
r
47
Therorem 7. There are n!/(n-r)! ordered selections without repetition of r objects
from n objects.
Note. (i) Theorem 7 can be proved by mathematical induction on n.
(ii) An ordered selection without repetition of r objects from n objects is also
called a permutation of r objects from n objects. The number of permutations of r
objects from n objects is denoted by P(n, r). From Theorem 7 we know that
P(n, r ) 
n!
.
(n  r )!
The number of permutations of n objects from n objects is then P(n, n) = n!.
Example 8. How many netball teams (of the 7 positions G, GD, WD, C, GA, WA, S)
can be selected from a squad of 10 players?
Solution Each team is an ordered selection without repetition of 7 objects from 10
objects. Thus the number of teams is 10 x 9 x 8 x 7 x 6 x 5 x 4 (=604800).
Subsets and Binomial numbers (unordered selections)
3. Unordered selections without repetition – binomial numbers
Given a set A with n members, the unordered selection of r objects from the n is
equivalent to selecting a subset of A of size r.
We sometimes call a set with n members an n-set and a subset of it with r members an
n
r-subset. The number of r-subsets of an n-set is denoted   (pronounced
r
`n choose r') and is known as a binomial number. Clearly,
n
n
  = 1,   = n,
0
1
n
  = 1.
n
Since choosing r elements from an n-set A to put into a subset corresponds to choosing
n – r elements to leave behind, we note that
n
 n 
 .
  = 
n  r
r
48
Theorem 8 (recursive form for calculation of binomial numbers).
If n and r are positive integers satisfying 1 ≤ r < n then
n
 n  1
 n  1
 + 
 .
  = 
 r  1
 r 
r
Proof. Let x be a particular member of an n-set X. Then all r-subsets of X can be
partitioned into two separates sets U and V,
U = { S: S  X, |S| = r, x  S },
V = { S: S  X, |S| = r, x  S }.
If we remove x from each of the subsets in U we will obtain all of the (r-1)-subsets of
 n  1
 .
the (n-1)-set (X – {x}). Thus, |U| = 
 r  1
As the subsets in V do not contain x, if we remove x from X then we can consider V
 n  1
 .
as containing all the r-subsets of the (n-1)-set (X – {x}). Thus, |V| = 
 r 
By the addition principle, the number of r-subsets of x is |U  V| = |U| + |V|, hence the
result follows.
This result is an expression of Pascal's triangle:
1
1
1
1
1
1
1
1
7
3
4
5
6
1
3
6
10
15
21
1
2
1
4
10
20
35
1
5
15
35
1
6
21
1
7
1
Example 9. Show that, for n > 0,
n
n n
     +    … + (1)n1
0
1  2
Proof. When n = 1, the equality becomes
49
 n 
n

 + (1)n   = 0 .
 n 1
n
1
1
     = 0,
1
 0
n
which obviously holds by   = 1 and
0
we have
 n  1
 +
LHS = 1 – { 
 0 
n
  = 1. For n > 1, using recursive definition
n
 n  1
 n  1

 } + { 
 +
 1 
 1 
 n  1

 } - …
 2 
 n  1   n  1
 + 
 } + (1)n.
+ (1)n1 { 
n

2
n

1

 

Cancelling terms which appear with both positive and negative signs we have,
 n  1
 + (1)n1
LHS = 1  
0


 n  1

 + (1)n = 1 – 1 + (1)n1 + (1)n = 0.
n

1


Theorem 9 (Explicit factorial form for calculation of binomial numbers).
For n, r  with 1 ≤ r ≤ n, there are
n
n!
  =
r!(n  r )!
r
unordered selections without repetition of r objects from n objects.
Proof. We use mathematical induction on n.
1
1!
When n = 1, we have LHS =   = 1 and RHS =
= 1 = LHS.
1! 0!
1
Assume the equality holds for some n = k (≥ 1) , i.e.
k 
k!
  =
.
r! (k  r )!
r
We want to show that the equality holds for n = k + 1, i.e. to show
 k  1
(k  1)!

 =
.
r! (k  1  r )!
 r 
50
LHS
 k 
k 
 +  
= 
 r 1
r
… by recursive definition
k!
k!
+
… by IH,
(r  1)! (k  r  1)!
r! (k  r )!
k!
k!
=
+
(r  1)! (k  r  1) (k  r )!
r (r  1)! (k  r )!
k!
1
=
( 1
+
)
k  r 1
r
(r  1)! (k  r )!
k!
=
( r  k  r 1 )
(r  1)! (k  r )! r (k  1  r )
(k  1)!
=
r! ( k  1  r )!
= RHS.
=
Thus, by induction, the explicit factorial form holds for all positive integers n.
Example 10. a) Out of a group of 10 students exactly 3 are to be awarded merits. How
many possible outcomes are there?
b) How many `words' of length 6 containing exactly 4 ones are there from the alphabet
{0, 1}?
Solution. a) Each outcome is an unordered selection without repetition of 3 objects from
10 objects. Thus the number of outcomes is
10 
  = 10!/ (3!  7!) = 120.
3
b) From 6 positions we must choose four places to put the ones, ie we make an
unordered choice of 4 objects from 6 without repetition. The number of ways is
6
  = 6!/ (4! x 2!) = 15.
 4
4. Unordered selections with repetition
Consider the number of unordered selections of 4 objects from the set {a, b, c} when
any of the set members may be repeated any number of times. The selections are
aaaa, aaab, aaac, aabb, aabc, aacc, abbb, abbc, abcc, accc, bbbb, bbbc, bbcc, bccc,
cccc.
If we use two 0s to separate the as, bs and cs, then they become
51
aaaa00, aaa0b0, aaa00c, aa0bb0, aa0b0c, aa00cc, a0bbb0, a0bb0c, a0b0cc, a00ccc,
0bbbb0, 0bbb0c, 0bb0cc, 0b0ccc, 00cccc.
Next, we replace all as, bs and cs by 1s to obtain
111100, 111010, 111001, 110110, 110101, 110011, 101110, 101101, 101011, 100111,
011110, 011101, 011011, 010111, 001111.
Note that these are the 1,0 strings of length 6 = 4 + (3 – 1) with four 1s and two 0s. The
total number of such strings is
6
  = 6!/ (4! x 2!) = 15,
 4
which is the same as the total number of unordered selections with repetition of 4 objects
from 3 objects.
Theorem 10. The number of unordered selections with repetition of r objects from a set
of n objects is
 n  r  1 (n  r  1)!

 =
.
r!(n  1)!
 r

Proof. Since the selections are unordered we may group the objects in a selection so that
all objects of one kind come together first and then all the objects of another kind and so
on. We can then insert 0s as markers between the groups and replace each object with
a 1. Thus each unordered selection with repetition of r objects from n can be
represented by a string of length r + n – 1 with r 1s and n – 1 0s; each selection
corresponds to a selection of r positions out of n + r – 1 to place the r ones. Thus the
total number of such selections is
 n  r  1
 n  r  1 (n  r  1)!

 = 
 =
.
r!(n  1)!
 r

 n 1 
Example 11. The number of unordered selections of 4 objects from the 3-set {a, b, c}
is 15. (By theorem 10, n = 3, r = 4.)
52
Summary of selections
The number of ways of selecting r objects from a set of n objects under the various
rules can be summarized as below:
r objects from n
Ordered
Without repetition
n!
(n  r )!
With repetition
nr
Unordered
n
n!
  =
r!(n  r )!
r
 n  r  1 (n  r  1)!

 =
r!(n  1)!
 r

Theorem 11 (Binomial expansion). For any positive integer n and any symbols a, b,
n
(a + b)n =
n
  r a
r 0
 
( nr )
br .
Proof. (a + b)n = (a + b) (a + b) (a + b) … (a + b) [n times]. Thus the coefficient of
a(n – r) br is the number of ways we can select (unordered, without repetition of a bracket
set) r bs (or (n – r) as) from the n sets of brackets. This is equivalent to the number of
n
r-subsets of an n-set, i.e.   .
r
53