0% found this document useful (0 votes)
8 views

Chapter 5 Functions

Discrete Mathematics

Uploaded by

nymurrezashemon
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Chapter 5 Functions

Discrete Mathematics

Uploaded by

nymurrezashemon
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 29

Discrete Mathematics : Functions

Abid Afsan Hamid


Lecturer
CSE Department
Northern University of Business and Technology, Khulna

1 CSE Department, Northern Uni. Of Business & Technology 09/04/2023


Functions

● (1) f(x) = x2 or y = x2
● (2) f(x) = x + 1 or y = x + 1
● (3) f(x)= x2 + y2 – 1 or y = x2 + y2 – 1
● (4) f(x) = x2 + x + 1 or y = x2 + x + 1

2 CSE Department, Northern Uni. Of Business & Technology 09/04/2023


Functions : Map, Mapping and Transformation

3 CSE Department, Northern Uni. Of Business & Technology 09/04/2023


Functions

● A function f from a set X to a set Y, denoted f : X → Y , is a


relation from X, the domain, to Y , the co-domain, that
satisfies two properties:
(1) every element in X is related to some element in Y , and
(2) no element in X is related to more than one element in Y .
● X is domain
● Y is codomain

4 CSE Department, Northern Uni. Of Business & Technology 09/04/2023


Functions

● Which of the arrow diagrams in the figure below defines


functions from X ={a, b, c} to Y ={1, 2, 3, 4}?

5 CSE Department, Northern Uni. Of Business & Technology 09/04/2023


Functions : Only C

6 CSE Department, Northern Uni. Of Business & Technology 09/04/2023


Functions : Identity Function

● Given a set X, defines a function IX from X to X by


● IX(x) = x, or f(5x) = 5x for all x in X.
● The function IX is called the identity function on X because it
sends each element of X to the element that is identical to it.

7 CSE Department, Northern Uni. Of Business & Technology 09/04/2023


Functions : One-to-one Function

● Some functions never assign the same value to two different


domain elements. These functions are said to be one-to-one.
● A function f is said to be one-to-one 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.

8 CSE Department, Northern Uni. Of Business & Technology 09/04/2023


Functions : One-to-one Function

● One-to one

9 CSE Department, Northern Uni. Of Business & Technology 09/04/2023


Functions : One-to-one Function

● Determine whether the function, f(x)=3x+3 is one-to-one.


● Here, f(a)=3a+3 and f(b)=3b+3, and for being one-to-one
function f(a)=f(b).
● And from f(a)=f(b), we can prove that a=b, so, f(x)=3x+3 is a
one-to-one function.
● Also 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.
● Yes. It is One-to-one.
10 CSE Department, Northern Uni. Of Business & Technology 09/04/2023
Functions : Onto Function

● A function f from A to B is called onto 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.
● Also, a function is onto function when its range and
codomain are equal.

● If f:R→R and f(x)=3x+3, then prove that it is a Onto function.

11 CSE Department, Northern Uni. Of Business & Technology 09/04/2023


Functions : Onto Function

● Here, y=f(x)=3x+3 and then y=3x+3.


● And from this we can find x=(y-3)/3.
● As x=(y-3)/3 ∈ R, f(x)=3x+3 is a Onto function.
● 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?
● Yes. It is Onto function

12 CSE Department, Northern Uni. Of Business & Technology 09/04/2023


Functions : Invertible Function

● A function f from A to B is called Bijective if and only if f is


both one-to-one and onto.
● Given f(x)=3x+3. Is f a Bijective?
● Yes. It is Bijective.

13 CSE Department, Northern Uni. Of Business & Technology 09/04/2023


Functions : Inverse Function

● 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.

14 CSE Department, Northern Uni. Of Business & Technology 09/04/2023


Functions : Inverse Function

15 CSE Department, Northern Uni. Of Business & Technology 09/04/2023


Functions : Inverse Function

● Let f be the function, f(x)=3x+3.Find its inverse function f-1(x).


● Here, y=f(x)=3x+3, then from y=f(x) it can be written as
x=f-1(y).
● Now y=3x+3 and by calculating, x=(y-3)/3.
● From x=f-1(y) and x=(y-3)/3, it can be f-1(y) =(y-3)/3.
● Finally replacing y by x, the inverse function f-1(x) =(x-3)/3.

16 CSE Department, Northern Uni. Of Business & Technology 09/04/2023


Functions : Composition of Functions

● 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))
● To find (f ◦ g)(a) we first apply the function g to a to obtain g(a)
and then we apply the function f to the result g(a) to obtain (f ◦
g)(a) = f(g(a)) the composition f ◦ g cannot be defined unless
the range of g is a subset of the domain of f .
17 CSE Department, Northern Uni. Of Business & Technology 09/04/2023
Functions : Composition of Functions

18 CSE Department, Northern Uni. Of Business & Technology 09/04/2023


Functions : Composition of Functions

● 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 ?

19 CSE Department, Northern Uni. Of Business & Technology 09/04/2023


Functions : Composition of Functions

● Answer : 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.

20 CSE Department, Northern Uni. Of Business & Technology 09/04/2023


Sequences

● A sequence is a discrete structure used to represent an


ordered list.
● For example, 1, 2, 3, 5, 8 is a sequence with five terms
● 1, 3, 9, 27, 81 ,... ,3n, ... is an infinite sequence
● If a is a sequence, we use the notation {an} to describe the
sequence. Note that an represents an individual term of the
sequence {an}.

21 CSE Department, Northern Uni. Of Business & Technology 09/04/2023


Sequences : Geometric Progression

● A geometric progression is a sequence of the form a, ar, ar2


,..., arn,...where the initial term a and the common ratio r are
real numbers.
● An example of such geometric progression is 1, 2, 4, 8, 16,
32, 64……

22 CSE Department, Northern Uni. Of Business & Technology 09/04/2023


Sequences : Arithmetic Progression

● An arithmetic progression is a sequence of the form a, a + d,


a + 2d,...,a + nd,...n where the initial term a and the common
difference d are real numbers.
● An example of arithmetic progression is 1, 4, 7, 10, 13, 16,
19, 22, 25……

23 CSE Department, Northern Uni. Of Business & Technology 09/04/2023


Cardinality

● Let S be a set. If there are exactly n distinct elements in S


where n is a nonnegative integer, we say that S is a finite set
and that n is the cardinality of S. The cardinality of S is
denoted by |S|.

24 CSE Department, Northern Uni. Of Business & Technology 09/04/2023


Cardinality

● Let A be the set of odd positive integers less than 10. Then
|A|= 5.
● Let S be the set of letters in the English alphabet. Then |S|=
26.
● Because the null set has no elements, it follows that |∅| = 0.
● We use the cardinalities of finite sets to tell us when they
have the same size, or when one is bigger than the other.

25 CSE Department, Northern Uni. Of Business & Technology 09/04/2023


Functions : Recursively Defined Function

● A function is said to be recursively defined if the function


definition refers to itself. In order for the definition not to be
circular, the function definition must have the following two
properties:
● (1) There must be certain arguments, called base values, for
which the function does not refer to itself
● (2) Each time the function does refer to itself , the argument of
the function must be closer to a base value.
26 CSE Department, Northern Uni. Of Business & Technology 09/04/2023
Functions : Recursively Defined Function

● Example 1: Factorial
● Factorial function n! = n x (n-1)!
(a) if n=0 then n!=1
(b) if n>0 then n! = n x (n-1)!

27 CSE Department, Northern Uni. Of Business & Technology 09/04/2023


Algorithm

● An algorithm is a finite sequence of precise instructions for


performing a computation or for solving a problem.
● An algorithm is a finite step-by-step list of well-defined
instructions for solving a particular problem.
● Describe an algorithm for finding the maximum (largest)
value in a finite sequence of integers.

28 CSE Department, Northern Uni. Of Business & Technology 09/04/2023


Algorithm

● 1. Set the temporary maximum equal to the first integer in the


sequence. (This value will be the largest integer examined at
any stage of the procedure.)
● 2. Compare the next integer in the sequence to the temporary
maximum, and if it is larger than the temporary maximum, set
the temporary maximum equal to this integer.
● 3. Repeat the previous step if there are more integers in the
sequence.
29 CSE Department, Northern Uni. Of Business & Technology 09/04/2023

You might also like