Discrete Structures 1
Set Theory
Set Theory
2
Learning Outcome;
•Describe memberships of sets, including the empty set, using
proper notation, and decide whether given items are members
and determine the cardinality of a given set.
•Describe the relations between sets regarding membership,
equality, subset, and proper subset, using proper notation.
•Perform the operations of union, intersection, complement, and
difference on sets using proper notation.
•Recognize when set theory is applicable to real-life situations,
solve real-life problems, and communicate real-life problems
and solutions to others.
Understanding that inputs and outputs are a set of points that
satisfy a relation
Recognizing that relations can be represented as ordered pairs,
tables, mapping diagrams, or graphs
Finding the rule that satisfies the inputs and the corresponding
outputs of a table
Discrete Structures 3
Set Theory
Set Theory
• Set: Collection of objects (called
Set: Collection of objects (called elements
elements)
)
• a
a
A
A “a is an element of A”
“a is an element of A”
“a is a member of A”
“a is a member of A”
• a
a
A
A “a is not an element of A”
“a is not an element of A”
• A = {a
A = {a1
1, a
, a2
2, …, a
, …, an
n}
} “A contains a
“A contains a1
1, …, a
, …, an
n”
”
• Order of elements is insignificant
Order of elements is insignificant
• It does not matter how often the same
It does not matter how often the same
element is listed (repetition doesn’t count).
element is listed (repetition doesn’t count).
4
Set Equality
Set Equality
Sets A and B are equal if and only if they
Sets A and B are equal if and only if they
contain exactly the same elements.
contain exactly the same elements.
Examples:
Examples:
• A = {9, 2, 7, -3}, B = {7, 9, -3, 2} :
A = {9, 2, 7, -3}, B = {7, 9, -3, 2} : A = B
A = B
• A = {dog, cat, horse},
A = {dog, cat, horse},
B = {cat, horse, squirrel, dog} :
B = {cat, horse, squirrel, dog} : A
A 
 B
B
• A = {dog, cat, horse},
A = {dog, cat, horse},
B = {cat, horse, dog, dog} :
B = {cat, horse, dog, dog} : A = B
A = B
5
Examples for Sets
Examples for Sets
“
“Standard” Sets:
Standard” Sets:
• Natural numbers
Natural numbers N
N = {0, 1, 2, 3, …}
= {0, 1, 2, 3, …}
• Integers
Integers Z
Z = {…, -2, -1, 0, 1, 2, …}
= {…, -2, -1, 0, 1, 2, …}
• Positive Integers
Positive Integers Z
Z+
+
= {1, 2, 3, 4, …}
= {1, 2, 3, 4, …}
• Real Numbers
Real Numbers R
R = {47.3, -12,
= {47.3, -12, 
, …}
, …}
• Rational Numbers
Rational Numbers Q
Q = {1.5, 2.6, -3.8, 15, …}
= {1.5, 2.6, -3.8, 15, …}
(correct definitions will follow)
(correct definitions will follow)
Discrete Structures 6
Examples for Sets
Examples for Sets
• A =
A = 
 “empty set/null set”
“empty set/null set”
• A = {z}
A = {z} Note: z
Note: z
A, but z
A, but z 
 {z}
{z}
• A = {{b, c}, {c, x, d}}
A = {{b, c}, {c, x, d}} set of sets
set of sets
• A = {{x, y}}
A = {{x, y}} Note: {x, y}
Note: {x, y} 
A, but {x, y}
A, but {x, y} 
 {{x, y}}
{{x, y}}
• A = {x | P(x)}
A = {x | P(x)} “set of all x such that P(x)”
“set of all x such that P(x)”
P(x) is the
P(x) is the membership function
membership function of set A
of set A

x (P(x)
x (P(x) 
 x
x
A)
A)
• A = {x | x
A = {x | x
 N
N 
 x > 7} = {8, 9, 10, …}
x > 7} = {8, 9, 10, …}
“set builder notation”
“set builder notation”
Discrete Structures 7
Examples for Sets
Examples for Sets
We are now able to define the set of rational
We are now able to define the set of rational
numbers Q:
numbers Q:
Q
Q = {a/b | a
= {a/b | a
Z
Z 
 b
b
Z
Z+
+
},
}, or
or
Q
Q = {a/b | a
= {a/b | a
Z
Z 
 b
b
Z
Z 
 b
b
0}
0}
And how about the set of real numbers R?
And how about the set of real numbers R?
R
R = {r | r is a real number}
= {r | r is a real number}
That is the best we can do. It can neither be
That is the best we can do. It can neither be
defined by enumeration nor builder function.
defined by enumeration nor builder function.
8
Subsets
Subsets
A
A 
 B
B “A is a subset of B”
“A is a subset of B”
A
A 
 B if and only if every element of A is also
B if and only if every element of A is also
an element of B.
an element of B.
We can completely formalize this:
We can completely formalize this:
A
A 
 B
B 
 
x (x
x (x
A
A 
x
x
B)
B)
Examples:
Examples:
A = {3, 9}, B = {5, 9, 1, 3}, A
A = {3, 9}, B = {5, 9, 1, 3}, A 
 B ?
B ? true
true
A = {3, 3, 3, 9}, B = {5, 9, 1, 3}, A
A = {3, 3, 3, 9}, B = {5, 9, 1, 3}, A 

B ?
B ?
false
false
true
true
A = {1, 2, 3}, B = {2, 3, 4}, A
A = {1, 2, 3}, B = {2, 3, 4}, A 

B ?
B ?
9
Subsets
Subsets
Useful rules:
Useful rules:
• A = B
A = B 
 (A
(A 
 B)
B) 
 (B
(B 
A)
A)
• (A
(A 
 B)
B) 
(B
(B 
 C)
C) 
 A
A 
 C
C (see Venn Diagram)
(see Venn Diagram)
U
U
A
A
B
B
C
C
10
Subsets
Subsets
Useful rules:
Useful rules:
 
 
 A for any set A
A for any set A
(but
(but 
 
 A may not hold for any set A)
A may not hold for any set A)
• A
A 
 A for any set A
A for any set A
Proper subsets:
Proper subsets:
A
A 
 B
B “A is a proper subset of B”
“A is a proper subset of B”
A
A 
 B
B 
 
x (x
x (x
A
A 
 x
x
B)
B) 
 
x (x
x (x
B
B 
 x
x
A)
A)
or
or
A
A 
 B
B 
 
x (x
x (x
A
A 
 x
x
B)
B) 
 
x (x
x (x
B
B 
x
x
A)
A)
11
Cardinality of Sets
Cardinality of Sets
If a set S contains n
If a set S contains n distinct
distinct elements, n
elements, n
N
N,
,
we call S a
we call S a finite set
finite set with
with cardinality n
cardinality n.
.
Examples:
Examples:
A = {Mercedes, BMW, Porsche}, |A| = 3
A = {Mercedes, BMW, Porsche}, |A| = 3
B = {1, {2, 3}, {4, 5}, 6}
B = {1, {2, 3}, {4, 5}, 6} |B| = 4
|B| = 4
C = 
C =  |C| = 0
|C| = 0
D = { x
D = { xN
N | x 7000 }

| x 7000 }
 |D| = 7001
|D| = 7001
E = { x
E = { xN
N | x 7000 }

| x 7000 }
 E is infinite!
E is infinite!
12
The Power Set
The Power Set
P(A)
P(A) “power set of A” (also written as
“power set of A” (also written as 2
2A
A
)
)
P(A) = {B | B
P(A) = {B | B 
 A}
A} (contains all subsets of A)
(contains all subsets of A)
Examples:
Examples:
A = {x, y, z}
A = {x, y, z}
P(A)
P(A) = {
= {
, {x}, {y}, {z}, {x, y}, {x, z}, {y, z}, {x, y, z}}
, {x}, {y}, {z}, {x, y}, {x, z}, {y, z}, {x, y, z}}
A =
A = 

P(A) = {
P(A) = {
}
}
Note: |A| = 0, |P(A)| = 1
Note: |A| = 0, |P(A)| = 1
13
The Power Set
The Power Set
Cardinality of power sets:
Cardinality of power sets: | P(A) | = 2
| P(A) | = 2|A|
|A|
• Imagine each element in A has an “
Imagine each element in A has an “on
on/
/off
off” switch
” switch
• Each possible switch configuration in A
Each possible switch configuration in A
corresponds to one subset of A, thus one element
corresponds to one subset of A, thus one element
in P(A)
in P(A)
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
z
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
y
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
8
8
7
7
6
6
5
5
4
4
3
3
2
2
1
1
A
A
• For 3 elements in A, there are
For 3 elements in A, there are
2
2
2
2
2 = 8 elements in P(A)
2 = 8 elements in P(A)
14
Cartesian Product
Cartesian Product
The
The ordered n-tuple
ordered n-tuple (a
(a1
1, a
, a2
2, a
, a3
3, …, a
, …, an
n) is an
) is an
ordered collection
ordered collection of n objects.
of n objects.
Two ordered n-tuples (a
Two ordered n-tuples (a1
1, a
, a2
2, a
, a3
3, …, a
, …, an
n) and
) and
(b
(b1
1, b
, b2
2, b
, b3
3, …, b
, …, bn
n) are equal if and only if they
) are equal if and only if they
contain exactly the same elements
contain exactly the same elements in the same
in the same
order
order, i.e. a
, i.e. ai
i = b
= bi
i for 1
for 1 
 i
i 
 n.
n.
The
The Cartesian product
Cartesian product of two sets is defined as:
of two sets is defined as:
A
A
B = {(a, b) | a
B = {(a, b) | a
A
A 
 b
b
B}
B}
15
Cartesian Product
Cartesian Product
Example:
Example:
A = {good, bad}, B = {student, prof}
A = {good, bad}, B = {student, prof}
A
A
B = {
B = {
(good, student),
(good, student), (good, prof),
(good, prof), (bad, student),
(bad, student), (bad, prof)
(bad, prof)}
}
(prof, bad)
(prof, bad)}
}
(student, good),
(student, good), (prof, good),
(prof, good), (student, bad),
(student, bad),
B A = {

B A = {

Example:
Example: A = {x, y}, B = {a, b, c}
A = {x, y}, B = {a, b, c}
A B = {(x, a), (x, b), (x, c), (y, a), (y, b), (y, c)}

A B = {(x, a), (x, b), (x, c), (y, a), (y, b), (y, c)}

16
Set Operations
Set Operations
Union: A
Union: A
B = {x | x
B = {x | x
A
A 
 x
x
B}
B}
Example:
Example: A = {a, b}, B = {b, c, d}
A = {a, b}, B = {b, c, d}
A
A
B = {a, b, c, d}
B = {a, b, c, d}
Intersection: A
Intersection: A
B = {x | x
B = {x | x
A
A 
 x
x
B}
B}
Example:
Example: A = {a, b}, B = {b, c, d}
A = {a, b}, B = {b, c, d}
A
A
B = {b}
B = {b}
Cardinality: |A
Cardinality: |A
B| = |A| + |B| - |A
B| = |A| + |B| - |A
B|
B|
17
Set Operations
Set Operations
Two sets are called
Two sets are called disjoint
disjoint if their intersection
if their intersection
is empty, that is, they share no elements:
is empty, that is, they share no elements:
A
A
B =
B = 

The
The difference
difference between two sets A and B
between two sets A and B
contains exactly those elements of A that are
contains exactly those elements of A that are
not in B:
not in B:
A-B = {x | x
A-B = {x | x
A
A 
 x
x
B}
B}
Example:
Example: A = {a, b}, B = {b, c, d}, A-B = {a}
A = {a, b}, B = {b, c, d}, A-B = {a}
Cardinality: |A-B| = |A| - |A
Cardinality: |A-B| = |A| - |A
B|
B|
18
Set Operations
Set Operations
The
The complement
complement of a set A contains exactly
of a set A contains exactly
those elements under consideration that are not
those elements under consideration that are not
in A: denoted A
in A: denoted Ac
c
(or as in the text)
(or as in the text)
A
Ac
c
= U-A
= U-A
Example:
Example: U =
U = N
N, B = {250, 251, 252, …}
, B = {250, 251, 252, …}
B
Bc
c
= {0, 1, 2, …, 248, 249}
= {0, 1, 2, …, 248, 249}
A
19
Set Identity
Set Identity
Table 1 in Section 1.7 shows many useful equations
Table 1 in Section 1.7 shows many useful equations
– Identity laws,
Identity laws, A
A

 = A
= A,
, A
A
U = A
U = A
– Domination laws,
Domination laws, A
A
U = U
U = U,
, A
A

 =
= 

– Idempotent laws,
Idempotent laws, A
A
A = A
A = A,
, A
A
A
A =
= A
A
– Complementation law,
Complementation law, (
(A
Ac
c
)
)c
c
= A
= A
– Commutative laws,
Commutative laws, A
A
B =
B = B
B
A, A
A, A
B = B
B = B
A
A
– Associative laws,
Associative laws, A
A
(B
(B 
 C) = (A
C) = (A
B)
B)
C
C, …
, …
– Distributive laws,
Distributive laws, A
A
(B
(B
C) = (A
C) = (A
B)
B)
(A
(A
C)
C), …
, …
– De Morgan’s laws,
De Morgan’s laws, (A
(A
B)
B)c
c
=
= A
Ac
c

B
Bc,
c,
(A
(A
B)
B)c
c
=
= A
Ac
c

B
Bc
c
– Absorption laws,
Absorption laws, A
A
(A
(A
B) = A
B) = A,
, A
A
(A
(A
B) = A
B) = A
– Complement laws,
Complement laws, A
A
A
Ac
c
= U, A
= U, A
A
Ac
c
=
= 

20
Set Operations
Set Operations
Method : Membership table
Method : Membership table
1 means “x is an element of this set”
1 means “x is an element of this set”
0 means “x is not an element of this set”
0 means “x is not an element of this set”
1
1
1
1
1
1
1
1
1
1
1 1 1
1 1 1
1
1
1
1
1
1
1
1
0
0
1 1 0
1 1 0
1
1
1
1
1
1
1
1
0
0
1 0 1
1 0 1
1
1
1
1
1
1
1
1
0
0
1 0 0
1 0 0
1
1
1
1
1
1
1
1
1
1
0 1 1
0 1 1
0
0
0
0
1
1
0
0
0
0
0 1 0
0 1 0
0
0
1
1
0
0
0
0
0
0
0 0 1
0 0 1
0
0
0
0
0
0
0
0
0
0
0 0 0
0 0 0
(A
(A
B)
B) 
(A
(A
C)
C)
A
A
C
C
A
A
B
B
A
A
(B
(B
C)
C)
B
B
C
C
A B C
A B C
21
Functions
Functions
Discrete Structures 22
Functions
Functions
A
A function
function f from a set A to a set B is an
f from a set A to a set B is an
assignment
assignment of
of exactly one
exactly one element of B to
element of B to each
each
element of A.
element of A.
We write
We write
f(a) = b
f(a) = b
if b is the unique element of B assigned by the
if b is the unique element of B assigned by the
function f to the element a of A.
function f to the element a of A.
If f is a function from A to B, we write
If f is a function from A to B, we write
f: A
f: A
B
B
(note: Here, “
(note: Here, “
“ has nothing to do with if… then)
“ has nothing to do with if… then)
Discrete Structures 23
Functions
Functions
If f:A
If f:A
B, we say that A is the
B, we say that A is the domain
domain of f and B
of f and B
is the
is the codomain
codomain of f.
of f.
If f(a) = b, we say that b is the
If f(a) = b, we say that b is the image
image of a and a is
of a and a is
the
the pre-image
pre-image of b.
of b.
The
The range
range of f:A
of f:A
B is the set of all images of
B is the set of all images of all
all
elements of A.
elements of A.
We say that f:A
We say that f:A
B
B maps
maps A to B.
A to B.
Discrete Structures 24
Functions
Functions
Let us take a look at the function f:P
Let us take a look at the function f:P
C with
C with
P = {Linda, Max, Kathy, Peter}
P = {Linda, Max, Kathy, Peter}
C = {Boston, New York, Hong Kong, Moscow}
C = {Boston, New York, Hong Kong, Moscow}
f(Linda) = Moscow
f(Linda) = Moscow
f(Max) = Boston
f(Max) = Boston
f(Kathy) = Hong Kong
f(Kathy) = Hong Kong
f(Peter) = New York
f(Peter) = New York
Here, the range of f is C.
Here, the range of f is C.
25
Functions
Functions
Let us re-specify f as follows:
Let us re-specify f as follows:
f(Linda) = Moscow
f(Linda) = Moscow
f(Max) = Boston
f(Max) = Boston
f(Kathy) = Hong Kong
f(Kathy) = Hong Kong
f(Peter) = Boston
f(Peter) = Boston
Is f still a function?
Is f still a function? yes
yes
{Moscow, Boston, Hong Kong}
{Moscow, Boston, Hong Kong}
What is its range?
What is its range?
26
Functions
Functions
Other ways to represent f:
Other ways to represent f:
Boston
Boston
Peter
Peter
Hong
Hong
Kong
Kong
Kathy
Kathy
Boston
Boston
Max
Max
Moscow
Moscow
Linda
Linda
f(x)
f(x)
x
x Linda
Linda
Max
Max
Kathy
Kathy
Peter
Peter
Boston
Boston
New York
New York
Hong Kong
Hong Kong
Moscow
Moscow
27
Functions
Functions
If the domain of our function f is large, it is
If the domain of our function f is large, it is
convenient to specify f with a
convenient to specify f with a formula
formula, e.g.:
, e.g.:
f:
f:R
R
R
R
f(x) = 2x
f(x) = 2x
This leads to:
This leads to:
f(1) = 2
f(1) = 2
f(3) = 6
f(3) = 6
f(-3) = -6
f(-3) = -6
…
…
28
Functions
Functions
Let f
Let f1
1 and f
and f2
2 be functions from A to
be functions from A to R
R.
.
Then the
Then the sum
sum and the
and the product
product of f
of f1
1 and f
and f2
2 are also
are also
functions from A to
functions from A to R
R defined by:
defined by:
(f
(f1
1 + f
+ f2
2)(x) = f
)(x) = f1
1(x) + f
(x) + f2
2(x)
(x)
(f
(f1
1f
f2
2)(x) = f
)(x) = f1
1(x) f
(x) f2
2(x)
(x)
Example:
Example:
f
f1
1(x) = 3x, f
(x) = 3x, f2
2(x) = x + 5
(x) = x + 5
(f
(f1
1 + f
+ f2
2)(x) = f
)(x) = f1
1(x) + f
(x) + f2
2(x) = 3x + x + 5 = 4x + 5
(x) = 3x + x + 5 = 4x + 5
(f
(f1
1f
f2
2)(x) = f
)(x) = f1
1(x) f
(x) f2
2(x) = 3x (x + 5) = 3x
(x) = 3x (x + 5) = 3x2
2
+ 15x
+ 15x
Discrete Structures 29
Functions
Functions
We already know that the
We already know that the range
range of a function
of a function
f:A
f:A
B is the set of all images of elements a
B is the set of all images of elements a
A.
A.
If we only regard a
If we only regard a subset
subset S
S
A, the set of all
A, the set of all
images of elements s
images of elements s
S is called the
S is called the image
image of S.
of S.
We denote the image of S by f(S):
We denote the image of S by f(S):
f(S) = {f(s) | s
f(S) = {f(s) | s
S}
S}
30
Functions
Functions
Let us look at the following well-known function:
Let us look at the following well-known function:
f(Linda) = Moscow
f(Linda) = Moscow
f(Max) = Boston
f(Max) = Boston
f(Kathy) = Hong Kong
f(Kathy) = Hong Kong
f(Peter) = Boston
f(Peter) = Boston
What is the image of S = {Linda, Max} ?
What is the image of S = {Linda, Max} ?
f(S) = {Moscow, Boston}
f(S) = {Moscow, Boston}
What is the image of S = {Max, Peter} ?
What is the image of S = {Max, Peter} ?
f(S) = {Boston}
f(S) = {Boston}
31
Properties of Functions
Properties of Functions
A function f:A
A function f:A
B is said to be
B is said to be one-to-one
one-to-one (or
(or
injective
injective), if and only if
), if and only if

x, y
x, y
A (f(x) = f(y)
A (f(x) = f(y) 
 x = y)
x = y)
In other words:
In other words: f is one-to-one if and only if it
f is one-to-one if and only if it
does not map two distinct elements of A onto the
does not map two distinct elements of A onto the
same element of B.
same element of B.
32
Properties of Functions
Properties of Functions
And again…
And again…
f(Linda) = Moscow
f(Linda) = Moscow
f(Max) = Boston
f(Max) = Boston
f(Kathy) = Hong Kong
f(Kathy) = Hong Kong
f(Peter) = Boston
f(Peter) = Boston
Is f one-to-one?
Is f one-to-one?
No, Max and Peter are
No, Max and Peter are
mapped onto the same
mapped onto the same
element of the image.
element of the image.
g(Linda) = Moscow
g(Linda) = Moscow
g(Max) = Boston
g(Max) = Boston
g(Kathy) = Hong Kong
g(Kathy) = Hong Kong
g(Peter) = New York
g(Peter) = New York
Is g one-to-one?
Is g one-to-one?
Yes, each element is
Yes, each element is
assigned a unique
assigned a unique
element of the image.
element of the image.
33
Properties of Functions
Properties of Functions
How can we prove that a function f is one-to-one?
How can we prove that a function f is one-to-one?
Whenever you want to prove something, first take
Whenever you want to prove something, first take
a look at the relevant definition(s):
a look at the relevant definition(s):

x, y
x, y
A (f(x) = f(y)
A (f(x) = f(y) 
 x = y)
x = y)
Example:
Example:
f:
f:R
R
R
R
f(x) = x
f(x) = x2
2
Disproof by counterexample:
f(3) = f(-3), but 3
f(3) = f(-3), but 3 
 -3, so f is not one-to-one.
-3, so f is not one-to-one.
34
Properties of Functions
Properties of Functions
…
… and yet another example:
and yet another example:
f:
f:R
R
R
R
f(x) = 3x
f(x) = 3x
One-to-one:
One-to-one: 
x, y
x, y
A (f(x) = f(y)
A (f(x) = f(y) 
 x = y)
x = y)
To show:
To show: f(x)
f(x) 
 f(y) whenever x
f(y) whenever x 
 y (
y (indirect proof
indirect proof)
)
x
x 
 y
y
 3x
3x 
 3y
3y
 f(x)
f(x) 
 f(y),
f(y),
so if x
so if x 
 y, then f(x)
y, then f(x) 
 f(y), that is, f is one-to-one.
f(y), that is, f is one-to-one.
35
Properties of Functions
Properties of Functions
A function f:A
A function f:A
B with A,B
B with A,B 
 R is called
R is called strictly
strictly
increasing
increasing, if
, if

x,y
x,y
A (x < y
A (x < y 
 f(x) < f(y)),
f(x) < f(y)),
and
and strictly decreasing
strictly decreasing, if
, if

x,y
x,y
A (x < y
A (x < y 
 f(x) > f(y)).
f(x) > f(y)).
Obviously, a function that is either strictly
Obviously, a function that is either strictly
increasing or strictly decreasing is
increasing or strictly decreasing is one-to-one
one-to-one.
.
36
Properties of Functions
Properties of Functions
A function f:A
A function f:A
B is called
B is called onto
onto, or
, or surjective
surjective, if
, if
and only if for every element b
and only if for every element b
B there is an
B there is an
element a
element a
A with f(a) = b.
A with f(a) = b.
In other words, f is onto if and only if its
In other words, f is onto if and only if its range
range is
is
its
its entire codomain
entire codomain.
.
A function f: A
A function f: A
B is a
B is a one-to-one correspondence
one-to-one correspondence,
,
or a
or a bijection
bijection, if and only if it is both one-to-one
, if and only if it is both one-to-one
and onto.
and onto.
Obviously, if f is a bijection and A and B are finite
Obviously, if f is a bijection and A and B are finite
sets, then |A| = |B|.
sets, then |A| = |B|.
Discrete Structures 37
Properties of Functions
Properties of Functions
Examples:
Examples:
In the following examples, we use the arrow
In the following examples, we use the arrow
representation to illustrate functions f:A
representation to illustrate functions f:A
B.
B.
In each example, the complete sets A and B are
In each example, the complete sets A and B are
shown.
shown.
Discrete Structures 38
Properties of Functions
Properties of Functions
Is f injective?
Is f injective?
No.
No.
Is f surjective?
Is f surjective?
No.
No.
Is f bijective?
Is f bijective?
No.
No.
Linda
Linda
Max
Max
Kathy
Kathy
Peter
Peter
Boston
Boston
New York
New York
Hong Kong
Hong Kong
Moscow
Moscow
Discrete Structures 39
Properties of Functions
Properties of Functions
Is f injective?
Is f injective?
No.
No.
Is f surjective?
Is f surjective?
Yes.
Yes.
Is f bijective?
Is f bijective?
No.
No.
Linda
Linda
Max
Max
Kathy
Kathy
Peter
Peter
Boston
Boston
New York
New York
Hong Kong
Hong Kong
Moscow
Moscow
Paul
Paul
Discrete Structures 40
Properties of Functions
Properties of Functions
Is f injective?
Is f injective?
Yes.
Yes.
Is f surjective?
Is f surjective?
No.
No.
Is f bijective?
Is f bijective?
No.
No.
Linda
Linda
Max
Max
Kathy
Kathy
Peter
Peter
Boston
Boston
New York
New York
Hong Kong
Hong Kong
Moscow
Moscow
L
Lü
übeck
beck
Discrete Structures 41
Properties of Functions
Properties of Functions
Is f injective?
Is f injective?
No! f is not even
No! f is not even
a function!
a function!
Linda
Linda
Max
Max
Kathy
Kathy
Peter
Peter
Boston
Boston
New York
New York
Hong Kong
Hong Kong
Moscow
Moscow
L
Lü
übeck
beck
Discrete Structures 42
Properties of Functions
Properties of Functions
Is f injective?
Is f injective?
Yes.
Yes.
Is f surjective?
Is f surjective?
Yes.
Yes.
Is f bijective?
Is f bijective?
Yes.
Yes.
Linda
Linda
Max
Max
Kathy
Kathy
Peter
Peter
Boston
Boston
New York
New York
Hong Kong
Hong Kong
Moscow
Moscow
L
Lü
übeck
beck
Helena
Helena
Discrete Structures 43
Inversion
Inversion
An interesting property of bijections is that
An interesting property of bijections is that
they have an
they have an inverse function
inverse function.
.
The
The inverse function
inverse function of the bijection f:A
of the bijection f:A
B is
B is
the function f
the function f-1
-1
:B
:B
A with
A with
f
f-1
-1
(b) = a whenever f(a) = b.
(b) = a whenever f(a) = b.
Discrete Structures 44
Inversion
Inversion
Example:
Example:
f(Linda) = Moscow
f(Linda) = Moscow
f(Max) = Boston
f(Max) = Boston
f(Kathy) = Hong Kong
f(Kathy) = Hong Kong
f(Peter) = L
f(Peter) = Lü
übeck
beck
f(Helena) = New York
f(Helena) = New York
Clearly, f is bijective.
Clearly, f is bijective.
The inverse function f
The inverse function f-
-
1
1
is given by:
is given by:
f
f-1
-1
(Moscow) = Linda
(Moscow) = Linda
f
f-1
-1
(Boston) = Max
(Boston) = Max
f
f-1
-1
(Hong Kong) = Kathy
(Hong Kong) = Kathy
f
f-1
-1
(L
(Lü
übeck) = Peter
beck) = Peter
f
f-1
-1
(New York) = Helena
(New York) = Helena
Inversion is only
Inversion is only
possible for bijections
possible for bijections
(= invertible functions)
(= invertible functions)
45
Inversion
Inversion
Linda
Linda
Max
Max
Kathy
Kathy
Peter
Peter
Boston
Boston
New York
New York
Hong Kong
Hong Kong
Moscow
Moscow
L
Lü
übeck
beck
Helena
Helena
f
f
f
f-1
-1
f
f-1
-1
:C
:C
P is no
P is no
function, because
function, because
it is not defined
it is not defined
for all elements of
for all elements of
C and assigns two
C and assigns two
images to the pre-
images to the pre-
image New York.
image New York.
46
Composition
Composition
The
The composition
composition of two functions g:A
of two functions g:A
B and
B and
f:B
f:B
C, denoted by f
C, denoted by f
g, is defined by
g, is defined by
(f
(f
g)(a) = f(g(a))
g)(a) = f(g(a))
This means that
This means that
• first
first, function g is applied to element a
, function g is applied to element a
A,
A,
mapping it onto an element of B,
mapping it onto an element of B,
• then
then, function f is applied to this element of
, function f is applied to this element of
B, mapping it onto an element of C.
B, mapping it onto an element of C.
• Therefore
Therefore, the composite function maps
, the composite function maps
from A to C.
from A to C.
47
Composition
Composition
Example:
Example:
f(x) = 7x – 4, g(x) = 3x,
f(x) = 7x – 4, g(x) = 3x,
f:
f:R
R
R
R, g:
, g:R
R
R
R
(f
(f
g)(5) = f(g(5)) = f(15) = 105 – 4 = 101
g)(5) = f(g(5)) = f(15) = 105 – 4 = 101
(f
(f
g)(x) = f(g(x)) = f(3x) = 21x - 4
g)(x) = f(g(x)) = f(3x) = 21x - 4
48
Composition
Composition
Composition of a function and its inverse:
Composition of a function and its inverse:
(f
(f-1
-1

f)(x) = f
f)(x) = f-1
-1
(f(x)) = x
(f(x)) = x
The composition of a function and its inverse
The composition of a function and its inverse
is the
is the identity function
identity function i(x) = x.
i(x) = x.

More Related Content

PPT
Ch01-2 set theory 123873298738938r3387.ppt
PPT
Mtk3013 chapter 2-3
PPTX
Set Theory DM
PPT
1- Sets gvh kjhk lijh uhkh cgf hjgjhg.ppt
PPT
1- Sets show alot of data about statistic.ppt
PPT
Chapter 2: The set theory in discrete mathematics.ppt
PPS
SET THEORY
PPT
Sets (1).ppt
Ch01-2 set theory 123873298738938r3387.ppt
Mtk3013 chapter 2-3
Set Theory DM
1- Sets gvh kjhk lijh uhkh cgf hjgjhg.ppt
1- Sets show alot of data about statistic.ppt
Chapter 2: The set theory in discrete mathematics.ppt
SET THEORY
Sets (1).ppt

Similar to Lesson 1 &2 -Set Theory and Functions.ppt (20)

PPT
Final maths presentation on sets
PDF
Set theory
PPTX
Sets in Maths (Complete Topic)
PPT
Set Concepts
PPTX
PPT
Introduction to set theory
PDF
Mathematics JEE quick revision notes pdf
PPTX
sets by navneet
PPTX
2.1 Sets
PPTX
CMSC 56 | Lecture 6: Sets & Set Operations
PPTX
sets and their introduction and their exercises.pptx
PPT
Set theory-ppt
PPTX
Set theory for the Data Analysis and AI.pptx
PPTX
PDF
Set
 
PDF
mathematical sets.pdf
PDF
2 》set operation.pdf
PPTX
Materi minggu ke - 3 Himpunan. Untuk mah
PPTX
Unitjhdksjfksdjfksjfhikdlfjiksdfds 1.pptx
PDF
Abstract Algebra Lecture for Mathematics major
Final maths presentation on sets
Set theory
Sets in Maths (Complete Topic)
Set Concepts
Introduction to set theory
Mathematics JEE quick revision notes pdf
sets by navneet
2.1 Sets
CMSC 56 | Lecture 6: Sets & Set Operations
sets and their introduction and their exercises.pptx
Set theory-ppt
Set theory for the Data Analysis and AI.pptx
Set
 
mathematical sets.pdf
2 》set operation.pdf
Materi minggu ke - 3 Himpunan. Untuk mah
Unitjhdksjfksdjfksjfhikdlfjiksdfds 1.pptx
Abstract Algebra Lecture for Mathematics major
Ad

Recently uploaded (20)

PPTX
Seminar Hypertension and Kidney diseases.pptx
PDF
BET Eukaryotic signal Transduction BET Eukaryotic signal Transduction.pdf
PDF
Warm, water-depleted rocky exoplanets with surfaceionic liquids: A proposed c...
PPTX
Microbes in human welfare class 12 .pptx
PDF
Social preventive and pharmacy. Pdf
PPTX
gene cloning powerpoint for general biology 2
PDF
Unit 5 Preparations, Reactions, Properties and Isomersim of Organic Compounds...
PPT
Presentation of a Romanian Institutee 2.
PPTX
TORCH INFECTIONS in pregnancy with toxoplasma
PPTX
INTRODUCTION TO PAEDIATRICS AND PAEDIATRIC HISTORY TAKING-1.pptx
PPTX
GREEN FIELDS SCHOOL PPT ON HOLIDAY HOMEWORK
PPTX
ap-psych-ch-1-introduction-to-psychology-presentation.pptx
PDF
Worlds Next Door: A Candidate Giant Planet Imaged in the Habitable Zone of ↵ ...
PPTX
BODY FLUIDS AND CIRCULATION class 11 .pptx
PDF
Worlds Next Door: A Candidate Giant Planet Imaged in the Habitable Zone of ↵ ...
PDF
Assessment of environmental effects of quarrying in Kitengela subcountyof Kaj...
PPTX
POULTRY PRODUCTION AND MANAGEMENTNNN.pptx
PDF
Packaging materials of fruits and vegetables
PPTX
Presentation1 INTRODUCTION TO ENZYMES.pptx
PPT
Computional quantum chemistry study .ppt
Seminar Hypertension and Kidney diseases.pptx
BET Eukaryotic signal Transduction BET Eukaryotic signal Transduction.pdf
Warm, water-depleted rocky exoplanets with surfaceionic liquids: A proposed c...
Microbes in human welfare class 12 .pptx
Social preventive and pharmacy. Pdf
gene cloning powerpoint for general biology 2
Unit 5 Preparations, Reactions, Properties and Isomersim of Organic Compounds...
Presentation of a Romanian Institutee 2.
TORCH INFECTIONS in pregnancy with toxoplasma
INTRODUCTION TO PAEDIATRICS AND PAEDIATRIC HISTORY TAKING-1.pptx
GREEN FIELDS SCHOOL PPT ON HOLIDAY HOMEWORK
ap-psych-ch-1-introduction-to-psychology-presentation.pptx
Worlds Next Door: A Candidate Giant Planet Imaged in the Habitable Zone of ↵ ...
BODY FLUIDS AND CIRCULATION class 11 .pptx
Worlds Next Door: A Candidate Giant Planet Imaged in the Habitable Zone of ↵ ...
Assessment of environmental effects of quarrying in Kitengela subcountyof Kaj...
POULTRY PRODUCTION AND MANAGEMENTNNN.pptx
Packaging materials of fruits and vegetables
Presentation1 INTRODUCTION TO ENZYMES.pptx
Computional quantum chemistry study .ppt
Ad

Lesson 1 &2 -Set Theory and Functions.ppt

  • 1. Discrete Structures 1 Set Theory Set Theory
  • 2. 2 Learning Outcome; •Describe memberships of sets, including the empty set, using proper notation, and decide whether given items are members and determine the cardinality of a given set. •Describe the relations between sets regarding membership, equality, subset, and proper subset, using proper notation. •Perform the operations of union, intersection, complement, and difference on sets using proper notation. •Recognize when set theory is applicable to real-life situations, solve real-life problems, and communicate real-life problems and solutions to others. Understanding that inputs and outputs are a set of points that satisfy a relation Recognizing that relations can be represented as ordered pairs, tables, mapping diagrams, or graphs Finding the rule that satisfies the inputs and the corresponding outputs of a table
  • 3. Discrete Structures 3 Set Theory Set Theory • Set: Collection of objects (called Set: Collection of objects (called elements elements) ) • a a A A “a is an element of A” “a is an element of A” “a is a member of A” “a is a member of A” • a a A A “a is not an element of A” “a is not an element of A” • A = {a A = {a1 1, a , a2 2, …, a , …, an n} } “A contains a “A contains a1 1, …, a , …, an n” ” • Order of elements is insignificant Order of elements is insignificant • It does not matter how often the same It does not matter how often the same element is listed (repetition doesn’t count). element is listed (repetition doesn’t count).
  • 4. 4 Set Equality Set Equality Sets A and B are equal if and only if they Sets A and B are equal if and only if they contain exactly the same elements. contain exactly the same elements. Examples: Examples: • A = {9, 2, 7, -3}, B = {7, 9, -3, 2} : A = {9, 2, 7, -3}, B = {7, 9, -3, 2} : A = B A = B • A = {dog, cat, horse}, A = {dog, cat, horse}, B = {cat, horse, squirrel, dog} : B = {cat, horse, squirrel, dog} : A A   B B • A = {dog, cat, horse}, A = {dog, cat, horse}, B = {cat, horse, dog, dog} : B = {cat, horse, dog, dog} : A = B A = B
  • 5. 5 Examples for Sets Examples for Sets “ “Standard” Sets: Standard” Sets: • Natural numbers Natural numbers N N = {0, 1, 2, 3, …} = {0, 1, 2, 3, …} • Integers Integers Z Z = {…, -2, -1, 0, 1, 2, …} = {…, -2, -1, 0, 1, 2, …} • Positive Integers Positive Integers Z Z+ + = {1, 2, 3, 4, …} = {1, 2, 3, 4, …} • Real Numbers Real Numbers R R = {47.3, -12, = {47.3, -12,  , …} , …} • Rational Numbers Rational Numbers Q Q = {1.5, 2.6, -3.8, 15, …} = {1.5, 2.6, -3.8, 15, …} (correct definitions will follow) (correct definitions will follow)
  • 6. Discrete Structures 6 Examples for Sets Examples for Sets • A = A =   “empty set/null set” “empty set/null set” • A = {z} A = {z} Note: z Note: z A, but z A, but z   {z} {z} • A = {{b, c}, {c, x, d}} A = {{b, c}, {c, x, d}} set of sets set of sets • A = {{x, y}} A = {{x, y}} Note: {x, y} Note: {x, y}  A, but {x, y} A, but {x, y}   {{x, y}} {{x, y}} • A = {x | P(x)} A = {x | P(x)} “set of all x such that P(x)” “set of all x such that P(x)” P(x) is the P(x) is the membership function membership function of set A of set A  x (P(x) x (P(x)   x x A) A) • A = {x | x A = {x | x  N N   x > 7} = {8, 9, 10, …} x > 7} = {8, 9, 10, …} “set builder notation” “set builder notation”
  • 7. Discrete Structures 7 Examples for Sets Examples for Sets We are now able to define the set of rational We are now able to define the set of rational numbers Q: numbers Q: Q Q = {a/b | a = {a/b | a Z Z   b b Z Z+ + }, }, or or Q Q = {a/b | a = {a/b | a Z Z   b b Z Z   b b 0} 0} And how about the set of real numbers R? And how about the set of real numbers R? R R = {r | r is a real number} = {r | r is a real number} That is the best we can do. It can neither be That is the best we can do. It can neither be defined by enumeration nor builder function. defined by enumeration nor builder function.
  • 8. 8 Subsets Subsets A A   B B “A is a subset of B” “A is a subset of B” A A   B if and only if every element of A is also B if and only if every element of A is also an element of B. an element of B. We can completely formalize this: We can completely formalize this: A A   B B    x (x x (x A A  x x B) B) Examples: Examples: A = {3, 9}, B = {5, 9, 1, 3}, A A = {3, 9}, B = {5, 9, 1, 3}, A   B ? B ? true true A = {3, 3, 3, 9}, B = {5, 9, 1, 3}, A A = {3, 3, 3, 9}, B = {5, 9, 1, 3}, A   B ? B ? false false true true A = {1, 2, 3}, B = {2, 3, 4}, A A = {1, 2, 3}, B = {2, 3, 4}, A   B ? B ?
  • 9. 9 Subsets Subsets Useful rules: Useful rules: • A = B A = B   (A (A   B) B)   (B (B  A) A) • (A (A   B) B)  (B (B   C) C)   A A   C C (see Venn Diagram) (see Venn Diagram) U U A A B B C C
  • 10. 10 Subsets Subsets Useful rules: Useful rules:      A for any set A A for any set A (but (but     A may not hold for any set A) A may not hold for any set A) • A A   A for any set A A for any set A Proper subsets: Proper subsets: A A   B B “A is a proper subset of B” “A is a proper subset of B” A A   B B    x (x x (x A A   x x B) B)    x (x x (x B B   x x A) A) or or A A   B B    x (x x (x A A   x x B) B)    x (x x (x B B  x x A) A)
  • 11. 11 Cardinality of Sets Cardinality of Sets If a set S contains n If a set S contains n distinct distinct elements, n elements, n N N, , we call S a we call S a finite set finite set with with cardinality n cardinality n. . Examples: Examples: A = {Mercedes, BMW, Porsche}, |A| = 3 A = {Mercedes, BMW, Porsche}, |A| = 3 B = {1, {2, 3}, {4, 5}, 6} B = {1, {2, 3}, {4, 5}, 6} |B| = 4 |B| = 4 C =  C =  |C| = 0 |C| = 0 D = { x D = { xN N | x 7000 }  | x 7000 }  |D| = 7001 |D| = 7001 E = { x E = { xN N | x 7000 }  | x 7000 }  E is infinite! E is infinite!
  • 12. 12 The Power Set The Power Set P(A) P(A) “power set of A” (also written as “power set of A” (also written as 2 2A A ) ) P(A) = {B | B P(A) = {B | B   A} A} (contains all subsets of A) (contains all subsets of A) Examples: Examples: A = {x, y, z} A = {x, y, z} P(A) P(A) = { = { , {x}, {y}, {z}, {x, y}, {x, z}, {y, z}, {x, y, z}} , {x}, {y}, {z}, {x, y}, {x, z}, {y, z}, {x, y, z}} A = A =   P(A) = { P(A) = { } } Note: |A| = 0, |P(A)| = 1 Note: |A| = 0, |P(A)| = 1
  • 13. 13 The Power Set The Power Set Cardinality of power sets: Cardinality of power sets: | P(A) | = 2 | P(A) | = 2|A| |A| • Imagine each element in A has an “ Imagine each element in A has an “on on/ /off off” switch ” switch • Each possible switch configuration in A Each possible switch configuration in A corresponds to one subset of A, thus one element corresponds to one subset of A, thus one element in P(A) in P(A) z z z z z z z z z z z z z z z z z z y y y y y y y y y y y y y y y y y y x x x x x x x x x x x x x x x x x x 8 8 7 7 6 6 5 5 4 4 3 3 2 2 1 1 A A • For 3 elements in A, there are For 3 elements in A, there are 2 2 2 2 2 = 8 elements in P(A) 2 = 8 elements in P(A)
  • 14. 14 Cartesian Product Cartesian Product The The ordered n-tuple ordered n-tuple (a (a1 1, a , a2 2, a , a3 3, …, a , …, an n) is an ) is an ordered collection ordered collection of n objects. of n objects. Two ordered n-tuples (a Two ordered n-tuples (a1 1, a , a2 2, a , a3 3, …, a , …, an n) and ) and (b (b1 1, b , b2 2, b , b3 3, …, b , …, bn n) are equal if and only if they ) are equal if and only if they contain exactly the same elements contain exactly the same elements in the same in the same order order, i.e. a , i.e. ai i = b = bi i for 1 for 1   i i   n. n. The The Cartesian product Cartesian product of two sets is defined as: of two sets is defined as: A A B = {(a, b) | a B = {(a, b) | a A A   b b B} B}
  • 15. 15 Cartesian Product Cartesian Product Example: Example: A = {good, bad}, B = {student, prof} A = {good, bad}, B = {student, prof} A A B = { B = { (good, student), (good, student), (good, prof), (good, prof), (bad, student), (bad, student), (bad, prof) (bad, prof)} } (prof, bad) (prof, bad)} } (student, good), (student, good), (prof, good), (prof, good), (student, bad), (student, bad), B A = {  B A = {  Example: Example: A = {x, y}, B = {a, b, c} A = {x, y}, B = {a, b, c} A B = {(x, a), (x, b), (x, c), (y, a), (y, b), (y, c)}  A B = {(x, a), (x, b), (x, c), (y, a), (y, b), (y, c)} 
  • 16. 16 Set Operations Set Operations Union: A Union: A B = {x | x B = {x | x A A   x x B} B} Example: Example: A = {a, b}, B = {b, c, d} A = {a, b}, B = {b, c, d} A A B = {a, b, c, d} B = {a, b, c, d} Intersection: A Intersection: A B = {x | x B = {x | x A A   x x B} B} Example: Example: A = {a, b}, B = {b, c, d} A = {a, b}, B = {b, c, d} A A B = {b} B = {b} Cardinality: |A Cardinality: |A B| = |A| + |B| - |A B| = |A| + |B| - |A B| B|
  • 17. 17 Set Operations Set Operations Two sets are called Two sets are called disjoint disjoint if their intersection if their intersection is empty, that is, they share no elements: is empty, that is, they share no elements: A A B = B =   The The difference difference between two sets A and B between two sets A and B contains exactly those elements of A that are contains exactly those elements of A that are not in B: not in B: A-B = {x | x A-B = {x | x A A   x x B} B} Example: Example: A = {a, b}, B = {b, c, d}, A-B = {a} A = {a, b}, B = {b, c, d}, A-B = {a} Cardinality: |A-B| = |A| - |A Cardinality: |A-B| = |A| - |A B| B|
  • 18. 18 Set Operations Set Operations The The complement complement of a set A contains exactly of a set A contains exactly those elements under consideration that are not those elements under consideration that are not in A: denoted A in A: denoted Ac c (or as in the text) (or as in the text) A Ac c = U-A = U-A Example: Example: U = U = N N, B = {250, 251, 252, …} , B = {250, 251, 252, …} B Bc c = {0, 1, 2, …, 248, 249} = {0, 1, 2, …, 248, 249} A
  • 19. 19 Set Identity Set Identity Table 1 in Section 1.7 shows many useful equations Table 1 in Section 1.7 shows many useful equations – Identity laws, Identity laws, A A   = A = A, , A A U = A U = A – Domination laws, Domination laws, A A U = U U = U, , A A   = =   – Idempotent laws, Idempotent laws, A A A = A A = A, , A A A A = = A A – Complementation law, Complementation law, ( (A Ac c ) )c c = A = A – Commutative laws, Commutative laws, A A B = B = B B A, A A, A B = B B = B A A – Associative laws, Associative laws, A A (B (B   C) = (A C) = (A B) B) C C, … , … – Distributive laws, Distributive laws, A A (B (B C) = (A C) = (A B) B) (A (A C) C), … , … – De Morgan’s laws, De Morgan’s laws, (A (A B) B)c c = = A Ac c  B Bc, c, (A (A B) B)c c = = A Ac c  B Bc c – Absorption laws, Absorption laws, A A (A (A B) = A B) = A, , A A (A (A B) = A B) = A – Complement laws, Complement laws, A A A Ac c = U, A = U, A A Ac c = =  
  • 20. 20 Set Operations Set Operations Method : Membership table Method : Membership table 1 means “x is an element of this set” 1 means “x is an element of this set” 0 means “x is not an element of this set” 0 means “x is not an element of this set” 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 0 1 1 0 1 1 1 1 1 1 1 1 0 0 1 0 1 1 0 1 1 1 1 1 1 1 1 1 0 0 1 0 0 1 0 0 1 1 1 1 1 1 1 1 1 1 0 1 1 0 1 1 0 0 0 0 1 1 0 0 0 0 0 1 0 0 1 0 0 0 1 1 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (A (A B) B)  (A (A C) C) A A C C A A B B A A (B (B C) C) B B C C A B C A B C
  • 22. Discrete Structures 22 Functions Functions A A function function f from a set A to a set B is an f from a set A to a set B is an assignment assignment of of exactly one exactly one element of B to element of B to each each element of A. element of A. We write We write f(a) = b f(a) = b if b is the unique element of B assigned by the if b is the unique element of B assigned by the function f to the element a of A. function f to the element a of A. If f is a function from A to B, we write If f is a function from A to B, we write f: A f: A B B (note: Here, “ (note: Here, “ “ has nothing to do with if… then) “ has nothing to do with if… then)
  • 23. Discrete Structures 23 Functions Functions If f:A If f:A B, we say that A is the B, we say that A is the domain domain of f and B of f and B is the is the codomain codomain of f. of f. If f(a) = b, we say that b is the If f(a) = b, we say that b is the image image of a and a is of a and a is the the pre-image pre-image of b. of b. The The range range of f:A of f:A B is the set of all images of B is the set of all images of all all elements of A. elements of A. We say that f:A We say that f:A B B maps maps A to B. A to B.
  • 24. Discrete Structures 24 Functions Functions Let us take a look at the function f:P Let us take a look at the function f:P C with C with P = {Linda, Max, Kathy, Peter} P = {Linda, Max, Kathy, Peter} C = {Boston, New York, Hong Kong, Moscow} C = {Boston, New York, Hong Kong, Moscow} f(Linda) = Moscow f(Linda) = Moscow f(Max) = Boston f(Max) = Boston f(Kathy) = Hong Kong f(Kathy) = Hong Kong f(Peter) = New York f(Peter) = New York Here, the range of f is C. Here, the range of f is C.
  • 25. 25 Functions Functions Let us re-specify f as follows: Let us re-specify f as follows: f(Linda) = Moscow f(Linda) = Moscow f(Max) = Boston f(Max) = Boston f(Kathy) = Hong Kong f(Kathy) = Hong Kong f(Peter) = Boston f(Peter) = Boston Is f still a function? Is f still a function? yes yes {Moscow, Boston, Hong Kong} {Moscow, Boston, Hong Kong} What is its range? What is its range?
  • 26. 26 Functions Functions Other ways to represent f: Other ways to represent f: Boston Boston Peter Peter Hong Hong Kong Kong Kathy Kathy Boston Boston Max Max Moscow Moscow Linda Linda f(x) f(x) x x Linda Linda Max Max Kathy Kathy Peter Peter Boston Boston New York New York Hong Kong Hong Kong Moscow Moscow
  • 27. 27 Functions Functions If the domain of our function f is large, it is If the domain of our function f is large, it is convenient to specify f with a convenient to specify f with a formula formula, e.g.: , e.g.: f: f:R R R R f(x) = 2x f(x) = 2x This leads to: This leads to: f(1) = 2 f(1) = 2 f(3) = 6 f(3) = 6 f(-3) = -6 f(-3) = -6 … …
  • 28. 28 Functions Functions Let f Let f1 1 and f and f2 2 be functions from A to be functions from A to R R. . Then the Then the sum sum and the and the product product of f of f1 1 and f and f2 2 are also are also functions from A to functions from A to R R defined by: defined by: (f (f1 1 + f + f2 2)(x) = f )(x) = f1 1(x) + f (x) + f2 2(x) (x) (f (f1 1f f2 2)(x) = f )(x) = f1 1(x) f (x) f2 2(x) (x) Example: Example: f f1 1(x) = 3x, f (x) = 3x, f2 2(x) = x + 5 (x) = x + 5 (f (f1 1 + f + f2 2)(x) = f )(x) = f1 1(x) + f (x) + f2 2(x) = 3x + x + 5 = 4x + 5 (x) = 3x + x + 5 = 4x + 5 (f (f1 1f f2 2)(x) = f )(x) = f1 1(x) f (x) f2 2(x) = 3x (x + 5) = 3x (x) = 3x (x + 5) = 3x2 2 + 15x + 15x
  • 29. Discrete Structures 29 Functions Functions We already know that the We already know that the range range of a function of a function f:A f:A B is the set of all images of elements a B is the set of all images of elements a A. A. If we only regard a If we only regard a subset subset S S A, the set of all A, the set of all images of elements s images of elements s S is called the S is called the image image of S. of S. We denote the image of S by f(S): We denote the image of S by f(S): f(S) = {f(s) | s f(S) = {f(s) | s S} S}
  • 30. 30 Functions Functions Let us look at the following well-known function: Let us look at the following well-known function: f(Linda) = Moscow f(Linda) = Moscow f(Max) = Boston f(Max) = Boston f(Kathy) = Hong Kong f(Kathy) = Hong Kong f(Peter) = Boston f(Peter) = Boston What is the image of S = {Linda, Max} ? What is the image of S = {Linda, Max} ? f(S) = {Moscow, Boston} f(S) = {Moscow, Boston} What is the image of S = {Max, Peter} ? What is the image of S = {Max, Peter} ? f(S) = {Boston} f(S) = {Boston}
  • 31. 31 Properties of Functions Properties of Functions A function f:A A function f:A B is said to be B is said to be one-to-one one-to-one (or (or injective injective), if and only if ), if and only if  x, y x, y A (f(x) = f(y) A (f(x) = f(y)   x = y) x = y) In other words: In other words: f is one-to-one if and only if it f is one-to-one if and only if it does not map two distinct elements of A onto the does not map two distinct elements of A onto the same element of B. same element of B.
  • 32. 32 Properties of Functions Properties of Functions And again… And again… f(Linda) = Moscow f(Linda) = Moscow f(Max) = Boston f(Max) = Boston f(Kathy) = Hong Kong f(Kathy) = Hong Kong f(Peter) = Boston f(Peter) = Boston Is f one-to-one? Is f one-to-one? No, Max and Peter are No, Max and Peter are mapped onto the same mapped onto the same element of the image. element of the image. g(Linda) = Moscow g(Linda) = Moscow g(Max) = Boston g(Max) = Boston g(Kathy) = Hong Kong g(Kathy) = Hong Kong g(Peter) = New York g(Peter) = New York Is g one-to-one? Is g one-to-one? Yes, each element is Yes, each element is assigned a unique assigned a unique element of the image. element of the image.
  • 33. 33 Properties of Functions Properties of Functions How can we prove that a function f is one-to-one? How can we prove that a function f is one-to-one? Whenever you want to prove something, first take Whenever you want to prove something, first take a look at the relevant definition(s): a look at the relevant definition(s):  x, y x, y A (f(x) = f(y) A (f(x) = f(y)   x = y) x = y) Example: Example: f: f:R R R R f(x) = x f(x) = x2 2 Disproof by counterexample: f(3) = f(-3), but 3 f(3) = f(-3), but 3   -3, so f is not one-to-one. -3, so f is not one-to-one.
  • 34. 34 Properties of Functions Properties of Functions … … and yet another example: and yet another example: f: f:R R R R f(x) = 3x f(x) = 3x One-to-one: One-to-one:  x, y x, y A (f(x) = f(y) A (f(x) = f(y)   x = y) x = y) To show: To show: f(x) f(x)   f(y) whenever x f(y) whenever x   y ( y (indirect proof indirect proof) ) x x   y y  3x 3x   3y 3y  f(x) f(x)   f(y), f(y), so if x so if x   y, then f(x) y, then f(x)   f(y), that is, f is one-to-one. f(y), that is, f is one-to-one.
  • 35. 35 Properties of Functions Properties of Functions A function f:A A function f:A B with A,B B with A,B   R is called R is called strictly strictly increasing increasing, if , if  x,y x,y A (x < y A (x < y   f(x) < f(y)), f(x) < f(y)), and and strictly decreasing strictly decreasing, if , if  x,y x,y A (x < y A (x < y   f(x) > f(y)). f(x) > f(y)). Obviously, a function that is either strictly Obviously, a function that is either strictly increasing or strictly decreasing is increasing or strictly decreasing is one-to-one one-to-one. .
  • 36. 36 Properties of Functions Properties of Functions A function f:A A function f:A B is called B is called onto onto, or , or surjective surjective, if , if and only if for every element b and only if for every element b B there is an B there is an element a element a A with f(a) = b. A with f(a) = b. In other words, f is onto if and only if its In other words, f is onto if and only if its range range is is its its entire codomain entire codomain. . A function f: A A function f: A B is a B is a one-to-one correspondence one-to-one correspondence, , or a or a bijection bijection, if and only if it is both one-to-one , if and only if it is both one-to-one and onto. and onto. Obviously, if f is a bijection and A and B are finite Obviously, if f is a bijection and A and B are finite sets, then |A| = |B|. sets, then |A| = |B|.
  • 37. Discrete Structures 37 Properties of Functions Properties of Functions Examples: Examples: In the following examples, we use the arrow In the following examples, we use the arrow representation to illustrate functions f:A representation to illustrate functions f:A B. B. In each example, the complete sets A and B are In each example, the complete sets A and B are shown. shown.
  • 38. Discrete Structures 38 Properties of Functions Properties of Functions Is f injective? Is f injective? No. No. Is f surjective? Is f surjective? No. No. Is f bijective? Is f bijective? No. No. Linda Linda Max Max Kathy Kathy Peter Peter Boston Boston New York New York Hong Kong Hong Kong Moscow Moscow
  • 39. Discrete Structures 39 Properties of Functions Properties of Functions Is f injective? Is f injective? No. No. Is f surjective? Is f surjective? Yes. Yes. Is f bijective? Is f bijective? No. No. Linda Linda Max Max Kathy Kathy Peter Peter Boston Boston New York New York Hong Kong Hong Kong Moscow Moscow Paul Paul
  • 40. Discrete Structures 40 Properties of Functions Properties of Functions Is f injective? Is f injective? Yes. Yes. Is f surjective? Is f surjective? No. No. Is f bijective? Is f bijective? No. No. Linda Linda Max Max Kathy Kathy Peter Peter Boston Boston New York New York Hong Kong Hong Kong Moscow Moscow L Lü übeck beck
  • 41. Discrete Structures 41 Properties of Functions Properties of Functions Is f injective? Is f injective? No! f is not even No! f is not even a function! a function! Linda Linda Max Max Kathy Kathy Peter Peter Boston Boston New York New York Hong Kong Hong Kong Moscow Moscow L Lü übeck beck
  • 42. Discrete Structures 42 Properties of Functions Properties of Functions Is f injective? Is f injective? Yes. Yes. Is f surjective? Is f surjective? Yes. Yes. Is f bijective? Is f bijective? Yes. Yes. Linda Linda Max Max Kathy Kathy Peter Peter Boston Boston New York New York Hong Kong Hong Kong Moscow Moscow L Lü übeck beck Helena Helena
  • 43. Discrete Structures 43 Inversion Inversion An interesting property of bijections is that An interesting property of bijections is that they have an they have an inverse function inverse function. . The The inverse function inverse function of the bijection f:A of the bijection f:A B is B is the function f the function f-1 -1 :B :B A with A with f f-1 -1 (b) = a whenever f(a) = b. (b) = a whenever f(a) = b.
  • 44. Discrete Structures 44 Inversion Inversion Example: Example: f(Linda) = Moscow f(Linda) = Moscow f(Max) = Boston f(Max) = Boston f(Kathy) = Hong Kong f(Kathy) = Hong Kong f(Peter) = L f(Peter) = Lü übeck beck f(Helena) = New York f(Helena) = New York Clearly, f is bijective. Clearly, f is bijective. The inverse function f The inverse function f- - 1 1 is given by: is given by: f f-1 -1 (Moscow) = Linda (Moscow) = Linda f f-1 -1 (Boston) = Max (Boston) = Max f f-1 -1 (Hong Kong) = Kathy (Hong Kong) = Kathy f f-1 -1 (L (Lü übeck) = Peter beck) = Peter f f-1 -1 (New York) = Helena (New York) = Helena Inversion is only Inversion is only possible for bijections possible for bijections (= invertible functions) (= invertible functions)
  • 45. 45 Inversion Inversion Linda Linda Max Max Kathy Kathy Peter Peter Boston Boston New York New York Hong Kong Hong Kong Moscow Moscow L Lü übeck beck Helena Helena f f f f-1 -1 f f-1 -1 :C :C P is no P is no function, because function, because it is not defined it is not defined for all elements of for all elements of C and assigns two C and assigns two images to the pre- images to the pre- image New York. image New York.
  • 46. 46 Composition Composition The The composition composition of two functions g:A of two functions g:A B and B and f:B f:B C, denoted by f C, denoted by f g, is defined by g, is defined by (f (f g)(a) = f(g(a)) g)(a) = f(g(a)) This means that This means that • first first, function g is applied to element a , function g is applied to element a A, A, mapping it onto an element of B, mapping it onto an element of B, • then then, function f is applied to this element of , function f is applied to this element of B, mapping it onto an element of C. B, mapping it onto an element of C. • Therefore Therefore, the composite function maps , the composite function maps from A to C. from A to C.
  • 47. 47 Composition Composition Example: Example: f(x) = 7x – 4, g(x) = 3x, f(x) = 7x – 4, g(x) = 3x, f: f:R R R R, g: , g:R R R R (f (f g)(5) = f(g(5)) = f(15) = 105 – 4 = 101 g)(5) = f(g(5)) = f(15) = 105 – 4 = 101 (f (f g)(x) = f(g(x)) = f(3x) = 21x - 4 g)(x) = f(g(x)) = f(3x) = 21x - 4
  • 48. 48 Composition Composition Composition of a function and its inverse: Composition of a function and its inverse: (f (f-1 -1  f)(x) = f f)(x) = f-1 -1 (f(x)) = x (f(x)) = x The composition of a function and its inverse The composition of a function and its inverse is the is the identity function identity function i(x) = x. i(x) = x.