Professional Documents
Culture Documents
DSLec 10
DSLec 10
By
Syed Ijaz Hussain Bukhari
Functions
RELATIONS AND FUNCTIONS:
A function F from a set X to a set Y is a relation from X to Y
that satisfies the following two properties
1. For every element x in X, there is an element y in Y such
that (x,y) F.
In other words every element of X is the first element of
some ordered pair of F.
2. For all elements x in X and y and z in Y, if (x,y) F and
(x,z) F, then y = z
In other words no two distinct ordered pairs in F have the
same first element.
EXERCISE
Which of the relations define functions from
X = {2,4,5} to Y={1,2,4,6}.
a. R1 = {(2,4), (4,1)}
b. R2 = {(2,4), (4,1), (4,2), (5,6)}
c. R3 = {(2,4), (4,1), (5,6)}
SOLUTION :
a. R1 is not a function, because 5 X does not appear as the first
element in any ordered pair in R1.
b. R2 is not a function, because the ordered pairs (4,1) and (4,2) have
the same first element but different second elements.
c. R3 defines a function because it satisfy both the conditions of the
function that is every element of X is the first element of some order
pair and there is no pair which has the same first order pair but
different second order pair.
FUNCTION
• 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.
ARROW DIAGRAM OF A FUNCTION
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
The relation given in the diagram (a) is Not a function because there is no
arrow coming out of 5X to any element of Y.
The relation in the diagram (b) is Not a function, because there are two arrows
coming out of 4X. i.e.,4X is not related to a unique element of Y.
RANGE OF A FUNCTION:
Let f: XY. The range of f consists of those elements of Y
that are image of elements of X.
Symbolically: Range of f = {y Y| y = f(x), for some x X}
NOTE:
1. The range of a function f is always a subset of the co-
domain of f.
2. The range of f: X Y is also called the image of X under f.
3. When y = f(x), then x is called the pre-image of y.
4. 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
1
a. f ( n) n b. f ( n)
n2 4
c. f ( n) n d. f (n) n 2 1
SOLUTION:
a. f is not well defined since each integer n has two images +n and -n
b. f is not well defined since f(2) and f(-2) are not defined.
c. f is not defined for n < 0 since f then results in imaginary values (not real)
d. f is well defined because each integer has unique (one and only one)
image in R under f.
EXERCISE
Let g: RR+ be defined by g(x) = x2 +1
1. Show that g is well defined.
2. Determine the domain, co-domain and range of g.
SOLUTION:
1. g is well defined:
Let x1, x2 R and suppose x1 = x2
x12 = x22 (squaring both sides)
x12 + 1 = x22 + 1 (adding 1 on both sides)
g (x1) = g(x2) (by definition of g)
Thus if x1 = x2 then g (x1) = g(x2). According g:R R+ is well defined.
2. g: R R+ defined by g(x) = x2 + 1.
Domain of g = R (set of real numbers)
Co-domain of g = R+ (set of positive real numbers)
The range of g consists of those elements of R + that
appear as image points.
Since x2 0 x R
x2 + 1 1 x R
i.e. g(x) = x2 + 1 1 x R
Hence the range of g is all real number greater than or
equal to 1, i.e., the internal [1,)
IMAGE OF A SET
f : X Y is function and A X.
The image of A under f is denoted and defined as:
f(A) = {yY | y=f(x), for some x in A}
EXAMPLE:
Let f: X Y be defined by the arrow diagram
Let A = {1,2}and B = {2,3} then
f(A)={b} and f(B) = {b,c} under the function defined in the Diagram then we say
that image set of A is {b} and I mage set of B is {b,c}.
1 .a
2
b
3
4 c
X Y
BINARY OPERATIONS
A binary operation “*” defined on a set A assigns to each ordered
pair (a,b) of elements of A, a uniquely determined element a*b of
A.
That is, a binary operation takes two elements of A and maps them
to a third element of A.
+,-,* and are binary operations on the set
BINARY OPERATION AS FUNCTION:
A binary operation “*” on a set A is a function from A * A to A.
i.e. *: A A A.
Hence *(a,b) = c, where a, b, c A.
NOTE
*(a,b) is more commonly written as a*b.
EXAMPLES
1. The set operations union , intersection and set difference -, are
binary operators on the power set P(A) of any set A.
2.The logical connectives , , , are binary operations on the set {T, F}
3. The logic gates OR and AND are binary operations on {0,1}
A A+B A AB
OR AND
B
B
Types of functions
1) INJECTIVE FUNCTION or
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)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:
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:
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)
n 12 = n 22 (by definition of g)
either n1 = + n2 or n1 = - n2
Thus g(n1) = g(n2) does not imply n1 = n2 always.
As a counter example, let n1 = 2 and n2 = -2.
Then
g(n1) = g(2) = 22 = 4 and also g(n2) = g(-2) = (-2) 2 = 4
Hence g(2) = g(-2) where as 2 -2 and so g is not one-to-one.
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.
EXERCISE:
How many one-to-one functions are there from a set with three elements to a
set with four elements.
SOLUTION:
Let X = { x 1,x 2, x 3} and Y = {y 1,y 2,y 3,y 4}
x 1. .y 1
x 2.
.y 2
.y 3
x 3.
.y 4
X Y
.
. .
. .
X=domain of f Y=co-domain of f
EXAMPLE:
Which of the arrow diagrams
f define onto functions?
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. g is clearly
onto because each element of Y equals g(x) for some x in
X.
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
x
definition
y 1
R
of f)
4
Solving it for
y 1x, we find x=y+1 . Hence for every y R, there
x R
exists 4 such that
y 1
f ( x) f
4
y 1
4. 1 ( y 1) 1 y
4
Hence f is onto.
BIJECTIVE FUNCTION or
ONE-TO-ONE CORRESPONDENCE
A function f: XY 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: XY 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
IDENTITY FUNCTION ON A SET:
Given a set X, define a function ix from X to X by ix(x) = x from all x X.
The function ix is called the identity function on X because it sends each
element of X to itself.
EXAMPLE:
Let X = {1,2,3,4}. The identity function ix on X is represented by the arrow
diagram
CONSTANT FUNCTION:
A function f:XY is a constant function if it maps (sends) all elements of X
to one element of Y i.e. x X, f(x) = c, for some c Y
EXAMPLE:
The function f defined by the arrow diagram is constant.
f
X Y
1
.7
2
3 .8
4 .9
Define functions f and g from R to R by formulas:
f(x) = 2x and g ( x) x 1
2x 2x
3
g-1
g
.a 1.
1. .a
.b 2.
2. .b
.c 3.
3. .c
Y X
X Y
FUNCTION INVERSE
X Z Z X
1.
1. .a
.a 2.
2. .b
.b 3.
3.
Y X
X Y
INVERSE
SURJECTIVE FUNCTION
x=f-1(y) f(x)=y
f-1
X=domain of f Y=co-domain of f
INVERSE FUNCTION FROM A FORMULA
Let f:RR be defined by the formula f(x) = 4x-1 xR
Then f is bijective, therefore f-1 exists. By definition of f-1,
f-1 (y) = x f(x)=y
Now solving f(x) = y for x
4x-1 = y (by definition of f)
4x = y + 1
x y 4 1
• Hence, f-1 (y) = y 1 is the inverse of f(x)=4x-1 which
4
defines f : RR.
-1
WORKING RULE TO FIND INVERSE FUNCTION
such that
Accordingly f is surjective
• 2. inverse function of f
• The given
x 1 function f is defined by the rule
f ( x) y (say)
x 1
•
x + 1 = y (x-1)
• x + 1 = yx-y
• y + 1 = yx-x
• y +y 11 = x(y-1)
x
y 1
y 1
; y 1
• y 1
• Hence f-1(y) =