CS 2336 Discrete Mathematics: Sets, Functions, and Relations: Part II
CS 2336 Discrete Mathematics: Sets, Functions, and Relations: Part II
Discrete Mathematics
Lecture 10
Sets, Functions, and Relations: Part II
1
Outline
• What is a Function ?
• Types of Functions
• Floor and Ceiling Functions
• An Interesting Result
2
What is a Function ?
• Suppose that each student in a mathematics class
will be assigned a grade A, B, C, D, F
• Let us say the grades for the students are :
Nobita (F), Shizuka (A), Takeshi (F), Suneo (B)
A
F
3
What is a Function ?
• The previous is an example of a function
Let A and B be two nonempty sets
A function f from A to B is an assignment of
exactly one item of B to each item of A.
This relationship is denoted by
f:AB
We write f(a) = b if b is the unique item of B
assigned by f to the item a of A, and we say
b is the image of a
4
Terminology
• Function is also called mapping or transformation
• Given a function f : A B
A is called the domain
B is called the codomain
The subset of B that contains all images,
{ b | f(a) = b for some a in A },
is called the range
5
Test Your Understanding
A
6
Types of Functions
A function from A to B is said to be one-to-one,
or injective, or an injection, if no two items of A
have the same image in B
7
Types of Functions
A function from A to B is said to be onto, or
surjective, or a surjection, if every item of B is
the image of at least one item of A
Equivalently, when range equals to codomain
8
Types of Functions
A function is said to be one-to-one onto, or
bijective, or a bijection, if it is both one-to-one
and onto
9
Some Counting Problems
• Let A and B be two sets, with |A| = m, |B| = n
• Problems :
1. How many distinct injections from A to B ?
2. How many distinct surjections from A to B ?
3. How many distinct bijections from A to B ?
10
Floor and Ceiling Functions
• Let x be a real number
The floor function of x, denoted by x , is the
largest integer that is smaller than or equal to x
The ceiling function of x, denoted by x , is the
smallest integer that is larger than or equal to x
• Examples:
0.5 = 0, 0.5 = 1, –1.1 = –2, –1.1 = –1
7 = 7, 7 = 7, –4 = –4, –4 = –4
11
Floor and Ceiling Functions
• Some useful properties ( n is an integer ):
1. x=n n x n+1
2. x=n n–1 x n
3. x=n x–1 n x
4. x=n x n x+1
5. –x = – x
6. –x = – x
12
Challenges
• Which of the following are correct ?
1. x + n = x + n, where n is an integer
2. x + y = x + y
3. 2x = x + x + 0.5
14
Answers to the Challenges
• 3 is correct.
Proof : Consider the value { x } = x – x . Then,
LHS = 2 x + 2 { x } = 2 x + 2 { x }
There are two cases :
(i) 0 { x } 0.5 0 2{ x } 1
LHS = 2 x = RHS
(ii) 0.5 { x } 1 1 2{ x } 2
LHS = 2 x + 1 = RHS
15
Answers to the Challenges
• To find the maximum integer k with kz n,
such a k must be the maximum integer with
kz n + 1, or k (n + 1) / z
• There are two cases :
(i) if (n + 1) / z is not an integer
k = (n + 1) / z = (n + 1) / z – 1
(ii) if (n + 1) / z is an integer
k = (n + 1) / z – 1 = (n + 1) / z – 1
So it is always true that k = (n + 1) / z – 1
16
An Interesting Result
• For a positive real number z, we define the
spectrum of z,
Spec(z) = { z , 2z , 3z 4z , … }
• Examples :
Spec( 2 ) = { 1, 2, 4, 5, 7, 8, 9, 11, 12, 14, … }
Spec( 2+ 2 ) = { 3, 6, 10, 13, 17, 20, … }
17
An Interesting Result
• Examples :
Let = ( 1 + 5 ) / 2 = 1.6180339887…
= golden ratio
Then 2 = + 1 = 2.6180339887…
18
An Interesting Result
• In general, we have the following theorem :
Let and be two positive irrational numbers
such that
1 / + 1 / = 1.
Then, the spectrums
Spec() and Spec()
cover all the positive integers, and they have no
common items
19