0% found this document useful (0 votes)
7 views46 pages

L5 Discrete Math

Uploaded by

vnjie
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views46 pages

L5 Discrete Math

Uploaded by

vnjie
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 46

Lecture 5

Functions. Domain. Range. One-to-one and onto


functions. Inverses and Composition.

A. B. Dauletiyarova

email: [email protected]

A. B. Dauletiyarova Lecture 5
HW

Book: Kenneth H. Rosen, Discrete Mathematics and Its


Applications, 7th Edition.

HW 5
Section 2.3: 1-45 (even numbers), p. 152-154;

Note. Students must submit their homework to the lecturer in paper


form (green school copybook or A4 paper) at each lecture, meaning the
deadline for each assignment is the following week’s lecture.

A. B. Dauletiyarova Lecture 5
Functions

Definition 1. 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. We write f (a) = b if b is the unique element of B
assigned by the function f to the element a of A. If f is a function
from A to B, we write
f : A → B.

Remark: Functions are sometimes also called mappings or


transformations.

A. B. Dauletiyarova Lecture 5
Functions

Definition 2. If f is a function from A to B, we say that A is


the domain of f and B is the codomain of f . If f (a) = b, we say
that b is the image of a and a is a preimage of b. The range, or
image, of f is the set of all images of elements of A. Also, if f is a
function from A to B, we say that f maps A to B.

A. B. Dauletiyarova Lecture 5
Examples

Example 1. Determine whether f is a function from R to R


if
a) f (x) = 1/x

b) f (x) = x
c) f (x) = ±(x 2 + 1)

A. B. Dauletiyarova Lecture 5
Examples

Example 1. Determine whether f is a function from R to R


if
a) f (x) = 1/x

b) f (x) = x
c) f (x) = ±(x 2 + 1)

Solution: a) This is not a function. The expression 1/x is


meaningless for x = 0, which is one of the elements in the domain;
thus the ”rule” is no rule at all. In other words, f (0) is not defined.

A. B. Dauletiyarova Lecture 5
Examples

Example 1. Determine whether f is a function from R to R


if
a) f (x) = 1/x

b) f (x) = x
c) f (x) = ±(x 2 + 1)

Solution: a) This is not a function. The expression 1/x is


meaningless for x = 0, which is one of the elements in the domain;
thus the ”rule” is no rule at all. In other words,
√ f (0) is not defined.
b) This is not a function. Things like −1 are undefined (or,
at best, are complex numbers).

A. B. Dauletiyarova Lecture 5
Examples

Example 1. Determine whether f is a function from R to R


if
a) f (x) = 1/x

b) f (x) = x
c) f (x) = ±(x 2 + 1)

Solution: a) This is not a function. The expression 1/x is


meaningless for x = 0, which is one of the elements in the domain;
thus the ”rule” is no rule at all. In other words,
√ f (0) is not defined.
b) This is not a function. Things like −1 are undefined (or,
at best, are complex numbers).
c) This is not a function. The ”rule” for f is ambiguous. We
must have f (x) defined uniquely, but here there are two values
associated with every x, the positive square root and the negative
square root of x 2 + 1.

A. B. Dauletiyarova Lecture 5
Examples

Example 2. Determine whether f is a function from Z to R


if
a) f (n) = ±n.

b) f (n) = n2 + 1
c) f (n) = 1/(n2 − 4).

A. B. Dauletiyarova Lecture 5
Examples

Example 2. Determine whether f is a function from Z to R


if
a) f (n) = ±n.

b) f (n) = n2 + 1
c) f (n) = 1/(n2 − 4).

a) This is not a function because the rule is not well-defined.


We do not know whether f (3) = 3 or f (3) = −3. For a function, it
cannot be both at the same time.

A. B. Dauletiyarova Lecture 5
Examples

Example 2. Determine whether f is a function from Z to R


if
a) f (n) = ±n.

b) f (n) = n2 + 1
c) f (n) = 1/(n2 − 4).

a) This is not a function because the rule is not well-defined.


We do not know whether f (3) = 3 or f (3) = −3. For a function, it
cannot be both at the same time. √
b) This is a function. For all integers n, n2 + 1 is a
well-defined real number.

A. B. Dauletiyarova Lecture 5
Examples

Example 2. Determine whether f is a function from Z to R


if
a) f (n) = ±n.

b) f (n) = n2 + 1
c) f (n) = 1/(n2 − 4).

a) This is not a function because the rule is not well-defined.


We do not know whether f (3) = 3 or f (3) = −3. For a function, it
cannot be both at the same time. √
b) This is a function. For all integers n, n2 + 1 is a
well-defined real number.
c) This is not a function with domain Z , since for n = 2 (and
also for n = −2) the value of f (n) is not defined by the given rule.
In other words, f (2) and f (−2) are not specified since division by 0
makes no sense.

A. B. Dauletiyarova Lecture 5
Examples

Example 3. Let f : Z → Z assign the square of an integer to


this integer. Then, f (x) = x 2 , where the domain of f is the set of
all integers, the codomain of f is the set of all integers, and the
range of f is the set of all integers that are perfect squares,
namely, {0, 1, 4, 9, ...}.

A. B. Dauletiyarova Lecture 5
Definition 3. Let f be a function from A to B and let S be a
subset of A. The image of S under the function f is the subset of
B that consists of the images of the elements of S. We denote the
image of S by f (S), so

f (S) = {t | ∃s ∈ S(t = f (s))}.

We also use the shorthand {f (s) | s ∈ S} to denote this set.

A. B. Dauletiyarova Lecture 5
Example

Example 4. Let A = {a, b, c, d, e} and B = {1, 2, 3, 4} with


f (a) = 2, f (b) = 1, f (c) = 4, f (d) = 1, and f (e) = 1. The image
of the subset S = {b, c, d} is the set f (S) = {1, 4}.

A. B. Dauletiyarova Lecture 5
One-to-One Functions

Definition 4. A function f is said to be one-to-one, or an


injunction, if and only if f (a) = f (b) implies that a = b for all a
and b in the domain of f . A function is said to be injective if it is
one-to-one.

Remark: We can express that f is one-to-one using


quantifiers as ∀a∀b(f (a) = f (b) → a = b) or equivalently
∀a∀b(a ̸= b → f (a) ̸= f (b)), where the universe of discourse is the
domain of the function.

A. B. Dauletiyarova Lecture 5
Examples

Example 5. (i) Determine whether the function f from


{a, b, c, d} to {1, 2, 3, 4, 5} with f (a) = 4, f (b) = 5, f (c) = 1, and
f (d) = 3 is one-to-one.

Solution: The function f is one-to-one because f takes on


different values at the four elements of its domain.

A. B. Dauletiyarova Lecture 5
Examples

(ii) Determine whether the function f (x) = x 2 from the set


of integers to the set of integers is one-to-one.

Solution: The function f (x) = x 2 is not one-to-one because,


for instance, f (1) = f (−1) = 1, but 1 ̸= −1.
Note that the function f (x) = x 2 with its domain restricted
+
to Z is one-to-one.

A. B. Dauletiyarova Lecture 5
Examples

(ii) Determine whether the function f (x) = x 2 from the set


of integers to the set of integers is one-to-one.

Solution: The function f (x) = x 2 is not one-to-one because,


for instance, f (1) = f (−1) = 1, but 1 ̸= −1.
Note that the function f (x) = x 2 with its domain restricted
+
to Z is one-to-one.

(iii) Determine whether the function f (x) = x + 1 from the


set of real numbers to itself is one-to-one.

Solution: The function f (x) = x + 1 is a one-to-one function.


To demonstrate this, note that

x + 1 ̸= y + 1 when x ̸= y .

A. B. Dauletiyarova Lecture 5
Onto Functions

Definition 5. A function f from A to B is called onto, or a


surjection, if and only if for every element b ∈ B there is an
element a ∈ A with f (a) = b. A function f is called surjective if it
is onto.

Remark: A function f is onto if ∀y ∃x(f (x) = y ), where the


domain for x is the domain of the function and the domain for y is
the codomain of the function.

A. B. Dauletiyarova Lecture 5
Examples

Example 6. (i) Let f be the function from {a, b, c, d} to


{1, 2, 3} defined by f (a) = 3, f (b) = 2, f (c) = 1, and f (d) = 3. Is
f an onto function?

Solution: Because all three elements of the codomain are


images of elements in the domain, we see that f is onto. Note that
if the codomain were {1, 2, 3, 4}, then f would not be onto.

A. B. Dauletiyarova Lecture 5
Examples

(ii) Is the function f (x) = x 2 from the set of integers to the


set of integers onto?

Solution: The function f is not onto because there is no


integer x with x 2 = −1, for instance.

A. B. Dauletiyarova Lecture 5
Examples

(ii) Is the function f (x) = x 2 from the set of integers to the


set of integers onto?

Solution: The function f is not onto because there is no


integer x with x 2 = −1, for instance.

(iii) Is the function f (x) = x + 1 from the set of integers to


the set of integers onto?

Solution: This function is onto, because for every integer y


there is an integer x such that f (x) = y . To see this, note that
f (x) = y if and only if x + 1 = y , which holds if and only if
x = y − 1.

A. B. Dauletiyarova Lecture 5
One-to-one correspondence Functions

Definition 6. The function f is a one-to-one correspondence,


or a bijection, if it is both one-to-one and onto. We also say that
such a function is bijective.

A. B. Dauletiyarova Lecture 5
Example

Example 7. Let f be the function from {a, b, c, d} to


{1, 2, 3, 4} with f (a) = 4, f (b) = 2, f (c) = 1, and f (d) = 3. Is f
a bijection?

Solution: The function f is one-to-one and onto. It is


one-to-one because no two values in the domain are assigned the
same function value. It is onto because all four elements of the
codomain are images of elements in the domain. Hence, f is a
bijection.

A. B. Dauletiyarova Lecture 5
Examples of Different Types of Correspondences

A. B. Dauletiyarova Lecture 5
Examples of Different Types of Correspondences

a) one-to-one but not onto,

A. B. Dauletiyarova Lecture 5
Examples of Different Types of Correspondences

a) one-to-one but not onto,


b) onto but not one-to-one,

A. B. Dauletiyarova Lecture 5
Examples of Different Types of Correspondences

a) one-to-one but not onto,


b) onto but not one-to-one,
c) both one-to-one and onto,

A. B. Dauletiyarova Lecture 5
Examples of Different Types of Correspondences

a) one-to-one but not onto,


b) onto but not one-to-one,
c) both one-to-one and onto,
d) neither one-to-one nor onto.

A. B. Dauletiyarova Lecture 5
Examples of Different Types of Correspondences

a) one-to-one but not onto,


b) onto but not one-to-one,
c) both one-to-one and onto,
d) neither one-to-one nor onto.
e) not a function, because it sends an element to two
different elements.

A. B. Dauletiyarova Lecture 5
Identity Function

Definition 7. Let A be a set. The identity function on A is


the function ιA : A → A, where

ιA (x) = x

for all x ∈ A.
In other words, the identity function ιA is the function that
assigns each element to itself. The function ιA is one-to-one and
onto, so it is a bijection.

A. B. Dauletiyarova Lecture 5
Increasing and Decreasing Functions

Definition 8. A function f whose domain and codomain are


subsets of the set of real numbers is called increasing if
f (x) ≤ f (y ), and strictly increasing if f (x) < f (y ), whenever
x < y and x and y are in the domain of f . Similarly, f is called
decreasing if f (x) ≥ f (y ), and strictly decreasing if f (x) > f (y ),
whenever x < y and x and y are in the domain of f .

Remark:
A function f is increasing if ∀x∀y (x < y → f (x) ≤ f (y )),
strictly increasing if ∀x∀y (x < y → f (x) < f (y )),
decreasing if ∀x∀y (x < y → f (x) ≥ f (y )),
and strictly decreasing if ∀x∀y (x < y → f (x) > f (y )), where
the universe of discourse is the domain of f .

A. B. Dauletiyarova Lecture 5
Inverse Functions
Definition 9. Let f be a one-to-one correspondence from the
set A to the set B. The inverse function of f is the function that
assigns to an element b belonging to B the unique element a in A
such that f (a) = b. The inverse function of f is denoted by f −1 .
Hence, f −1 (b) = a when f (a) = b.

A. B. Dauletiyarova Lecture 5
If a function f is not a one-to-one correspondence, we cannot
define an inverse function of f . When f is not a one-to-one
correspondence, either it is not one-to-one or it is not onto. If f is
not one-to-one, some element b in the codomain is the image of
more than one element in the domain. If f is not onto, for some
element b in the codomain, no element a in the domain exists for
which f (a) = b. Consequently, if f is not a one-to-one
correspondence, we cannot assign to each element b in the
codomain a unique element a in the domain such that f (a) = b
(because for some b there is either more than one such a or no
such a).
A one-to-one correspondence is called invertible because we
can define an inverse of this function. A function is not invertible if
it is not a one-to-one correspondence, because the inverse of such
a function does not exist.

A. B. Dauletiyarova Lecture 5
Examples
Example 8. (i) Let f be the function from {a, b, c} to
{1, 2, 3} such that f (a) = 2, f (b) = 3, and f (c) = 1. Is f
invertible, and if it is, what is its inverse?

Solution: The function f is invertible because it is a


one-to-one correspondence. The inverse function f −1 reverses the
correspondence given by f , so f −1 (1) = c, f −1 (2) = a, and
f −1 (3) = b.

A. B. Dauletiyarova Lecture 5
Examples
Example 8. (i) Let f be the function from {a, b, c} to
{1, 2, 3} such that f (a) = 2, f (b) = 3, and f (c) = 1. Is f
invertible, and if it is, what is its inverse?

Solution: The function f is invertible because it is a


one-to-one correspondence. The inverse function f −1 reverses the
correspondence given by f , so f −1 (1) = c, f −1 (2) = a, and
f −1 (3) = b.

(ii) Let f : Z → Z be such that f (x) = x + 1. Is f invertible,


and if it is, what is its inverse?

Solution: The function f has an inverse because it is a


one-to-one correspondence. To reverse the correspondence,
suppose that y is the image of x, so that y = x + 1. Then
x = y − 1. This means that y − 1 is the unique element of Z that
is sent to y by f . Consequently, f −1 (y ) = y − 1.
A. B. Dauletiyarova Lecture 5
(iii) Let f be the function from R to R with f (x) = x 2 . Is f
invertible?

Solution: Because f (−2) = f (2) = 4, f is not one-to-one. If


an inverse function were defined, it would have to assign two
elements to 4. Hence, f is not invertible. (Note we can also show
that f is not invertible because it is not onto.)

A. B. Dauletiyarova Lecture 5
Compositions of Functions
Definition 10. Let g be a function from the set A to the set
B and let f be a function from the set B to the set C . The
composition of the functions f and g , denoted for all a ∈ A by
f ◦ g , is defined by

(f ◦ g )(a) = f (g (a)).

A. B. Dauletiyarova Lecture 5
Examples

Example 9. (i) Let g be the function from the set {a, b, c}


to itself such that g (a) = b, g (b) = c, and g (c) = a. Let f be the
function from the set a, b, c to the set {1, 2, 3} such that f (a) = 3,
f (b) = 2, and f (c) = 1. What is the composition of f and g , and
what is the composition of g and f ?

Solution: The composition f ◦ g is defined by


(f ◦ g )(a) = f (g (a)) = f (b) = 2,
(f ◦ g )(b) = f (g (b)) = f (c) = 1, and
(f ◦ g )(c) = f (g (c)) = f (a) = 3.

Note that g ◦ f is not defined, because the range of f is not a


subset of the domain of g .

A. B. Dauletiyarova Lecture 5
(ii) Let f and g be the functions from the set of integers to
the set of integers defined by f (x) = 2x + 3 and g (x) = 3x + 2.
What is the composition of f and g ? What is the composition of
g and f ?

Solution: Both the compositions f ◦ g and g ◦ f are defined.


Moreover,
(f ◦ g )(x) = f (g (x)) = f (3x + 2) = 2(3x + 2) + 3 = 6x + 7
and
(g ◦ f )(x) = g (f (x)) = g (2x + 3) = 3(2x + 3) + 2 = 6x + 11.

Remark: Note that even though f ◦ g and g ◦ f are defined


for the functions f and g in Example, f ◦ g and g ◦ f are not
equal. In other words, the commutative law does not hold for the
composition of functions.

A. B. Dauletiyarova Lecture 5
Definition 11. Let f be a function from the set A to the set
B. The graph of the function f is the set of ordered pairs

{(a, b) | a ∈ A and f (a) = b}.

Definition 12. The floor function assigns to the real number


x the largest integer that is less than or equal to x. The value of
the floor function at x is denoted by ⌊x⌋. The ceiling function
assigns to the real number x the smallest integer that is greater
than or equal to x. The value of the ceiling function at x is
denoted by ⌈x⌉.

A. B. Dauletiyarova Lecture 5
Graphs of the Floor and Ceiling Functions

A. B. Dauletiyarova Lecture 5
Examples
Example 10. These are some values of the floor and ceiling
functions:
1
2 = 0;
1
2 = 1;
 1
− 2 = −1;
 1
− 2 = 0;

⌊3.1⌋ = 3;

⌈3.1⌉ = 4;

⌊7⌋ = 7;

⌈7⌉ = 7.
A. B. Dauletiyarova Lecture 5
Useful Properties of the Floor and Ceiling Functions
Table 1, with x denoting a real number, displays some simple
but important properties of the floor and ceiling functions.

A. B. Dauletiyarova Lecture 5
Thank you for attention!

A. B. Dauletiyarova Lecture 5

You might also like