0% found this document useful (0 votes)
22 views39 pages

DSLec 10

The document discusses functions, relations, and binary operations. It defines what a function is and provides examples of functions and non-functions. It also discusses one-to-one functions, range and domain of functions, and binary operations as functions.

Uploaded by

Sneha Imran
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)
22 views39 pages

DSLec 10

The document discusses functions, relations, and binary operations. It defines what a function is and provides examples of functions and non-functions. It also discusses one-to-one functions, range and domain of functions, and binary operations as functions.

Uploaded by

Sneha Imran
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/ 39

Discrete Structure

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

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

• You can easily note that the above diagram satisfy


the two conditions of a function hence a graph of
the function.
• Note that f(a) = 2, f(b) = 4,and f(c) = 2
FUNCTIONS AND NONFUNCTIONS
Which of the arrow diagrams define functions from 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

The relation given in the diagram (a) is Not a function because there is no
arrow coming out of 5X to any element of Y.
The relation in the diagram (b) is Not a function, because there are two arrows
coming out of 4X. i.e.,4X is not related to a unique element of Y.
RANGE OF A FUNCTION:
Let f: XY. 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

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}
FUNCTIONS NOT WELL DEFINED:
Determine whether f is a function from Z to R if

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: RR+ 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) = {yY | 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 AB

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

x1 may be mapped to any of the 4 elements of Y. Then x 2 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
2) SURJECTIVE FUNCTION or 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 its co-domain is the image of some
element(s) of its domain.i.e., co-domain of f = range of f

Each element y in Y equals f(x) for at least one x in X


• 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-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: 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
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:XY 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

for all x ε R. Show that f = g


SOLUTION:
2 x3  2 x
g ( x)  2
x 1
2 x( x 2  1)
 2
( x  1)
 2x [x 2  1  0]
 f ( x) for all x  R
INVERSE OF A FUNCTION

g-1
g

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

Y X
X Y
FUNCTION INVERSE

Remark: Inverse of a function may not be a function.


f f-1
.a .a
1. 1.
.b .b
2. 2.
.c .c
3. 3.
d d

X Z Z X

INJECTIVE FUNCTION INVERSE

• Note: Inverse of an injective function may not be a function.


h h-1

1.
1. .a
.a 2.
2. .b
.b 3.
3.

Y X
X Y
INVERSE
SURJECTIVE FUNCTION

• Note:Inverse of a surjective function may not be a function.


INVERSE FUNCTION
Suppose f:XY is a bijective function. Then the inverse
function f-1: YX is defined as:
 yY,f-1(y) = x  y = f(x)
That is, f-1 sends each element of Y back to the element of X
that it came from under f.
f

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:RR be defined by the formula f(x) = 4x-1 xR
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 : RR.
-1
WORKING RULE TO FIND INVERSE FUNCTION

• Let f: X Y be a one-to-one correspondence defined


by the formula f(x)=y.
• 1. Solve the equation f(x) = y for x in terms of y.
• 2. f-1 (y) equals the right hand side of the
equation found in step 1.
EXAMPLE:
Let a function f be defined on a set of real numbers as
for all real numbers x 1.

1. Show that f is a bijective function on R-{1}.


2. Find the inverse function f-1
SOLUTION:
1. To show:f is injective
Let x1, x2 R-{1} and suppose
f(x1) = f(x2) we have to show that x1=x2
x1  1 x2  1
 
x1  1 x2  1
(by definition of f)

 (x1 + 1) (x2 - 1) = (x2 + 1) (x1 - 1)


 x 1x 2 - x 1 + x 2 - 1 = x 1x 2 - x 2 + x 1 - 1
 - x1 + x2 = - x 2 + x1
 x2 + x 2 = x 1 + x 1
 2 x2 = 2 x1
 x2 = x 1
Hence f is injective.
b.Next to show:f is surjective
Let y  R - {1}. We look for an x R -{1}such that f(x) = y
x + 1= y(x-1)
x+1=yx-y
 1+ y = xy - x
 1 + y = x(y-1)
y 1
x
y 1

y 1
x
y 1
Thus for each y  R - {1}, there exists  R - {1}
 y 1
f ( x)  f    y
 y 1

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) =

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