Lecture # 10
Lecture # 10
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 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:
a. . 1
b. . 2
c. . 3
. 4
X Y
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: XY. 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.
1. X Y
2 . . 1
4 . . 2
5 . . 4
. 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}
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).
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).
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.
SOLUTION
Is f one to one?
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)
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: XY be a function. f is surjective or onto if, and
only if,
y Y, x X such that f(x) = y.
. .
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)
Is f onto?
f(x) = y
or 4x-1 = y (by definition of f)
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
Is h onto?
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
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) …
b 2
c .3
X Y