Download 1 Sets, functions and counting

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

Abuse of notation wikipedia , lookup

List of first-order theories wikipedia , lookup

Functional decomposition wikipedia , lookup

Mathematics of radio engineering wikipedia , lookup

Addition wikipedia , lookup

Series (mathematics) wikipedia , lookup

Big O notation wikipedia , lookup

Fundamental theorem of calculus wikipedia , lookup

Dirac delta function wikipedia , lookup

Continuous function wikipedia , lookup

Principia Mathematica wikipedia , lookup

Elementary mathematics wikipedia , lookup

Non-standard calculus wikipedia , lookup

History of the function concept wikipedia , lookup

Birkhoff's representation theorem wikipedia , lookup

Function of several real variables wikipedia , lookup

Function (mathematics) wikipedia , lookup

Naive set theory wikipedia , lookup

Proofs of Fermat's little theorem wikipedia , lookup

Order theory wikipedia , lookup

Transcript
1
Sets, functions and counting
1.1
Sets
A set is a well defined collection of distinct definite objects. The objects that
make up the set are its elements. If S is a set and s is an element of S, we write
s ∈ S. On the other hand if s is not an element of S then we write s 6∈ S.
To specify a set, list its elements separated by commas and put curly brackets
{ } around them. For example, {2, 4, 6, 8} is the set whose elements are the
integers 2, 4, 6 and 8. For more complicated sets we can use set-builder notation
{· · · : · · · · · · }. As an example, consider the set
{x : x is a prime number and 1 ≤ x ≤ 100} .
This is shorthand for “the set of those x such that x is a prime number and x is
between 1 and 100”. Thus 5 is an element of this set but 21 is not.
Remarks.
• Do not use round or square brackets in place of { } when specifying sets
as above. You can not write (2, 4, 6, 8) or [2, 4, 6, 8] to denote the set with
elements 2, 4, 6 and 8.
• Note that even if an object is described more than once in the description
of a set, it will only count as a single element. For example, the set whose
elements are 2, 1 + 1 and 3 − 1 is the same as the set with single element
2 i.e. {2, 1 + 1, 3 − 1} = {2}.
1
Here are some important sets:
• ∅, the empty set. This is the set without any element. (A common error.
The set {∅} is not the empty set. It has exactly one element, namely the
empty set ∅.)
• N is the set of natural numbers. So N = {1, 2, 3, . . .}.
• N0 := {0, 1, 2, 3, . . .}.
• Z = {. . . , −2, −1, 0, 1, 2, . . .}, the set of integers.
• Q denotes the set of all rational numbers. Recall that a rational number
is a number of the form
m
n
where m and n are integers with n ≥ 1.
• R is the set of all real numbers. This is slightly tricky to define properly
despite its familiarity.
• R2 := {(x, y) : x, y ∈ R} is the plane where we do co-ordinate geometry.
• C denotes the set of all complex numbers.
Definition 1.1. Let A and B be two sets.
• Equality of sets: We say that the sets A and B are equal, written A = B,
if and only if they have the same elements. That is: each element of A is
an element of B and each element of B is an element of A.
• We say that A is a subset of B, written A ⊆ B, if every element of A is
also an element of B. Thus A = B is equivalent to A ⊆ B and B ⊆ A.
• If A ⊆ B but A 6= B then we say A is a proper subset of B, written
A $ B.
• The notation B ⊇ A means A ⊆ B.
• The collection of subsets of A is also a set, called the power set of A.
Exercise 1.2. Write down the power set of {1, 2, 3}.
2
Sets can be finite or infinite. A set is finite if it has exactly n elements, n ∈ N0 .
A set which is not finite is called an infinite set. If A is a finite set then we
usually write |A| for its cardinality i.e. the number of elements in it.
Exercise 1.3. What are the cardinalities of the following sets?
∅;
{∅};
{∅, ∅};
{∅, {∅}}.
There are two very important subsets of R that you should know. Let a ≤ b be
real numbers. The closed interval [a, b] is the set of all real numbers between a
and b, including the end-points a and b. The open interval (a, b) is the set of
all real numbers striclty between a and b i.e. excluding the end-points a and b.
More concisely
[a, b] = {x ∈ R : a ≤ x ≤ b} and (a, b) = {x ∈ R : a ≤ x ≤ b}.
You should also be aware of the following (unbounded) intervals.
• [a, ∞) := {x ∈ R : a ≤ x}
• (a, ∞) := {x ∈ R : a < x}
• (−∞, a] := {x ∈ R : x ≤ a}
• (−∞, a) := {x ∈ R : x < a}
• R+ := (0, ∞) = {x ∈ R : x > 0}
• R≥0 := [0, ∞) = {x ∈ R : x ≥ 0}
(Note square brackets when the end is included, round bracket when the end is
excluded.)
3
Basic operations on sets. Let A and B be two sets.
• Union. A ∪ B := {x : x ∈ A or x ∈ B}.
• Intersection. A ∩ B := {x : x ∈ A and x ∈ B}.
• Set difference. A \ B := {x ∈ A : x 6∈ B}. Sometimes written as A − B;
usually read as A minus B.
• Symmetric difference. A 4 B := (A \ B) ∪ (B \ A).
Exercise 1.4. Use Venn diagrams to illustrate A \ B and A 4 B.
Exercise 1.5. Express the shaded regions in terms of A, B, C and set operations.
4
Exercise 1.6. The plane of classical geometry is a set whose elements are points.
Lines, triangles, circles, polygons etc. constitute various subsets of the plane.
We use co-ordinates to identify the plane with R2 := {(x, y) : x, y ∈ R}. Let
L1 := {(x, y) ∈ R2 : x + y = 1}
,
L2 := {(x, y) ∈ R2 : x − y = 1},
C := {(x, y) ∈ R2 : x2 + y 2 = 1}.
Illustrate L1 ∩ L2 , L1 ∩ C and L2 ∩ C on a picture. What is L1 ∩ L2 ∩ C?
Here are some properties of the set operations. Hopefully some or all of these are
familiar but don’t worry if you haven’t seen them before. Let A, B, C be sets.
• A ∪ ∅ = A and A ∩ ∅ = ∅.
• Commutativity. A ∪ B = B ∪ A and A ∩ B = B ∩ A.
• Associativity. A ∪ (B ∪ C) = (A ∪ B) ∪ C and A ∩ (B ∩ C) = (A ∩ B) ∩ C.
• Distributivity. A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C) and A ∩ (B ∪ C) =
(A ∩ B) ∪ (A ∩ C).
• De Morgan’s laws. A \ (B ∩ C) = (A \ B) ∪ (A \ C) and A \ (B ∪ C) =
(A \ B) ∩ (A \ C).
You can convince yourself of these equalities by drawing Venn diagrams, or by
checking through elements on either side. These laws, despite their simplicity, are
very important and useful! (For example, logic gates in computing; probability
. . .)
5
Cartesian product of sets. We accept as understood the meaning of how to
order two objects into a first and a second. Given objects a and b, the notation
(a, b) indicates the ordered pair where a is considered the first object and b the
second object. In particular two ordered pairs are the same iff1 they have the
same components. In symbols (a, b) = (c, d) iff
.
.
.
.
.
.
.
.
Definition 1.7. Let A and B be any sets. The set of all ordered pairs (a, b)
where a ∈ A and b ∈ B is called the cartesian product of A and B, written as
A × B. Thus
A × B = {(a, b) : a ∈ A, b ∈ B}.
We often write A2 instead of A × A.
We can picture A × B as points with x and y coordinates coming from A and
B respectively:
The definition generalises easily to any finite number of sets. An ordered ntuple is an ordered list of n objects. We write (a1 , a2 , . . . , an ) to denote the
1
‘iff’ is shorthand for ‘if and only if’.
6
ordered n-tuple whose first entry or coordinate is a1 , second entry is a2 and so
on. Alternatively, think of (a1 , a2 , . . . , an ) as a word a1 a2 . . . an . This makes
clear what ordering means in practical terms.
Given sets A1 , A2 , . . . , An , the cartesian product A1 × A2 × . . . × An is then
given by
A1 × A2 × . . . × An = {(a1 , a2 , . . . , an ) : a1 ∈ A1 , a2 ∈ A2 , . . . , an ∈ An }.
We will write A3 instead of A × A × A, A4 instead of A × A × A × A and so on.
For example, R3 = {(x, y, z) : x, y, z ∈ R} is usual Euclidean 3-space. R4 , the
set of all ordered 4-tuples (x, y, z, t) with x, y, z, t ∈ R is the Euclidean 4-space
(or space-time co-ordinates in relativity).
Exercise 1.8. If A = {1, 2} and B = {3, 4} then A×B = {(1, 3), (1, 4), (2, 3), (2, 4)}.
What is B × A? Is A × B = B × A?
Exercise 1.9. Let S = {H, T }. Write down the elements of S 3 as words. Can
you attach a meaning to the elements of S 3 ?
1.2
Functions
Definition 1.10.
• A function f from a set A to a set B, written f : A → B, is a rule
which assigns to an element a ∈ A (the input) an element f (a) ∈ B (the
output). The set A is called the domain of f ; B is called the codomain of
f . The image of f , written as im(f ) or f (A), is the set {f (a) : a ∈ A}.
• Two functions are the same if and only if they give the same output for
every input. More precisely: The functions f : A → B and g : C → D
7
are the same if and only if A = C and f (x) = g(x) for all x ∈ A.
Thus a function is a package of things. To specify a function you need to specify
the domain set and specify what object is associated to each element of the
domain.
Remarks.
• Functions are sometimes called mappings.
• Most of the functions we meet are defined by formulae. For example,
f : R → R given by f (x) = sin x; g : [0, 1] → R given by g(x) =
x2 + x + cos x. General functions are no different, except that the formula
is a little tricky to describe explicitly or has been hidden away.
Example 1.11. Sequences. A sequence is a function whose domain is the set
of natural numbers N = {1, 2, 3, . . .}. A striking feature about N is that it well
ordered: natural numbers come ordered with 1 being the first, 2 the second, and
so on. Thus a sequence is an ordered list of terms; a sequence consists of a first
term, a second term, third term, and so on.
We will write general sequences in one of the following forms.
∞
• f (1), f (2), . . ., or in shorthand f (n) n=1 .
∞
• f1 , f2 , . . ., or in shorthand fn n=1 .
Sometimes our sequences might start with a 0-th term f (0) (or f0 in index form).
For example, the Fibonacci sequence is the function F : N → R defined by
F (1) = 1, F (2) = 1 and F (n) = F (n − 1) + F (n − 2) when n ≥ 3. (Or it
could start with a 0-th Fibonacci number i.e. it could be the sequence Fn =
Fn−1 + Fn−2 when n ≥ 2 and F0 = F1 = 1.)
We can use pictures and diagrams to describe. For example, here are couple
8
of ways of representing the function f : {a, b, c, d, e} → {1, 2, 3, 4} given by
f (a) = f (c) = 1, f (b) = f (e) = 4, f (d) = 2.
{a, b, c, d, e}
a
b
c
d
e
{1, 2, 3, 4}
1
2
3
4
Even better, we can draw graphs. Given a function f : A → B, we define the
graph of f to be the subset of A × B consisting of the ordered pairs (a, f (a))
with a ∈ A. This coincides with what we know of as graphs from before!
Example 1.12. Let f : {a, b, c, d, e} → {1, 2, 3, 4} be the function given by
f (a) = f (c) = 1, f (b) = f (e) = 4, f (d) = 2. We can then draw its graph:
9
• The graph of f : R → R given by x → x2 consists of the
Example 1.13.
points (x, x2 ). Put another way, the graph consists of points (x, y) ∈ R2
where y = x2 .
• Graph of f : R2 → R given by (x, y) → x2 + y 2 . Thinking of R2 × R as
R3 , the graph consists of points (x, y, z) with z =
.
.
.
.
.
.
Remark. A function is clearly determined by its graph. We can use this to give
a very precise definition what a function is: A function from A to B is a subset
of A × B such that for each a ∈ A there is a unique ordered pair (a, b) in the
subset.
Example 1.14. Identity function. Let A be a set. Then there is a very natural
function that we can always write down: the function which sends an element
x ∈ A to
.
.
.
.
This is called the identity function on A and will be denoted
by idA . Thus idA : A → A is defined by the rule
.
.
.
.
.
.
.
.
Example 1.15. Indicator functions. Let Ω be a set and let A ⊆ Ω. The
function 1 A : Ω → {0, 1} given by the rule
1 A (x) :=


1, if x ∈ A,

0, if x 6∈ A,
is called the indicator function on A. Note that 1Ω = idΩ . Indicators functions
are very important in probability theory.
Definition 1.16. Let f : A → B and g : B → C be two functions. The
composite g ◦ f is the function g ◦ f : A → C given by the rule (g ◦ f )(a) =
g(f (a)) for all a ∈ A. That is, we first apply f to a and then apply the function
g to the image f (a).
10
Exercise 1.17. Suppose A = {1, 2, 3}, B = {a, b, c, d}, C = {x, y, z}. If
f : A → B and g : B → C are given by f (1) = a, f (2) = c, f (3) = d and
g(a) = g(b) = x, g(c) = y, g(d) = z respectively, then g ◦ f : A → C is given by
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Exercise 1.18. Consider functions
• f : R → R2 given by f (x) = (cos x, sin x),
• g : R2 → R given by g((x, y)) = xy,
• h : R → R given h(x) = 2x,
• s : R → R given by s(x) = sin x.
Write down the composites h ◦ (g ◦ f ) and s ◦ h. What do you notice?
Exercise 1.19. Let f : A → B be a function. Then idB ◦ f =
f ◦ idA =
.
.
.
.
.
and
.
Definition 1.20. Let f : A → B be a function.
• f is injective or one-to-one if f (a1 ) = f (a2 ) implies a1 = a2 . Equivalently,
if a1 6= a2 then f (a1 ) 6= f (a2 ). In words, distinct elements of A have
distinct images.
• f is surjective or onto if f (A) = B i.e. for every b ∈ B there is at least
one a ∈ A such that f (a) = b.
• f is bijective or is a bijection or a one-to-one correspondence if f is both
injective and surjective.
Definition 1.21. Let f : A → B be a function.
• For C ⊆ B we define f −1 (C), the preimage or the inverse image of C
to be the set of elements in A which get mapped to some element in C.
11
That is,
f −1 (C) := {a ∈ A : f (a) ∈ C}.
• If S ⊆ A then f (S) := {f (s) : s ∈ S} is the image of S under f .
Exercise 1.22. Let f : {a, b, c, d, e} → {1, 2, 3, 4} be given by f (a) = f (c) = 1,
f (b) = f (e) = 4, f (d) = 2. Then
f ({a, b}) =
.
.
.
.
.
.
.
.
.
.
.
.
.
f ({e}) =
.
.
.
.
.
.
.
.
.
.
.
.
.
f (e) =
.
.
.
.
.
.
.
.
.
.
.
.
.
f −1 ({1, 2}) =
.
.
.
.
.
.
.
.
.
.
.
.
.
f −1 ({3}) =
.
.
.
.
.
.
.
.
.
.
.
.
.
If f : A → B is a bijection then for each b ∈ B there is precisely one a such
that f (a) = b. In particular we can define a function from B to A by associating
to each b ∈ B the unique a ∈ A satisfying b = f (a). This is called the inverse
function of f and denoted by f −1 : B → A. Symbolically, f −1 (b) = a iff
f (a) = b. Note that the inverse function is also a bijective map.
Remark. Clearly a bijection between two finite sets exists iff they have same
number of elements. More generally, sets A and B are said to have the same
cardinality if there is a bijection from A to B.
Example 1.23. Here are some examples with a geometric content.
• The function i : R2 → R2 given by i((x, y)) = (−y, x). This is a rotation
about the origin by a right angle in the anticlockwise direction.
12
• The function d : R2 × R2 → R given by
p
d (x1 , y1 ), (x2 , y2 ) = (x1 − x2 )2 + (y1 − y2 )2 .
This gives the distance between two points.
• Likewise distance on three-dimensional space R3 is d : R3 × R3 → R where
p
d (x1 , y1 , z1 ), (x2 , y2 , z2 ) = (x1 − x2 )2 + (y1 − y2 )2 + (z1 − z2 )2 .
Can you see how to define a distance on Rn ?
Functions of real variable(s). The above definition of a function might seem
far too elaborate for the usual functions we meet. For example, when we write
x2 or sin x we know what functions these are, we know what the output will
be given an input. In situations like these we take the domain to be the largest
natural set of allowed inputs. We also use graphs to understand functions: if f
is a function then we can draw the graph y = f (x).
Example 1.24. We can apply the rule x → x2 to any real number. Thus
when we speak of the function x2 we mean the function f : R → R defined by
f (x) = x2 . It has domain
Example 1.25. f (x) =
.
.
..
Its image is
.
.
.
.
.
.
1
. This works as long as x 6= 0 and so has domain
x
R \ {0}.
Example 1.26. The modulus, or the absolute value, function x sends x to x
when x ≥ 0 and sends x to −x when x < 0. Geometrically, |x| measures the
size of x, or the distance between x and 0 on the number line. In general, |a − b|
is the distance between the points a and b on the number line. Thus for any
a, b ∈ R we have |a − b| ≤ |a| + |b|. Replacing b by −b and using |b| = | − b|,
we obtain
13
The Triangle Inequality. |a + b| ≤ |a| + |b| for all a, b ∈ R.
You can also prove this directly by considering the different possibilities for the
signs of a and b.
Example 1.27. The function tan x sends x to tan x. However the rule fails to
give an output when x is of the form
π
2
+ nπ for some integer n.
Figure 1: Graph of tan
So if f (x) = tan x then dom(f ) = R \ { π2 + nπ : n ∈ Z}.
Remark. Unless it is absolutely clear you should always attempt to specify the
domain when writing down a function; it can be confusing otherwise.
Example 1.28. Let’s look at the idea of an inverse function again, this time
in the setting of real variables. So given a function f , we look at the rule that
sends f (x) back to x. Symbolically if y = f (x) then x = f −1 (y).
14
Consider f (x) = x2 . Then f (2) = f (−2) = 4 and so we can’t quite decide if
f −1 (4) should be 2 or −2. To get around this problem, restrict the domain of
f (x) = x2 to R≥0 so that we can get a unique choice. Then on R≥0 , f has the
√
inverse function f −1 (x) = x.
Most functions we meet will be quite well behaved. In particular, we will be able
to construct an inverse function by restricting to parts where the given function
is increasing or decreasing.
Useful trick: To draw the graph of f −1 reflect the graph of f about the line
y = x.
Numbers as sets. The simplest kind of numbers are the natural numbers
N = {1, 2, 3, . . .}. But what are they? Can we define them? Natural numbers
count, and we can attempt to formalize this idea. For instance, the natural
number n sort of says that some set has n elements so we need to produce such
a set in a natural way.
Start with the empty set ∅, and define 0 := ∅. We can then write down a set with
precisely one element: {0}. So we can define 1 := {0}. Then define 2 := {0, 1},
3 := {0, 1, 2} and so on.
1.3
Counting
Exercise 1.29. A cafe offers a set lunch menu involving a starter, a main and a
drink. The choices are
• Starters: Soup; Salad.
• Mains: Fish and chips; Chilli and rice; Cheeseburger.
15
• Drinks: Orange juice; Coke; Water.
How many possible orders?
Exercise 1.30. Take A = {R, B, G} and B = {1, 2}. How many elements does
A × B have?
A×B =
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Counting principle: If the first part of a task can be carried out in n1 ways, the
second part in n2 ways, the third part in n3 ways and so on, then overall the task
itself can be completed in
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Proposition 1.31. Let A and B be finite sets. Then |A × B| = |A| · |B|.
More generally, if A1 , . . . , An are finite sets then |A1 × . . . × An | = |A1 | · · · |An |.
Proof. Let’s do the general case. We want to count the number of ordered
n-tuples (a1 , a2 , . . . , an ) with the i-th component ai ∈ Ai .
The first component is an element of
.
.,
.
so there are
.
.
.
choices
.
.
.
choices
for the first component.
The second component is an element of
.
.,
.
so there are
for the second component. And so on.
Thus the required number of n-tuples is
.
.
.
.
.
.
Remark. If we take A = A1 = A2 = . . . = An in the proposition then we
get |An | = |A|n . As a consequence, we have |{0, 1}n | = 2n . Can you see
this directly by writing down the elements as words? For example, {0, 1}3 =
{000, 001, 010, 011, 100, 101, 110, 111} suggests a matching with binary representations.
16
Proposition 1.32. Given finite sets A, B the number of functions f : A → B
is |B||A| .
Proof. To write down a function f : A → B, we need to specify what f (a) is
for each a ∈ A. This can be done in |B| ways. So altogether we get |B| × |B| ×
. . . × |B| = |B||A| choices for f .
Proposition 1.33. If A is a finite set with n elements then the number of subsets
of A is 2n .
Proof. A subset is specified when we have decided which elements of A are in
it and which are not in it. Now for each of the n elements of A there are 2
possibilities: either it is in the subset OR it is not in the subset. So the total
number of choices is
2 × 2 × . . . × 2 = 2n .
Exercise 1.34. Let A := {R, B, G}. How many functions are there from A to
A? Write down all bijections from A to A.
Definition 1.35. Let S := {s1 , s2 , . . . sn } be a set with n elements.
• A permutation of s1 , s2 , . . . , sn , or a permutation of S, is an ordering of
the n objects s1 , s2 , . . . , sn .
• More generally, let 0 ≤ r ≤ n. An r-permutation of s1 , s2 , . . . , sn , or
an r-permutation of S, is an ordered list of r distinct elements from
s1 , s2 , . . . , sn .
• We will assume that there is a unique 0-permutation. The reason, which we
shall ignore, is that we can choose and order 0 elements uniquely (empty/no
choice!).
17
Recall that n!, read n factorial, is defined to n(n − 1) . . . 2.1 when n ∈ N. Also
0! is defined to be 1.
Theorem 1.36. For 0 ≤ r ≤ n, the number of r-permutations of an n-element
set is
n
Pr := n(n − 1)(n − 2) . . . (n − r + 1) =
n!
.
(n − r)!
In particular, the number of permutations of an n-element set is n!.
Proof. Note that the above gives n P0 =
n!
n!
= 1, which agrees with our definition.
Let S := {s1 , s2 , . . . sn } be a set with n elements and let 1 ≤ r ≤ n. Recall that
an r-permutation of S is an ordered list of r distinct elements of S.
The first position in the list can be filled by any element of S. This gives n
different ways of writing down the first entry. Because we’d have used up an
element of S, the second entry can then be filled in
Finally the r-position can be filled in
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
ways. And so on.
ways. Hence the number
of r-permutations is
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
The same argument counts the number of injective functions from one set to
another. Let S := {s1 , s2 , . . . sn } be a set with n elements.
• How many injective function f : {1, 2} → S are there? We can choose
f (1) to be any of n elements of S. Once we have done that we will have
n − 1 choices for f (2). So the number of injective functions {1, 2} → S
is
.
.
.
.
.
.
.
.
18
• If 1 ≤ r ≤ n then the number of injective functions {1, . . . , r} → S is
.
.
.
.
.
.
.
.
.
.
.
.
.
In particular the number of bijections S → S is
.
.
.
.
.
.
.
.
.
.
Definition 1.37. For r, n ∈ N0 such that 0 ≤ r ≤ n, the binomial coefficient
n
is the number of r element subsets of an n element set. Equivalently, nr
r
this is the number of ways of choosing an unordered collection of r objects out
of n distinct objects.
n
r
is read as“n choose r”, and sometimes written as n Cr .
n
0
Clearly,
in
.
.
=
.
.
.
.
.
ways i.e.
n
= n
n
1
. We can choose 1 object out of n distinct objects
=
.
.
.
..
In general:
Theorem 1.38. Let 0 ≤ r ≤ n be integers. Then
n
Proof. As
n!
0!n!
n
n!
.
Cr =
=
r!(n − r)!
r
= 1 the formula holds when r = 0.
So now assume r ≥ 1. Let S := {s1 , s2 , . . . sn } be a set with n elements. We
can write down an ordered of list of r elements of S in n Pr ways. Each of these
will give an r element subset of S. But there will be repetitions!
If s1 , . . . sr is a particular list of r elements then any re-ordering of s1 , . . . sr
will also give the same subset {s1 , . . . , sr }. There are r! such orderings, so
the subset {s1 , . . . , sr } would have repeated r! times. Hence the number of r
element subsets is
n
Pr
n!
=
.
r!
r!(n − r)!
19
n
r
Remark. Clearly Theorem 1.38 implies
n
n−r
=
for 0 ≤ r ≤ n.
Generalised permutations. Let’s count the number anagrams of SLEEP LESSN ESS.
Thus we are trying to count 13 letter words made of up precisely 5 Ss, 4 Es,
2 Ls, 1 N and 1P . First set down the Ss by choosing 5 out of the 13 let
ter places. This can done in 13
ways. Now place down the Es. There are
5
13 − 5 = 8 places left and we need to choose 4 of out of these, a task which
done in
.
the N in
.
.
.
.
.
.
ways. We can then place the two Ls in
ways and finally the P in
.
.
.
.
.
ways,
ways. Hence the number of
.
anagrams is
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
The method generalises. But first a definition.
Definition 1.39. Given m ≥ 2 non-negative integers k1 , k2 , . . . , km and n =
k1 + k2 + . . . + km , we define the multinomial coefficient
n
k1 , k2 , . . . , km
:=
n!
.
k1 !k2 ! · · · km !
Note 1.40. If m = 2 then
n
k1 ,k2
=
n
k1
=
n
k2
is the usual binomial coefficient.
Theorem 1.41. Let n = k1 + k2 + . . . + km where k1 , . . . , km are non-negative
integers and the number of summands m ≥ 2. Then k1 ,k2n,...,kr counts the
number of n letter words made up of m distinct letters occurring with frequency
k1 , . . . , kr .
20
Equivalently,
n
k1 ,k2 ,...,kr
counts the number of ways in n distinct objects can be
assigned to r labelled teams so that Team 1 gets k1 objects, Team 2 gets k2
objects, and so on.
Recall the method for counting anagrams of SLEEP LESSN ESS. Essentially,
we just counted the number of ways in which 13 distinct objects (the letter places)
can be divided into 5 labelled groups (labelled by the letters so that the groups
can distinguished from each other) of sizes 5, 4, 2, 1 and 1. The general case
is the same: the number of anagrams is the same as the number of ways in n
distinct objects (the letter places) can be divided into r labelled teams, labelled
by the letters, so that Team 1 has size k1 , Team 2 has size k2 and so on.
Now let’s count. We can fill
• Team 1 in
.
.
.
.
.
.
ways; and then,
• Team 2 in
.
.
.
.
.
.
ways; and so on to
• Team r which can be filled in
.
.
.
.
.
.
.
.
.
.
.
ways.
.
So the required total number of ways is
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
A second method is as follows. We go back to counting anagrams of SLEEP LESSN ESS.
If all the letters were different then counting is easy. So let’s make all the letters
different! Colour by indexing so that all letters are different: S1 L1 E1 E2 P1 L2 E3 S2 S3 N1 E4 S4 S5 .
21
With letters now all distinguished we will get 13! anagrams. Coloured letters of
the same kind can be permuted without affecting the result when colours are removed. For example, S1 S2 S3 S4 S5 E1 E2 E3 E4 L1 L2 N1 P1 and S2 S3 S1 S5 S4 E2 E1 E3 E4 L1 L2 N1 P1
both give the anagram SSSSSEEEELLN P . The Ss can be permuted in 5!
ways, the Es in 4! ways, Ls in 2! ways, N in 1! way, and P in 1! way. So each anagram of SLEEP LESSN ESS repeats
.
.
.
.
.
.
.
.
.
.
.
times
in the list of 13! rearrangements with letters are all distinguished. Hence the number of anagrams of SLEEP LESSN ESS is
.
.
.
.
.
.
.
.
.
.
.
So in counting problems where parts are unordered/unlabelled/not distinguished,
put a label to distinguish; count; divide by the number of repetitions.
Binomial and Multinomial expansions.
Theorem 1.42 (Multinomial Theorem). Let m ≥ 2 and n ≥ 0 be integers.
Then
X
n
(x1 + x2 + . . . + xm ) =
k1 +k2 +···+km =n
k1 ,k2 ,...,km ≥0
n
k1 , k2 , . . . , km
xk11 xk22 . . . xkmm .
To see this write out (x1 + x2 + . . . + xm )n as
(x + x2 + . . . + xm ) · (x1 + x2 + . . . + xm ) · · · (x1 + x2 + . . . + xm ) .
| 1
{z
} |
{z
}
|
{z
}
first factor
second factor
n-th factor
When we multiply out by removing brackets, each term is an n letter word with
letters x1 , x2 , . . . , xm . How many of these words correspond to xk11 xk22 . . . xkmm
i.e. x1 occurs k1 times, x2 occurs k2 times, and so on?
Answer:
.
.
.
.
.
.
.
.
.
.
.
We record the case when m = 2 separately as it is particularly important.
22
Theorem 1.43 (Binomial Theorem (Pascal, 1654)). For any n ∈ N0 ,
n X
n n−r r
(a + b) =
a b
r
r=0
n
n
n−1
= a + na
n n−2 2
b+
a b + . . . + nabn−1 + bn .
2
n
n 2
n n
Alternative form: (1 + x) = 1 +
x+
x + ... +
x .
1
2
n
n
Exercise 1.44. Expand (1 + x)n for n = 3, 4, 5.
Example 1.45. Substituting x = 1 in (1 + x)n = 1 +
n
1
x+
n
2
2
x +. . .+
n
n
gives
n
n
n
n
n
+
+ ... +
+ ... +
+
= (1 + 1)n = 2n .
0
1
r
n−1
n
Substituting x = −1 gives
n
n
r n
n n
−
+ . . . + (−1)
+ . . . + (−1)
= (1 − 1)n = 0.
0
1
r
n
23
xn