Functions
Huynh Tuong Nguyen,
Tran Huong Lan
Chapter 4
Functions
Discrete Structures for Computing on 13 March 2012
Contents
One-to-one and Onto
Functions
Sequences and
Summation
Recursion
Huynh Tuong Nguyen, Tran Huong Lan
Faculty of Computer Science and Engineering
University of Technology - VNUHCM
4.1
Contents
Functions
Huynh Tuong Nguyen,
Tran Huong Lan
1 One-to-one and Onto Functions
Contents
One-to-one and Onto
Functions
Sequences and
Summation
2 Sequences and Summation
Recursion
3 Recursion
4.2
Introduction
Functions
Huynh Tuong Nguyen,
Tran Huong Lan
• Each student is assigned a grade from set
{0, 0.1, 0.2, 0.3, . . . , 9.9, 10.0} at the end of semester
Contents
One-to-one and Onto
Functions
Sequences and
Summation
Recursion
4.3
Introduction
Functions
Huynh Tuong Nguyen,
Tran Huong Lan
• Each student is assigned a grade from set
{0, 0.1, 0.2, 0.3, . . . , 9.9, 10.0} at the end of semester
• Function is extremely important in mathematics and
computer science
Contents
One-to-one and Onto
Functions
Sequences and
Summation
Recursion
4.3
Introduction
Functions
Huynh Tuong Nguyen,
Tran Huong Lan
• Each student is assigned a grade from set
{0, 0.1, 0.2, 0.3, . . . , 9.9, 10.0} at the end of semester
• Function is extremely important in mathematics and
computer science
• linear, polynomial, exponential, logarithmic,...
Contents
One-to-one and Onto
Functions
Sequences and
Summation
Recursion
4.3
Introduction
Functions
Huynh Tuong Nguyen,
Tran Huong Lan
• Each student is assigned a grade from set
{0, 0.1, 0.2, 0.3, . . . , 9.9, 10.0} at the end of semester
• Function is extremely important in mathematics and
computer science
• linear, polynomial, exponential, logarithmic,...
Contents
One-to-one and Onto
Functions
Sequences and
Summation
Recursion
• Don’t worry! For discrete mathematics, we need to
understand functions at a basic set theoretic level
4.3
Function
Definition
Functions
Huynh Tuong Nguyen,
Tran Huong Lan
Let A and B be nonempty sets. A function f from A to B is an
assignment of exactly one element of B to each element of A.
Contents
One-to-one and Onto
Functions
Sequences and
Summation
Recursion
4.4
Function
Definition
Functions
Huynh Tuong Nguyen,
Tran Huong Lan
Let A and B be nonempty sets. A function f from A to B is an
assignment of exactly one element of B to each element of A.
• f :A→B
Contents
One-to-one and Onto
Functions
Sequences and
Summation
Recursion
4.4
Function
Definition
Functions
Huynh Tuong Nguyen,
Tran Huong Lan
Let A and B be nonempty sets. A function f from A to B is an
assignment of exactly one element of B to each element of A.
• f :A→B
• A: domain (miền xác định) of f
Contents
One-to-one and Onto
Functions
Sequences and
Summation
Recursion
4.4
Function
Definition
Functions
Huynh Tuong Nguyen,
Tran Huong Lan
Let A and B be nonempty sets. A function f from A to B is an
assignment of exactly one element of B to each element of A.
• f :A→B
• A: domain (miền xác định) of f
• B: codomain (miền giá trị) of f
Contents
One-to-one and Onto
Functions
Sequences and
Summation
Recursion
4.4
Function
Definition
Functions
Huynh Tuong Nguyen,
Tran Huong Lan
Let A and B be nonempty sets. A function f from A to B is an
assignment of exactly one element of B to each element of A.
•
•
•
•
f :A→B
A: domain (miền xác định) of f
B: codomain (miền giá trị) of f
For each a ∈ A, if f (a) = b
Contents
One-to-one and Onto
Functions
Sequences and
Summation
Recursion
4.4
Function
Definition
Functions
Huynh Tuong Nguyen,
Tran Huong Lan
Let A and B be nonempty sets. A function f from A to B is an
assignment of exactly one element of B to each element of A.
•
•
•
•
f :A→B
A: domain (miền xác định) of f
B: codomain (miền giá trị) of f
For each a ∈ A, if f (a) = b
• b is an image (ảnh) of a
Contents
One-to-one and Onto
Functions
Sequences and
Summation
Recursion
4.4
Function
Definition
Functions
Huynh Tuong Nguyen,
Tran Huong Lan
Let A and B be nonempty sets. A function f from A to B is an
assignment of exactly one element of B to each element of A.
•
•
•
•
f :A→B
A: domain (miền xác định) of f
B: codomain (miền giá trị) of f
For each a ∈ A, if f (a) = b
• b is an image (ảnh) of a
• a is pre-image (nghịch ảnh) of f (a)
Contents
One-to-one and Onto
Functions
Sequences and
Summation
Recursion
4.4
Function
Definition
Functions
Huynh Tuong Nguyen,
Tran Huong Lan
Let A and B be nonempty sets. A function f from A to B is an
assignment of exactly one element of B to each element of A.
•
•
•
•
f :A→B
A: domain (miền xác định) of f
B: codomain (miền giá trị) of f
For each a ∈ A, if f (a) = b
• b is an image (ảnh) of a
• a is pre-image (nghịch ảnh) of f (a)
Contents
One-to-one and Onto
Functions
Sequences and
Summation
Recursion
• Range of f is the set of all images of elements of A
4.4
Function
Definition
Functions
Huynh Tuong Nguyen,
Tran Huong Lan
Let A and B be nonempty sets. A function f from A to B is an
assignment of exactly one element of B to each element of A.
•
•
•
•
f :A→B
A: domain (miền xác định) of f
B: codomain (miền giá trị) of f
For each a ∈ A, if f (a) = b
• b is an image (ảnh) of a
• a is pre-image (nghịch ảnh) of f (a)
Contents
One-to-one and Onto
Functions
Sequences and
Summation
Recursion
• Range of f is the set of all images of elements of A
• f maps (ánh xạ) A to B
4.4
Functions
Function
Huynh Tuong Nguyen,
Tran Huong Lan
Definition
Let A and B be nonempty sets. A function f from A to B is an
assignment of exactly one element of B to each element of A.
•
•
•
•
f :A→B
A: domain (miền xác định) of f
B: codomain (miền giá trị) of f
For each a ∈ A, if f (a) = b
Contents
One-to-one and Onto
Functions
• b is an image (ảnh) of a
• a is pre-image (nghịch ảnh) of f (a)
Sequences and
Summation
Recursion
• Range of f is the set of all images of elements of A
• f maps (ánh xạ) A to B
f
a
b = f (a)
A
B
f
4.4
Example
Functions
Huynh Tuong Nguyen,
Tran Huong Lan
Contents
One-to-one and Onto
Functions
Sequences and
Summation
Recursion
4.5
Functions
Example
Huynh Tuong Nguyen,
Tran Huong Lan
Example:
Contents
One-to-one and Onto
Functions
Sequences and
Summation
Recursion
4.5
Functions
Example
Huynh Tuong Nguyen,
Tran Huong Lan
Example:
• y is an image of d
Contents
One-to-one and Onto
Functions
Sequences and
Summation
Recursion
4.5
Functions
Example
Huynh Tuong Nguyen,
Tran Huong Lan
Example:
• y is an image of d
• c is a pre-image of z
Contents
One-to-one and Onto
Functions
Sequences and
Summation
Recursion
4.5
Example
Functions
Huynh Tuong Nguyen,
Tran Huong Lan
Example
What are domain, codomain, and range of the function that
assigns grades to students includes: student A: 5, B: 3.5, C: 9, D:
5.2, E: 4.9?
Contents
One-to-one and Onto
Functions
Example
Sequences and
Summation
Let f : Z → Z assign the the square of an integer to this integer.
What is f (x)? Domain, codomain, range of f ?
Recursion
4.6
Example
Functions
Huynh Tuong Nguyen,
Tran Huong Lan
Example
What are domain, codomain, and range of the function that
assigns grades to students includes: student A: 5, B: 3.5, C: 9, D:
5.2, E: 4.9?
Contents
One-to-one and Onto
Functions
Example
Sequences and
Summation
Let f : Z → Z assign the the square of an integer to this integer.
What is f (x)? Domain, codomain, range of f ?
Recursion
• f (x) = x2
• Domain: set of all integers
• Codomain: Set of all integers
• Range of f : {0, 1, 4, 9, . . .}
4.6
Example
Functions
Huynh Tuong Nguyen,
Tran Huong Lan
Example
What are domain, codomain, and range of the function that
assigns grades to students includes: student A: 5, B: 3.5, C: 9, D:
5.2, E: 4.9?
Contents
One-to-one and Onto
Functions
Example
Sequences and
Summation
Let f : Z → Z assign the the square of an integer to this integer.
What is f (x)? Domain, codomain, range of f ?
Recursion
• f (x) = x2
• Domain: set of all integers
• Codomain: Set of all integers
• Range of f : {0, 1, 4, 9, . . .}
4.6
Add and multiply real-valued functions
Functions
Huynh Tuong Nguyen,
Tran Huong Lan
Definition
Let f1 and f2 be functions from A to R. Then f1 + f2 and f1 f2
are also functions from A to R defined by
(f1 + f2 )(x) = f1 (x) + f2 (x)
(f1 f2 )(x) = f1 (x)f2 (x)
Contents
One-to-one and Onto
Functions
Sequences and
Summation
Recursion
4.7
Add and multiply real-valued functions
Functions
Huynh Tuong Nguyen,
Tran Huong Lan
Definition
Let f1 and f2 be functions from A to R. Then f1 + f2 and f1 f2
are also functions from A to R defined by
(f1 + f2 )(x) = f1 (x) + f2 (x)
(f1 f2 )(x) = f1 (x)f2 (x)
Contents
One-to-one and Onto
Functions
Sequences and
Summation
Recursion
Example
Let f1 (x) = x2 and f2 (x) = x − x2 . What are the functions
f1 + f2 and f1 f2 ?
(f1 + f2 )(x) = f1 (x) + f2 (x) = x2 + x − x2 = x
(f1 f2 )(x) = f1 (x)f2 (x) = x2 (x − x2 ) = x3 − x4
4.7