Topic 1 Lecture Notes 1
Topic 1 Lecture Notes 1
Topic 1 Lecture Notes 1
Trenerry
Example. We can specify a set by listing its elements between curly brackets,
separated by commas:
S = {b, c} .
The elements of S are . Thus |S| = 2.
We can write b ∈ S, c ∈ S, and d ∈
/ S, for instance.
Example. We can specify a set by some property that all elements must have:
S = {x ∈ Z | x2 ≤ 4}
(or S = {x ∈ Z : x2 ≤ 4} ) .
1
Two sets S and T are equal, denoted by S = T , if and only if (written iff)
(i) every element of S is also an element of T , and
(ii) every element of T is also an element of S .
i.e., when they have precisely the same elements.
The empty set, denoted by ∅, is a set which has no elements. |∅| =
Exercise. What is the difference between the sets ∅, {∅} and {∅, {∅}}?
Example. N ⊆ Z ⊆ Q ⊆ R
2
Example. Let S = {a, b, c}. The subsets of S are:
∅, {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c}.
S has 8 subsets. We can write ∅ ⊆ S, {b} ⊆ S, {a, c} ⊆ S, {a, b, c} ⊆ S, etc.
The power set of S is
P (S) = {∅, {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c}}.
and |P (S)| = 23 = 8.
We can write ∅ ∈ P (S), {b} ∈ P (S), {a, c} ∈ P (S), {a, b, c} ∈ P (S), etc.
Exercise. Let A = P (P ({1})). Find A and |A|.
Exercise. For B = {∅, 0, {1}}, are the following statements true or false?
1. ∅∈B 8. {{0}} ⊆ P (B)
2. ∅⊆B 9. 1∈B
3. {∅} ∈ B 10. {1} ⊆ B
4. {∅} ⊆ P (B) 11. {1} ∈ P (B)
5. {0} ∈ P (B) 12. {{1}} ⊆ P (B)
6. {∅} ( B 13. ∅ ∈ P (P (P (P (B))))
7. {∅} ∈ P (B)
3
It is often convenient to work inside a specified universal set, denoted by U ,
which is assumed to contain everything that is relevant.
Venn diagrams are visualizations of sets as regions in the plane.
For instance, here is a Venn diagram of a universal set U containing a set A:
U
A
complement (c , ) - “not” U
Ac = A = U \ A = {x ∈ U | x ∈
/ A} A
4
Exercise. Given U = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
A = {x ∈ U | x is odd}
B = {x ∈ U | x is even}
C = {x ∈ U | x is a multiple of 3}
D = {x ∈ U | x is prime}
determine the following sets:
A∩C
B−D
B∪D
Ac
(A ∩ C) − D
100 0 C++
19
22
9 17
x
21 2
VB Java
x = 100 − (17 + 22 + 9 + 2 + 19 + 21 + 0) = 10
5
Exercise. In a survey of 200 people asked about whether they like
apples (A), bananas (B), and cherries (C), the following data was obtained:
|A| = 112, |B| = 89, |C| = 71,
|A ∩ B| = 32, |A ∩ C| = 26, |B ∩ C| = 43,
|A ∩ B ∩ C| = 20.
a) How many people like apples or bananas?
b) How many people like exactly one of these fruit?
c) How many people like none of these fruit?
6
Exercise. Prove that if A ⊆ B, then A ∩ B = A.
Exercise. Is the statement A∩(B ∪C) = (A∩B)∪C true (for all sets A, B, C)?
Provide a proof if it is true or give a counter example if it is false.
7
Laws of set algebra:
Commutative laws A∩B =B∩A
A∪B =B∪A
Associative laws A ∩ (B ∩ C) = (A ∩ B) ∩ C
A ∪ (B ∪ C) = (A ∪ B) ∪ C
Distributive laws A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C)
A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C)
Absorption laws A ∩ (A ∪ B) = A
A ∪ (A ∩ B) = A
Identity laws A∩U =U ∩A=A
A∪∅=∅∪A=A
Idempotent laws A∩A=A
A∪A=A
Double complement law (Ac )c = A
Difference law A − B = A ∩ Bc
Domination or universal bound laws A∩∅=∅∩A=∅
A∪U =U ∪A=U
Intersection and union with complement A ∩ Ac = Ac ∩ A = ∅
A ∪ Ac = Ac ∪ A = U
De Morgan’s Laws (A ∪ B)c = Ac ∩ B c (A ∩ B)c = Ac ∪ B c
U U Exampl
B A B A
8
Example. We can use the laws of set algebra to simplify (Ac ∩ B)c ∪ B:
9
Principal of Duality:
For a set identity involving only unions, intersections and complements, its
dual is obtained by replacing ∩ with ∪, ∪ with ∩, ∅ with U , and U with ∅.
As all the relevant laws of set algebra come in dual pairs, then
the dual of any true set identity is also true.
10
Example.
Let I = {1, 2, 3, . . .} be the index set. For each i ∈ I let
Ai = [0, 1i ] ⊆ R be the set of real numbers between
1
0 and i
including 0 and 1i .
Solution:
The paradox occurred because a self-referential statement was used. The “them-
self” in (*) could also refer to the barber unless our above solution is imposed.
11
Example. (Russell’s Paradox)
Let U be the set of all sets.
First weird phenomenon: then U ∈ U .
Even worse, we have Russell’s paradox. Let
S = {A ∈ U | A ∈
/ A}.
Is S an element of itself?
i) If S ∈ S, then the definition of S implies that S ∈
/ S, a contradiction.
ii) If S ∈
/ S, then the definition of S implies that S ∈ S, also a contradiction.
Hence neither S ∈ S nor S ∈
/ S.
Usual Solution:
Key Point: The notion of set and set theory is very subtle. We will for the
most part ignore these subtleties.
12
Example. Let A = {a, b} and B = {1, 2, 3}. Then
A × B = {(a, 1), (a, 2), (a, 3), (b, 1), (b, 2), (b, 3)} .
When X and Y are small finite sets, we can use an arrow diagram to represent
a subset S of X × Y : we list the elements of X and the elements of Y , and
then we draw an arrow from x to y for each pair (x, y) ∈ S.
Example. Let X = {a, b, c}, Y = {1, 2, 3, 4}, and S = {(a, 2), (a, 3), (c, 1)}
which is a subset of X × Y , then the arrow diagram for S is
1
a
2
b
3
c
4
13
Example. Adam, Ben, Cate, Diane, and Eve were each given a mark out of 4.
Their marks define a function f : X → Y as follows:
domain X = {Adam, Ben, Cate, Diane, and Eve}
codomain Y = {1, 2, 3, 4},
and suppose f = {(Adam, 3), (Ben, 2), (Cate, 4), (Diane, 2), (Eve, 3)}.
Adam f
1
Ben
2
Cate
3
Diane
4
Eve
X Y
14
The floor function: (round down)
for any x ∈ R, we denote by ⌊x⌋ the largest integer less than or equal to x.
The ceiling function: (round up)
for any x ∈ R, we denote by ⌈x⌉ the smallest integer greater than or equal to x.
Exercise. What are the ranges of the floor and ceiling functions?
Plot the graphs of the floor and the ceiling functions.
15
Example. Let the function f be defined by the arrow diagram
a
1
b
2
c
3
d
4
e
The image of {a, b, e} under f is f ({a, b, e}) = {f (a), f (b), f (e)} = {2, 3}.
The inverse image of {1, 2} under f is f −1 ({1, 2}) = {b, d}.
Exercise. Let f : R → R be given by f (x) = x2 . Find
√
(a) The image of the set {2, −2, π, 2} under f .
(b) The inverse image of the set {9, −9, π} under f
(c) The inverse image of the set {−2, −9} under f .
16
In terms of arrow diagrams and graphs...
a 1 a 1 a 1
2 2 2
b b b
c 3 c 3 c 3
f1 4 f2 4 f3 4
a 1 a a 1
1
2 2
b b 2 b
c 3 c c 3
3
f4 4 f5 f6 4
a a a a
1 1 1
b b b b 1
c 2 c 2 c 2 c
f7 f8 f9 f10
17
f1 f2 f3 f4 f5 f6 f7 f8 f9 f10
function
injective
surjective
bijective
Plot the graph in each case, and give reasons for your answers.
f1 f2 f3 f4 f5 f6
function
injective
surjective
bijective
18
For functions f : X → Y and g : Y → Z, the composite of f and g is the
function g ◦ f : X → Z defined by (g ◦ f )(x) = g(f (x)) for all x ∈ X.
In general, g ◦ f and f ◦ g are not the same composite functions.
Associativity of composition (assuming they exist): h ◦ (g ◦ f ) = (h ◦ g) ◦ f .
(f ◦ g)(y) = f (g(y)) = f (y 2 ) = y 2 + 3.
19
The identity function on a set X is the function idX : X → X, idX (x) = x.
For any function f : X → Y , we have f ◦ idX = f = idY ◦ f .
A function g : Y → X is an inverse of f : X → Y if and only if
Exercise. For each of the following functions, find its inverse if it is invertible.
f : R → Z, f (x) = ⌊x⌋
g : R → R+ , g(x) = e3x−2
h : {1, 2, 3} → {a, b, c}, h = {(1, b), (2, c), (3, a)}.
20
Example. Prove that a function has at most one inverse.
Proof. Suppose that f : X → Y has two inverses g1 : Y → X and g2 : Y → X.
Then
g1 = g1 ◦ idY by property of identity
= g1 ◦ (f ◦ g2 ) by definition of inverse
= (g1 ◦ f ) ◦ g2 by associativity of composition
= idX ◦ g2 by definition of inverse
= g2 by property of identity
Hence, if f has an inverse, then it is unique.
Exercise. Prove that a function has an inverse if and only if it is bijective.
21
Exercise. Prove that if f : X → Y and g : Y → Z are invertible,
then so is g ◦ f : X → Z, and the inverse of g ◦ f is f −1 ◦ g −1 .
a0 , a1 , a2 , . . . , ak , . . . ,
where each object ak is called a term, and the subscript k is called an index
(typically starting from 0 or 1). We denote the sequence by {ak }.
If all terms ak lie in a set A, we can think of the sequence as a function
a : N → A : k 7→ ak .
Example.
An arithmetic progression is a sequence {bk } where bk = a + kd for all k ∈ N
for some fixed numbers a ∈ R and d ∈ R. Its terms are
a, a + d, a + 2d, a + 3d, . . . .
22
Summation notation: for m ≤ n,
n
X
ak = am + am+1 + am+2 + · · · + an .
k=m
Properties of summation:
n
X n
X n
X n
X n
X
(ak + bk ) = ak + bk and (λ ak ) = λ ak ,
k=m k=m k=m k=m k=m
but in general ! !
n
X n
X n
X
ak bk 6= ak bk .
k=m k=m k=m
Example. The sum of the first n+1 terms of the arithmetic progression {a+kd}
is
n
X (2a+nd)(n+1)
(a+kd) = a + (a+d) + (a+2d) + · · · + (a+nd) = .
k=0
2
Why?
Example. The sum of the first n + 1 terms of the geometric progression {ark }
is n
X
k 2 n a(rn+1 − 1)
ar = a + ar + ar + · · · + ar = .
k=0
r − 1
Why?
23
Exercise. Given the formulas
n n
X n(n + 1) X n(n + 1)(2n + 1)
k = and k2 = ,
k=1
2 k=1
6
evaluate
10
X
(k − 3)(k + 2)
k=1
24
Example. (Change of summation index)
The sum
5
X 1
k=1
k+2
can be transformed by a change of variable like j = k + 2 as follows:
Lower limit: when k = 1, we have j = 1 + 2 = 3.
Upper limit: when k = 5, we have j = 5 + 2 = 7.
1 1
General term: we have = .
k+2 j
Thus, we obtain
5 7
X 1 X 1
= .
k=1
k + 2 j=3
j
We could now replace the variable j by the variable k (if this is preferred):
5 7
X 1 X 1
= .
k=1
k+2 k=3
k
More generally, for any sequence {ak } and any integer d we have
n
X n+d
X
ak = ak−d .
k=m k=m+d
For example,
3
X 4
X 2
X
a1 + a2 + a3 = ak = ak−1 = ak+1 = · · · .
k=1 k=2 k=0
Exercise. Simplify
n+1
X n−1
X n−1
X
xk−2 − xk + xk+1
k=2 k=1 k=0
25
Example. (A telescoping sum)
3 1 1
Using the identity = − for k ≥ 1, we can write
k(k + 3) k k+3
n n
X 3 X 1 1
= −
k=1
k(k + 3) k=1
k k+3
1 1 1 1 1 1 1 1 1
= 1− + − + − + − + ··· + − .
4 2 5 3 6 4 7 n n+3
X
This is an example of a telescoping sum: ak , where ak = bk − bk+d .
By changing the summation index, we see that
n n n n n+3
X 3 X 1 X 1 X 1 X1
= − = −
k=1
k(k + 3) k=1
k k=1
k + 3 k=1
k k=4
k
3 n
! n n+3
!
X 1 X 1 X 1 X 1
= + − +
k=1
k k=4
k k=4
k k=n+1 k
1 1 1 1 1
= 1+ + − − − .
2 3 n+1 n+2 n+3
2 1 2 1
Exercise. Use the identity = − + for k ≥ 1
k(k + 1)(k + 2) k k+1 k+2
to simplify
n
X 2
k=1
k(k + 1)(k + 2)
26
Product notation: for m ≤ n,
n
Y
ak = am · am+1 · am+2 · · · an .
k=m
Properties of product:
n n
! n
! n n n
Y Y Y Y Y Y
ak bk = ak bk but (ak + bk ) 6= ak + bk .
k=m k=m k=m k=m k=m k=m
Exercise. Simplify
n
Y k
k=1
k+3
27