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

Lecture # 10

The document defines and discusses functions. It begins by defining a function as a relationship between elements of two sets X and Y such that each element of X is related to a unique element of Y. It then discusses the domain and codomain of a function, and provides examples of functions and non-functions using arrow diagrams. The document also discusses the range and one-to-one functions. It provides examples and exercises related to determining the range of a function and counting the number of possible functions between sets.

Uploaded by

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

Lecture # 10

The document defines and discusses functions. It begins by defining a function as a relationship between elements of two sets X and Y such that each element of X is related to a unique element of Y. It then discusses the domain and codomain of a function, and provides examples of functions and non-functions using arrow diagrams. The document also discusses the range and one-to-one functions. It provides examples and exercises related to determining the range of a function and counting the number of possible functions between sets.

Uploaded by

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

FUNCTIONS

Lecture # 10
FUNCTIONS
 A function f from a set X to a set Y is a relationship
between elements of X and elements of Y such that each
element of X is related to a unique element of Y, and is
denoted f : X Y.

 The set X is called the domain of f and Y is called the co-


domain of f.

 Functions are sometimes also called mappings and


transformations.
REMARK
 The unique element y of Y that is related to x by f is
denoted f(x) and is called

the value of f at x,
or
the image of x under f
ARROW DIAGRAM OF A FUNCTION
 The definition of a function implies that the arrow diagram
for a function f has the following two properties:

1. Every element of X has an arrow coming out of it

2. No two elements of X has two arrows coming out of it


that point to two different elements of Y.
EXAMPLE
 Let X = {a, b, c} and Y = {1, 2, 3, 4}.
 Define a function f from X to Y by the arrow diagram.
f

a. . 1
b. . 2
c. . 3
. 4

X Y

f(a) = 2, f(b) = 4,and f(c) = 2 OR


image of a = 2, image of b = 4, image of c = 2
NONFUNCTIONS
 X = {2, 4, 5} to Y = {1, 2, 4, 6}

a. b.
.1
2. .1
.2 2.
4. .2
.4 4.
5. .4
.6 5.
.6

X Y X Y
NOT A FUNCTION NOT A FUNCTION
RANGE OF A FUNCTION
 Let f: XY. The range of f consists of those elements of
Y that are images of elements of X.

 Symbolically:

Range of f
= {y Y | y = f(x), for some x  X}
REMARKS
 The range of a function f is always a subset of the co-
domain of f.

 The range of f: X Y is also called the image of X under f.

 When y = f(x), then x is called the pre-image of y.

 The set of all elements of X, that are related to some y Y


is called the inverse image of y.
EXERCISE
 Determine the range of the functions f, g, h from
X = {2, 4, 5} to Y = {1, 2, 4, 6} defined as:
f

1. X Y

2 . . 1
4 . . 2
5 . . 4
. 6

 2. g = { (2, 6), (4, 2), (5,1) }


 3. h(2) = 4, h(4) = 4, h(5) = 1
SOLUTION
1. Range of f = {1, 6}

2. Range of g = {1, 2, 6}

3. Range of h = {1, 4}
EXERCISE
 Find all functions from X = { a, b } to Y = { u, v }
 SOLUTION

1. 2. a u
a u
Y
X b v
b v
3.
4.
a u a u

b v b v

X Y
X Y
EXERCISE
 Find four binary relations from X = { a, b }to Y = { u, v }
that are not functions.
 SOLUTION 1. 2.
a. .u
a. .u

b. b. .v
.v

X Y X Y

3. X Y X Y
4.
a. u. a. u.

b. v. b. v.
EXERCISE
 How many functions are there from a set with three elements to a
set with four elements?

 SOLUTION
Let X = {x1, x2, x3} and
Y = {y1, y2, y3, y4}

 x1 may be related to any of the four elements y1, y2, y3, y4 of Y.


 x1 has four possibilities.
 x2 has four possibilities.
 x3 has four possibilities.
Total number of function = 4 x 4 x 4 = 64
EXERCISE
 Suppose A is a set with m elements and B is a set with n
elements.
 How many functions are there from A to B?

 SOLUTION:
Number of functions from
A to B = n.n.n. … .n (m times)
= nm
TYPES OF FUNCTIONS
Lecture # 11
ONE-TO-ONE FUNCTION / INJECTIVE
FUNCTION
 Let f: X  Y be a function. f is injective or one-to-one
if, and only if,  x1, x2  X, if x1  x2 then f(x1)  f(x2).

 That is, f is one-to-one if it maps distinct points of the


domain into the distinct points of the co-domain.
f

x1 f(x1)

x2
f(x2)
FUNCTION NOT ONE-TO-ONE
 A function f: X Y is not one-to-one iff there exist
elements x1 and x2 such that x1  x2 but f(x1) = f(x2).

 That is, if distinct elements x1 and x2 can found in


domain of f then they have the same function value.
f

x1

f(x1)=f(x2) Y=co-domain of f
X=domain of f

x2
EXAMPLE
 Which of the arrow diagrams define one-to-one
functions?
f g

a 1 1
a
b 2 2
b
3 3
c c
4 4

X Y X Y
Image of (c)
(a) = 3
(b) 2
1 f is NOT one-to-one function
f is one-to-one function
EXERCISE
 Find all one-to-one functions from X = { a, b } to Y = { u, v }
 SOLUTION:
 There are two one-to-one functions from X to Y defined by the
arrow diagrams.

We have only two one-to-one functions.


EXERCISE
 How many one-to-one functions are there from a set with
three elements to a set with four elements.
 SOLUTION
Let X = { x1, x2, x3} and Y = { y1, y2, y3, y4 }

x1 may be mapped to any of the 4 elements of Y. Then x2


may be mapped to any of the remaining 3 elements of Y
& finally x3 may be mapped to any of the remaining 2
elements of Y.
Hence, total no. of one-to-one functions from X to Y are
4 × 3 × 2 = 24
EXERCISE
 How many one-to-one functions are there from a set with
three elements to a set with two elements.

 SOLUTION

 Let X = {x1, x2, x3} and Y = {y1, y2}

 Two elements in X could be mapped to the two elements in Y


separately. But there is no new element in Y to which the third
element in X could be mapped. Accordingly there is no one-
to-one function from a set with three elements to a set with
two elements.
EXERCISE
 How many one-to-one functions are there from a set with three
elements to a set with two elements.
SOLUTION:
Let X = {x1, x2, x3} and Y = {y1, y2}

Two elements in X could be mapped to the two elements in Y


separately. But there is no new element in Y to which the third
element in X could be mapped. Accordingly there is no one-to-one
function from a set with three elements to a set with two elements.
ALTERNATIVE DEFINITION OF ONE-
TO-ONE FUNCTION
 Let f: X  Y be a function. f is injective or one-to-one
if, and only if,  x1, x2  X, IF x1  x2 THEN f(x1)  f(x2).

 The contra-positive of definition is:

If f(x1) = f(x2) then x1 = x2

If the contrapositive of the definition is also satisfied then


the function is also one-to-one.
EXAMPLE
 Define f: R  R by the rule

f(x) = 4x-1 for all x  R

 Is f one to one?

 Prove or give a counter example.


SOLUTION
 We have to prove the implication.

If f(x1) = f(x2) then x1 = x2

First we suppose that f(x1) = f(x2)


then we will show that x1 = x2
 Let x1, x2  R. such that

f(x1) = f(x2)
 4x1 - 1 = 4 x2 – 1 (by definition of f)
 4 x1 = 4 x2 (adding 1 to both sides)
 x1 = x2 (dividing both sides by 4)

 Thus we have shown that if f(x1) = f(x2) then x1= x2


 Therefore, f is one-to-one
EXAMPLE
 Define g : Z  Z by the rule

g(n) = n2 for all n  Z

 Is g one-to-one?
Prove or give a counter example.
SOLUTION
 Let n1, n2  Z and suppose
g(n1) = g(n2)
 n12 = n22 (by definition of g)
 either n1 = + n2 or n1 = - n 2
Thus g(n1) = g(n2)
does not imply n1 = n2 always.
 COUNTER EXAMPLE:
Let n1 = 2 and n2 = -2. Then
g(n1) = g(2) = 22 = 4
g(n2) = g(-2) = (-2) 2 = 4
Hence g(2) = g(-2) where as 2 -2 and so g is not one-to-one
SURJECTIVE FUNCTION /ONTO
FUNCTION
 Let f: XY be a function. f is surjective or onto if, and
only if,
 y  Y,  x  X such that f(x) = y.

That is, f is onto if every element of Y is the image of


some element of X.
 That is, f is onto if every element of its co-domain is the
image of some element(s) of its domain.
i.e., co-domain of f = range of f
FUNCTION NOT ONTO
 A function f:XY is not onto iff there exists y  Y such
that  x  X, f(x) ≠ y.

 That is, there is some element in Y that is not the image of


any element in X.
f
. .
.
. .

. .

X=domain of f Y=co-do main of f


EXAMPLE
 Which of the arrow diagrams define onto functions?
f
g

a 1
a 1
b 2 b
2
c

c .3 d 3

X Y X Y
 SOLUTION:
 f is not onto because 3  f(x) for any x in X. (3 an
element which is not image of any element of set X)

 g is clearly onto because each element of Y equals g(x)


for some x in X. (co-domain all elements are images of
some elements of domain)
as
1 = g(c)
2 = g(d)
3 = g(a) = g(b)
EXAMPLE
 Define f: R  R by the rule

f(x) = 4x-1 for all x  R

 Is f onto?

 Prove or give a counter example.


SOLUTION
 Let y R. We search for an x  R such that

f(x) = y
or 4x-1 = y (by definition of f)

Solving it for x, we find


4x=y+1
y 1
x R
4
Cont…
 Hence for every y R, there exists

y 1
x R such that
4
 y 1
f ( x)  f  
 4 

 y 1
 4.    1  ( y  1)  1  y
 4 
Hence f is onto.
EXAMPLE
 Define h: Z  Z by the rule

h(n) = 4n - 1 for all n  Z

Is h onto?

Prove or give a counter example.


SOLUTION
 Let m Z. We search for an n  Z such that
h(n) = m.

or 4n - 1 = m (by definition of h)

m 1
Solving it for n, we find n 
4
m 1
But n  is not always an integer for all m Z.
4
Cont…
 Let m = 3 then m 1 4
integer  1
4 4

 Let m = 5 then m 1 6

not an integer 4 4

 As a counter example, let m = 0  Z, then


h(n) = 0
 4n-1 = 0
1
 4n = 1 n  
4

Hence there is no integer n for which h(n) = 0.


Accordingly, h is not onto.
EXERCISE
 Determine if each of the functions is injective or
surjective:

a. f: Z Z+ define as f(x) = |x|


b. g: Z+  Z+  Z+ defined as g(x) = (x, x+1)
SOLUTION
a) f is not injective, because distinct element have same
images.
f(1) = |1| = 1 and f(-1) = |-1| = 1
i.e., f(1) = f(-1) but 1  -1
(clearly not onto, because distinct elements have same images)
f is onto, because for every a  Z+,
there exist –a and +a in Z such that

f(-a) = |-a| = a
and f(a) = |a| = a
Cont…
b) g: Z+  Z+  Z+ defined as
g(x) = (x, x+1)
Let g(x1) = g(x2) for x1, x2 Z+
 (x1, x1 +1) = (x2, x2+1) (by definition of g)

 x1 = x2 and x1 + 1 = x2 + 1
(by equality of ordered pairs)
 x1 = x2
Thus if g(x1) = g(x2) then x1 = x2
Hence g is one-to-one.
 g is not onto because (1,1) Z+Z+ is not the image of
any element of Z+.

 Counter Example:
Let x = 1 then g(x) = (1, 2)
Let x = 2 then g(x) = (2, 3)
Let x = 3 then g(x) = (3, 4) …

Clearly, (1,1), (2,2), (2,4) etc which are the elements of


co-domain Z+Z+ are not images of any elements of Z+.
BIJECTIVE FUNCTION
 A function f: XY that is both one-to-one (injective) and
onto (surjective) is called a bijective function or a one-to-
one correspondence.
EXAMPLE
 The function f: XY defined by the arrow diagram is
both one-to-one and onto; hence a bijective function.
f
a 1

b 2

c .3

X Y

You might also like