Professional Documents
Culture Documents
1
A Bit Of Terminology
Relation R on sets A and B: R (A B)
Not all elements of A or B need be in R
So there are four sets that we need to be concerned
about:
A Source set
B Target set
The part of A actually used in R Domain
The part of B actually used in R Range
Domain Range
3
Example Functions
NOTE
4
FunctionsPoints To Note
Some items of the source set might not be mapped, i.e., not in
the domain
Some items of the target set might not be the object of a
mapping, i.e., not in the range
Multiple items of the domain might map to the same item in the
range
A basic subprogram structure in programming languages is the
function
5
Partial And Total Functions
A function is total if mapping is defined for all
items in the source set, i.e., domain=source set
A function is partial if mapping is defined for
some (possibly all) items in the source set
TOTAL PARTIAL
FUNCTION FUNCTION 6
Functions
Function? Why or why not? Total vs Partial?
a. f(x), where x is a student in your class, is the number of instances
of the letter e in xs last name.
b. f(x), where x is a student in a given class, is the student in the class
who comes next after x in alphabetical order by last name.
c. f(x), where x is a bit string, is the number of bits in the string.
d. f(x), where x is an integer, is the last digit of x.
e. f(x), where x is a positive integer, is the next smallest integer.
f. f(x), where x is a bit string, is the position of the first (least
significant) 1 in the bit string.
g. f(x), where x is a person, is the last four digits of xs phone number.
7
8
Identity Function
Given a set , define a function by
(sometimes denoted ) is called the identity
function because it doesnt alter the input in
anyway. Or in other words the output is
identical to the input.
9
Injective Functions
A (partial or total) function is injective if its
inverse is also a function: Notice:
Injective & Inverse
Also called One-to-One functions
INJECTIVE NON-INJECTIVE
FUNCTION FUNCTION 10
One to One
a1A a2A (f (a1) = f(a2)) (a1 = a2)
11
How to Prove 1-1?
Suppose
that is a function defined on a set to a set ,
written as . To show that is 1-1 we need to prove
the following statement is true.
12
How to disprove 1-1?
A function is one-one if the following is true.
13
Proving that a function is 1-1
Let where
Is 1-1?
Remember a function, is 1-1 if the following
is true:
14
15
Proving that a function is 1-1
Let such that
Is 1-1?
16
Surjective Functions
A (partial or total) function is surjective if
domain maps to all of target set:
Also called Onto functions
SURJECTIVE NON-SURJECTIVE
FUNCTION FUNCTION
17
Onto
bB aA (f(a) = b)
18
How to prove Onto
The definition of onto is given by then:
19
How to disprove Onto
The definition of onto is
Is Onto?
Remember that a function, , is onto if the
following is true:
21
22
Proving that a function is Onto
Let such that
Is Onto?
23
Bijective Functions
A (partial or total) function is bijective if it is
injective and surjective:
Also referred to as One-to-One correspondence
TOTAL PARTIAL
BIJECTIVE FUNCTION BIJECTIVE FUNCTION
24
1-1 Correspondence
Let where
Is a 1-1 correspondence?
Let such that
Is a 1-1 correspondence?
25
Inverse: f -1
one-to-one correspondence
26
Compositions Of Functions
There Is A Rule Here
Isnt There?
Definition: (f g)(x) = f(g(x))
g(1) = 5, f(5) = 13
27
Compositions Of Functions
fg
A B C
g f
g(a) f(a)
a f(g(a))
g(a)
(f g)(a)
28
Compositions Of Functions
Let f(x) = 2x+3 Let g(x) = 3x+2
fg
R R R
g f
g(1) f(5)
f(g(1))=13
1
g(1)=5
(f g)(1)
f(g(x)) = 2(3x+2)+3 = 6x+7
29
Compositions Of Functions
Does f(g(x)) = g(f(x))?
30
Composition, 1-1 and Onto
Suppose f: A B and g: B C.
(a) Prove that if g f is onto then g is onto.
31
The Identity function is a 1-1
Correspondence
Given any set let be the identity function
for . Prove that is a 1-1 correspondence.
32
Finding the inverse of a Function
Consider the function such that .
Is this function invertible?
No? Why not?
What about the following function such that
We have that , why is this not sufficient to show that
?
33
Functions Acting on Sets
Definition: If and and , then:
34
Example The Action of a Function on Subsets of a Set
36
37
Cardinality and Functions
Let f be a function from A to B that is 1-1 and onto.
Show that if A and B are finite sets then |A| = |B|.
a1 ba1
f one-to-one a2 ba2 |B| |A|
...
an ban
Thus, |A| = |B|.
a1 ba1
f onto |A| |B|
a2 ba2
...
an ban 38
Countable Sets
41
Problem: How can a new guest be accommodated
in a full infinite hotel? (n) = n+1
Problem: How can an infinity of new guests be
accommodated in a full infinite hotel?
(n) = 2n
Problem: How can an infinity of infinities of new
guests be accommodated in a full infinite hotel?
15
14 10 one-to-one
13 9 6 correspondence
12 8 5 3
11 7 4 2 1
Problem: Are there more integers than positive integers?
+
+ -4 -3 -2 -1 0 1 2 3 4
So | + |<|| ?
Rearrangement:
Establishes 1-1
correspondence
: +
+ 1 2 3 4 5 6 7 8 9
| + |=||
Problem: Are there more rationals than positive integers?
7 7 7 7 7 7 7 7
+ 7 1 2 3 4 5 6 7 8
+ 6 6 6 6 6 6 6 556
6 1 2 3 4 5 6 7 8
So | + |<|
| ? 517 518 519 520 215 5 5 5
5 1 2 3 4 5 6 7 8
16 15 14
Dovetailing: 4 4 4 134 224 4 4 4
4 1 2 3 4 5 6 7 8
Establishes 1-1
correspondence 3 3 5 3 6 73 123 233 283 3 3
: + 1 2 3 4 5 6 7 8
24 32 82 112 242 272 2 2
| + |=|| 2 1 2 3 4 5 6 7 8
11 21 91 101 251 261 1 1
1 1 2 3 4 5 6 7 8
1 2 3 4 5 6 7 8
Problem: Are there more rationals than positive integers?
7 24 7 25 726 7 27 7 28 7 29 7 397
+ 7 1 2 3 4 5 6 7 8
+ 623 6 6 6 22 6 6 30 6 6
6 1 2 3 4 5 6 7 8 s !
So | + |<|
512 513 514 515 5 215 315 385 a te
| ? 5 1 2 3 4 5 6 7 li8c
Dovetailing: 411 4 104 4 164 u p
4 324
Establishes 1-1
4 1 2 3 4
g5d 6 7
4
8
correspondence 3 34 di n
3 5 3 9 3 173 3 333 373
: + 1 2 o i3 4 5 6 7 8
23 Av 2 62 2 182 2 342 2
| + |=|| 2 1 2 3 4 5 6 7 8
11 21 71 8 1 191 201 351 361
1 1 2 3 4 5 6 7 8
1 2 3 4 5 6 7 8
Theorem: There are more reals than rationals / integers.
Proof [Cantor]: Assume a 1-1 correspondence : +
i.e., there exists a table containing all of and all of :
+ Di
(1) = 3 . 1 4 ag1 5 9 2 6 5 3 f!
o
(2) = 1 . 0 0 0 n0a 0 0 0 0 0 o
ro
(3) = 2 . 7 1 8 2 liz8 1 8 2 8 p
a
(4) = 1 . 4 1 4 2 1 ti3 5 6n 2 c e
(5) = 0 . 3 3 3 3 3 3 n3ste3 3
o
x i
... ...
-e
X = 0 . 2 1 9 3 o4n ...
But X is missing from ourN table! X (k)k +
not a 1-1 correspondence
contradiction
is not countable!
There are more reals than rationals / integers!
Problem 1: Why not just insert X into the table?
Problem 2: What if X=0.999 but 1.000 is already in table?
+ Di
(1) = 3 . 1 4 ag1 5 9 2 6 5 3 f!
o
1 . 0 0 0 n0a 0 0 0 0 0 o
(2) =
ro
(3) = 2 . 7 1 8 2 liz8 1 8 2 8 p
(4) = a
1 . 4 1 4 2 1 ti3 5 6n 2 c e
(5) = 0 . 3 3 3 3 3 3 n3ste3 3
o
x i
... ...
-e
X = 0 . 2 1 9 3 o4n ...
Table with X inserted N will have X still missing!
Inserting X (or any number of Xs) will not help!
To enforce unique table values, we can avoid
using 9s and 0s in X.