Functions Functions Huynh Tuong Nguyen, Tran Vinh Tan Contents Functions One to one and Onto Functions Sequences and Summation Recursion 4 1 Chapter 4 Functions Discrete Structures for Computing on 13[.]
Trang 1Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
4.1
Chapter 4
Functions
Discrete Structures for Computing on 13 March 2012
Huynh Tuong Nguyen, Tran Vinh TanFaculty of Computer Science and Engineering
University of Technology - VNUHCM
Trang 2Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
4.2
Contents
1 Functions
2 One-to-one and Onto Functions
3 Sequences and Summation
4 Recursion
Trang 3Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
4.3
Introduction
• 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 andcomputer science
• linear, polynomial, exponential, logarithmic,
• Don’t worry! For discrete mathematics, we need tounderstand functions at a basic set theoretic level
Trang 4Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
4.3
Introduction
• 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,
• Don’t worry! For discrete mathematics, we need tounderstand functions at a basic set theoretic level
Trang 5Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
4.3
Introduction
• 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,
• Don’t worry! For discrete mathematics, we need tounderstand functions at a basic set theoretic level
Trang 6Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
4.3
Introduction
• 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,
• Don’t worry! For discrete mathematics, we need to
understand functions at a basic set theoretic level
Trang 7Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
4.4
Function
Definition
Let A and B be nonempty sets A functionf from A to B is an
assignment ofexactly oneelement 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
Trang 8Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
4.4
Function
Definition
Let A and B be nonempty sets A functionf from A to B is an
assignment ofexactly oneelement 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
Trang 9Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
4.4
Function
Definition
Let A and B be nonempty sets A functionf from A to B is an
assignment ofexactly oneelement 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
Trang 10Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
4.4
Function
Definition
Let A and B be nonempty sets A functionf from A to B is an
assignment ofexactly oneelement 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
Trang 11Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
4.4
Function
Definition
Let A and B be nonempty sets A functionf from A to B is an
assignment ofexactly oneelement 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
Trang 12Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
4.4
Function
Definition
Let A and B be nonempty sets A functionf from A to B is an
assignment ofexactly oneelement 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
Trang 13Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
4.4
Function
Definition
Let A and B be nonempty sets A functionf from A to B is an
assignment ofexactly oneelement 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
Trang 14Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
4.4
Function
Definition
Let A and B be nonempty sets A functionf from A to B is an
assignment ofexactly oneelement 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
Trang 15Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
4.4
Function
Definition
Let A and B be nonempty sets A functionf from A to B is an
assignment ofexactly oneelement 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
Trang 16Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
4.4
Function
Definition
Let A and B be nonempty sets A functionf from A to B is an
assignment ofexactly oneelement 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
Trang 17Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
Trang 18Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
Trang 19Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
Trang 20Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
Trang 21Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
4.6
Example
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?
Example
Let f : Z → Z assign the the square of an integer to this integer
What is f (x)? Domain, codomain, range of f ?
• f (x) = x2
• Domain: set of all integers
• Codomain: Set of all integers
• Range of f : {0, 1, 4, 9, }
Trang 22Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
4.6
Example
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?
Example
Let f : Z → Z assign the the square of an integer to this integer
What is f (x)? Domain, codomain, range of f ?
• f (x) = x2
• Domain: set of all integers
• Codomain: Set of all integers
• Range of f : {0, 1, 4, 9, }
Trang 23Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
4.6
Example
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?
Example
Let f : Z → Z assign the the square of an integer to this integer
What is f (x)? Domain, codomain, range of f ?
• f (x) = x2
• Domain: set of all integers
• Codomain: Set of all integers
• Range of f : {0, 1, 4, 9, }
Trang 24Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
4.7
Add and multiply real-valued functions
Definition
Let f1and f2 be functions from A to R Then f1+ f2 and f1f2
are also functions from A to R defined by
(f1+ f2)(x) = f1(x) + f2(x)(f1f2)(x) = f1(x)f2(x)
Example
Let f1(x) = x2 and f2(x) = x − x2 What are the functions
f1+ f2 and f1f2?
(f1+ f2)(x) = f1(x) + f2(x) = x2+ x − x2= x(f1f2)(x) = f1(x)f2(x) = x2(x − x2) = x3− x4
Trang 25Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
4.7
Add and multiply real-valued functions
Definition
Let f1and f2 be functions from A to R Then f1+ f2 and f1f2
are also functions from A to R defined by
(f1+ f2)(x) = f1(x) + f2(x)(f1f2)(x) = f1(x)f2(x)
Trang 26Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
Trang 27Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
Trang 28Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
Trang 29Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
• Is f : Z → Z, f(x) = x2
one-to-one?
Trang 30Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
• Is f : Z → Z, f(x) = x2
one-to-one?
Trang 31Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
• Is f : Z → Z, f(x) = x2
onto?
Trang 32Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
4.11
One-to-one and onto (bijection)
Definition
f : A → B isbijective (one-to-one correspondence)(song ánh) if
and only if f isinjectiveandsurjective
• Let f be the function from{a, bc, d} to {1, 2, 3, 4} with
f (a) = 4, f (b) = 2,
f (c) = 1, f (d) = 3 Is f abijection?
Trang 33Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
4.12
Example
Trang 34Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
4.12
Example
Trang 35Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
4.12
Example
Trang 36Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
4.12
Example
Trang 37Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
4.12
Example
Trang 38Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
A one-to-one correspondence is callinvertible(khả nghịch)
because we can define the inverse of this function
Trang 39Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
Trang 40Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
Trang 41Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
Trang 42Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
Trang 43Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
Trang 44Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
4.16
Function Composition
Definition
Given a pair of functions g : A → B and f : B → C Then the
composition(hợp thành) of f and g, denotedf ◦ g is defined by
f ◦ g : A → C
f ◦ g(a) = f (g(a))
Trang 45Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
4.17
Example
Trang 46Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
4.17
Example
Trang 47Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
4.17
Example
Trang 48Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
4.17
Example
Trang 49Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
(0, 0)(1, 1)(2, 4)(3, 9)
DefinitionLet f be a function from the set A to the set B Thegraphof thefunction f is the set of ordered pairs {(a, b) | a ∈ A and f (a) = b}
Trang 50Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
(0, 0)(1, 1)(2, 4)(3, 9)
DefinitionLet f be a function from the set A to the set B Thegraphof thefunction f is the set of ordered pairs {(a, b) | a ∈ A and f (a) = b}
Trang 51Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
(0, 0)(1, 1)(2, 4)(3, 9)
Definition
Let f be a function from the set A to the set B Thegraphof the
function f is the set of ordered pairs {(a, b) | a ∈ A and f (a) = b}
Trang 52Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
(3b) d−xe = −bxc(4a) bx + nc = bxc + n(4b) dx + ne = dxe + n
Trang 53Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
(3b) d−xe = −bxc(4a) bx + nc = bxc + n(4b) dx + ne = dxe + n
Trang 54Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
(2) x − 1 < bxc ≤ dxe < x + 1(3a) b−xc = −dxe
(3b) d−xe = −bxc(4a) bx + nc = bxc + n(4b) dx + ne = dxe + n
Trang 55Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
(3a) b−xc = −dxe(3b) d−xe = −bxc(4a) bx + nc = bxc + n(4b) dx + ne = dxe + n
Trang 56Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
(3b) d−xe = −bxc
(4a) bx + nc = bxc + n(4b) dx + ne = dxe + n
Trang 57Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
(3b) d−xe = −bxc(4a) bx + nc = bxc + n(4b) dx + ne = dxe + n
Trang 58Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
Trang 59Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
Trang 60Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
Trang 61Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
Trang 62Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
Trang 63Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion
Trang 64Huynh Tuong Nguyen, Tran Vinh Tan
Contents Functions One-to-one and Onto Functions Sequences and Summation Recursion