L5 Functions

Download as pdf or txt
Download as pdf or txt
You are on page 1of 34

Functions

Course Code: CSE-173 Course Title: Discrete Mathematics

Dept. of ECE
School of Engineering and Physical Sciences

Lecturer No: 5 Week No: 3 Semester: Summer – 20


Lecturer: Dr. Razib Hayat Khan
2

Lecture Outline
2.3 Functions
• Definition of Function
• Domain, Codomain, Range, Image, Preimage,
• One-to-one function
• Onto function
• One-to-one correspondence
• Inverse Functions
• Compositions of Functions
• Floor function
• Ceiling Function
3

Objectives and Outcomes


• Objectives: To understand what is function, domain, co-domain,
range, image, pre-image; to understand different types of
functions.
• Outcomes: Students are expected to be able to explain different
types of functions with examples, be able to determine whether a
function is one-to-one, onto, and/or one-to-one correspondence,
be able to determine whether a function is invertible and find out
the inverse of a function, be able to apply floor and ceiling
functions.
4

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
• Note: Functions are sometimes called mappings or
transformations.
5

Functions

• Functions are specified in many different ways.


• Sometimes we explicitly state the assignments, as in
Figure 1.
• Often we give a formula, such as f(x) = x + 1, to define a
function.
• Other times we use a computer program to specify a
function.
6

Functions
• A function f: A® B can also be defined in terms of a
relation from A to B. [we will cover Relation in final
term]
• A relation from A to B is just a subset of A X B.
• A relation from A to B that contains one, and only one,
ordered pair (a, b) for every element aÎ A, defines a
function f from A to B. This function is defined by the
assignment f(a)=b, where ( a, b) is the unique ordered
pair in the relation that has a as its first element.
7

FIGURE 1: Assignment of Grades in a


Discrete Mathematics Class

Function is a kind of
mapping where every
element has a unique
image
8

Some Function Terminology

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, a is the preimage of b and b is the image of a.

• Range 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
from A to B.
9

Some Function Terminology

• If f is a function from A to B, we write f: A® B


§ A is the domain of f
§ B is the codomain of f
§ If f(a)=b,
• a is called the preimage of b
• b is called the image of a
• Range of f : the set of all images of elements of A
10

Range versus Codomain

• The range of a function might not be its whole


codomain.
• The codomain is the set that the function is declared to
map all domain values into.
• The range is the particular set of values in the
codomain the function actually maps elements of the
domain to.
11

Range versus Codomain: Example


(See the FIGURE 1 in the previous slide)
• Suppose I declare to you that: “f is a function mapping
students in this class to the set of grades {A, B, C,D,F}”.
• At this point, you know f’s codomain is: {A, B, C,D,F}, and
it’s range is unknown!
• Suppose the grades turn out all As and Bs.
• Then the range of f is {A, B}”, but it’s codomain is still
{A, B, C,D,F}.
12

Example 1
• What are the domain, codomain, and range of the function that assigns
grades to students of Discrete Math class as follows?
13

Solution of Example 1

§ Solution:
• Let G be the function that assigns grade to a student of
Discrete Mathematics class.
• The domain of G is the set { Adams, Chou, Goodfriend,
Rodriguez, Stevens}
• The codomain of G is the set { A, B, C, D, F}
• The range of G is the set { A, B, C, F}
• Because each grade except D is assigned to some student
14

Example 2
• Let R be the relation consisting of ordered pairs (Abdul, 22), (Brenda,24),
(Carla,21), (Desire,22), (Eddie,24), and (Felicia,22), where each pair consists of
a graduate student and the age of this student. What is the function that this
relation determines?

• Solution: This relation defines the function f, where with f(Abdul)= 22,
f(Brenda)=24, f(Carla)=21, f(Desire)=22, f(Eddie)= 24, and f(Felicia)=22.
• Here, domain is the set { Abdul, Brenda, Carla, Desire, Eddie, Felicia }
• To define the function f, we need to specify a codomain. Here, we can take the
codomain to be the set of positive integers
• Range is the set {21,22,24}
15

Functions

Definition 3: 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)
16

Example 6

§ Let f1 and f2 be functions from R to R such that f1(x)=x2 and


f2(x)=x – x2. What are the functions f1 + f2 and f1 f2 ?
§ Solution:
(f1 + f2)(x) = f1(x) + f2(x) = x2 + (x –x2 ) = x

(f1f2)(x) = x2(x- x2 ) = x3 – x4
17

Functions

• Definition 4: Let f be a function from the set A to the set


B, and let S is 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).
f(S) = {t|$sÎS(t=f(s))}
18

Example 7
• 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, f(e) = 1.
What is the image of the subset S = {b, c, d}?

• Solution:
• The image of the subset S = {b, c, d} is the set
f(S) = {1, 4}
19

One-to-One Functions

§ Definition 5: A function f is one-to-one or injective, iff f(a)


= f(b) implies that a = b for all a and b in the domain of f.
§ A function f: A® B is said to be one-to-one if all the
elements in the domain A have distinct images.
• 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 f
20

Example 8

• 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 is one-to-one because every
element of domain has a distinct image.
• The function f is one-to-one because f takes on different
values at the four elements of its domain.
21

FIGURE for Example 8 : A One-to-One Function


22

Example 9

Example 9: Determine whether the function f(x) = x2 from


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

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


for instance, f(1)= f(–1) = 1, but 1 = – 1
(i.e. 1 and –1 have same image 1)
23

Class Work

Determine whether the function f(x) = x2 from the set of


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

Example 10

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


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

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


function. Since x + 1 = y + 1, when x = y
• For any real number x, there is a distinct image, just 1
bigger than x; so, the function is one-to-one.
25

Example : One-to-one function

• Let A = {1, 2, 3} and B = {a, b, c, d}, and let f(1) = a,


f(2) = b, f(3) = d. Then f is injective, since the
different elements 1, 2, 3 in A are assigned to the
different elements a, c, d respectively in B
• Note: Every element of domain has a distinct image.
So, the function is one-to-one.
26

Onto Function

• Definition 7: A function f from A to B is onto or surjective,


if for every element bÎB there is an element aÎA with f(a)
= b.
• A function f: A®B is said to be an onto function if each
element of B is the image of some element of A
• i.e., if B = range of f
• Note: A function is onto if every element of codomain has
preimage(s).
27

Example 11

• 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?
[see Figure on next slide]
• Solution: Because all three elements of the codomain
are images of elements in the domain, f is onto.
28

FIGURE for Example 11:


An Onto Function
29

Example 12

• Is the function f(x) = x2 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 x2 = –1, for instance.

• Note: The elements of the codomain that are negative


integers (- 1, - 2, - 3 etc.) do not have any preimage.
30

Class Work

Is the function f(x) = x2 from the set of positive integers to


the set of positive integers onto?
31

One-to-one correspondence (bijection )

• Definition 8: A function f is a one-to-one correspondence or a


bijection if it is both one-to-one and onto.

• Example: Let f be the function from A to B where A={1, 2, 3, 4}


and B = {a, b, c, d} with f(1)=d, f(2)=b, f(3)=c, and f(4)=a, then f is
bijective function.
- f is one-to-one since every element of domain has a distinct image
- f is onto since every element of B is the image of some element in A.
- Hence f is a bijective function (or, one-to-one correspondence)
• Practice yourself: Example 14
32

FIGURE: Examples of Different Types of


Correspondences
Books

1. Discrete Mathematics and its applications with


combinatorics and graph theory (7th edition) by Kenneth H.
Rosen [Indian Adaptation by KAMALA KRITHIVASAN],
published by McGraw-Hill
References

1. Discrete Mathematics, Richard Johnsonbaugh, Pearson education, Inc.


2. Discrete Mathematical Structures, Bernard Kolman, Robert C. Busby,
Sharon Ross, Prentice-Hall, Inc.
3. SCHAUM’S outlines Discrete Mathematics(2nd edition), by Seymour
Lipschutz, Marc Lipson

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy