Вы находитесь на странице: 1из 40

Relations and Functions

Cartesian Product

A Cartesian product is a mathematical operation that returns a set from multiple sets.

If A and B are two sets,


Cartesian product is written as AxB and defined as,
… continued

Here A and B are two sets and AxB is the Cartesian set
...continued

Let A and B be two sets where,


A = {1, 2, 3}
B = {4, 5, 6}
then,
AxB = {(1,4), (1,5), (1,6), (2,4), (2,5), (2,6), (3,4), (3,5), (3,6)}
BxA = {(4,1), (4,2), (4,3), (5,1), (5,2), (5,3), (6,1), (6,2), (6,3)}

so we can say that,


AxB != BxA
but, 
n(AxB) = n(BxA) = n(A) x n(B)
What is Relation ?

Simply put,

Relation is a subset of a Cartesian product.

It is denoted by:
R : A→ B ( __condition__ )
...continued
Let us consider an example.

If we are given two sets A and B where,


A = {2, 3} and B = {1, 2, 3}
suppose the relation is,
R : A→ B (a = b)
then the relation is given by,
R = {(2, 2), (3, 3)}
Representation of a Relation

4 ways to represent a Relation


 Graphical Representation
 Arrow Diagram
 Matrix Form
 Directed Graph (Digraph)
...continued

Graphical Representation
Let R be a relation defined on the sets,
A = {1, 2, 3} and B = {1, 4, 9}
such that
R : A→B (b = a2)
Then, R = {(1, 1), (2, 4), (3, 9)}


Graphical Representation
...continued

Arrow Diagram
R

A B

1 1

2 4

3 9

R = {(1, 1), (2, 4), (3, 9)}


...continued

Matrix Form

A/B
2 3 4

1 1 0 0

2 1 1 0

3 1 0 1

R:A={1,2),(2,3),(3,4),(3,2),(2,2)}
 
...continued

Directed Graph (Digraph)

1 2

9
3

R = {(1, 1), (2, 4), (3, 9)}


Domain, Co-domain & Range

If there is a Relation from set A to set B.


then,
R
A B

1 4

2 5

3 6

Domain = {1, 2, 3} = set of all elements in set A  


Co-domain = {4, 5, 6, 7} = set of all elements in set B
Range = {4, 5, 6} = set of elements in set B that are in relation to elements in set A
Composition of Relation
Let, R : A → B and S : B → C. Then the composition SoR: A →C is
denoted by
Example:
R:A→B = {(1,a), (2,b), (3,c)}
S:B→C = {(a, p), (b, q), (c,r)} SoR
then it follows,
R S
SoR = {(1,p), (2,q), (3,r)}

1 a p

2 b q

3 c r
Types of relation


Reflexive relation

Symmetric relation

Anti-symmetric relation

Transitive relation

Equivalence relation

Partial order relation
..continued

Reflexive relation:

A relation R on a set A is called reflexive relation iff:


(a,a)  ∈ R ∀  a ∈ A

R: A→A  = {(1,1), (2,2), (3,3)}  on  A = {1,2,3}


S= {(1,1),(1,2),(2,2),(2,3),(3,3)}
...continued

Symmetric relation:

A relation R on a set A is called symmetric relation iff:
(a,b)  ∈ R → (b,a)  ∈ R ,∀  a,b ∈ A
Let, A= {1,2,3,4}
Then,
A x A = Universal Relation
R: A→A ={(1,1), (1,2), (2,1), (2,2)}
S={(1,2),(2,1)}
T= { }
...continued
 
Anti-symmetric relation
A relation R on a set A is called anti-symmetric iff it satisfies
both of these following conditions:
 I)   If a = b, (a,b)∈ R → (b,a)∈ R
II)   If a b, (a,b)∈ R → (b,a)∉ R
Example: Let, A ={1,2,3,4,}
then,
R1 = {(1, 1), (2, 2), (3, 3), (4, 4)}
R2 = {(1, 2), (1, 3), (1, 4)}
R3 = {(1, 3),(2,2),(2,3),(3,3)}, S={ }
...continued

Transitive Relation:
A relation R on set A is called transitive relation iff:
(a, b),(b, c)∈R→(a, c)∈ R ∀ a, b, c ∈ A

R ={(1,1), (1,2), (2,2), (2,3), (3,3)} on set A={1,2,3}


R1 = {(1,1), (1,2)}
S = {(1,1)}
T = {(1,2)}
U= { }
...continued

Equivalence relation:

A relation R on a set A is called equivalence relation if


it satisfies reflexive, symmetric and transitive relation.
...continued

Partial Order relation:

A relation R on a set A is called partial order relation if


it satisfies reflexive, anti-symmetric and transitive
relation.
1. 
i. If R:A={1,2),(2,3),(3,4),(3,2),(2,2)}Defined on A={1,2,3} and B= {2,3,4}
Find
i. the inverse relation of R

ii. Show the above relation R of arrow diagram ,matrix form , directed graph and graphical
representation
2.
If R:A ={(a,1),(b,2),(c,2)} and S:B
Then find the composition of R and S. Also show SoR in Matrix form.
3.
Is R:A ={(1,1),(1,2),(2,2),(3,3)} defined on A ={1,2,3} is Reflexive and Symmetric?
Let
   R be a relation which is defined from A to B. Then inverse

relation is denoted by which is the relation from set B to A.


R={(1,2),(2,3),(3,4)}

={(2,1),(3,2),(4,3)
FUNCTIONS
 The concept of a function is extremely important in mathematics and Computer
Science
 Many Computer Programs and subroutines are designed to calculate values of
functions.
 Recursive Functions, which are functions defined in terms of themselves are used
throughout Computer Science
Function
 
Function is a special kind of relation between Two sets where every element of
first set must have unique image in second set. It is denoted by f:A

F(x)= 2x+1

A(x) B(y)
3
1
5
2
7
3 10

Here A= domain(input) x
B =codomain (y) ,f(x)= output = Range.
Types of function
i. One to one (Injective function)
ii. Onto (Surjective function)
iii. One-one correspondence(Bijective function/Invertible)
iv. Many to One Function
v. Into Function
...continued
 
1. One to one function:
This is a type of function where each image
has unique pre-image.
Or
If f(x) = f(y) x = y  
(x)
f B B A
A
-1 1
F(x):A = 2x 2
1
0 0
2
4
3
A= {-1,0,1,2} f(x) =x2 1 4
2 6

(x): B =
...continued
2. Onto function:
This is a type of function where co-domain = range,
meaning that every item in co-domain has at least one pre-image.
i.e. f(x) Range =y Codomain

f
A B
1 1
2 4
3 9
4
...continued

One-one correspondence (Bijective): (if it one to one and onto function)
It is the combination of one-one function and onto function. You can also call it one to one
onto function. This kind of function must satisfy these two conditions

each image has unique pre-image

every item in co-domain has at least one pre-image.

f
A B

1
1
4
2
9
3
…..Continued
Many-one Function : If any two or more elements of set A are
connected with a single element of set B, then we call this function as
Many to one function. 
A B

1
1
2

3
………Continued

Into Function :  
Function f from set A to set B is Into function if at least set B has a
element which is not connected with any of the element of set A.
(Codomain   
Here
Codomain={b1,b2,b3,b4,b5}
But Range ={b1,b3,b4,b5}
So ,Codomain Range
It’s an into function.
Inverse Function
In mathematics, an inverse function (or anti-function) is a function that "reverses "another
function: if the function f applied to an input x gives a result of y, then applying its inverse
function g to y gives the result x, and vice versa, i.e., f(x) = y if and only if g(y) = x.
Note :
To exist inverse function of any function that function must be invertible (bijective)
  
Example
Find inverse of f(x) = 5x − 7.
To find inverse of given function it must satisfies the bijectictive function(one to one and onto)
One to one{f()=f() implies =}
Let and be two real numbers (domain)
f(x1)= 5-7
f(x2)=5-7

5-7=5-7
or,5=5
or, = so f(x) is one to one.
Onto {y= f(x)} range =co - domain
Let y be the an element of codomain.
y = 5x-7
x=(y+7)/5 .
Here, f(x)=5x-7
=5(y+7/5)-7 = y
  
f(x)=y
So, f is onto and it exist inverse.
Now,
F(x)=5x-7
Let, y=5x-7
Interchanging variable(x with y and y with x)
x=5y-7
y=x+7/7
i.e. (x)=(x+7)/5
  
Q.N.2
Find the inverse of f(x)= 2x
To find inverse of f(x)=2x it must satisfies the bijective function.
One to one
Let and be two elements of domain.
f()=f()
Implies 2=2
= it is one to one .
Onto
Let y be any element of codomain
y=2x
x=y/2 for all value of y x belongs to R.
So, f(x)=2x =2(y/2)=y
i.e. f (x)=y
So, it is an onto fun. And hence it exists inverse.
Let , y=2x
x=2y { interchanging variables}
y=x/2=inverse function.
  
Does Inverse exist?
f(x)=x2
One to one f()=f() implies =
checking
Let and be two real numbers(domain) f(1)= 12=1
Here , f()= 2 f(-1) = 1 2=1
f()=2
Now, f(x)=x3
f()=f() B

Or, 2=2 A 1 1
-1
Or, 2-2=0 -1
(+)(-)=0 [a2-b2=(a+b)(a-b)] 8
2 -8
Either -=0 implies = -2
9
Or += 0 implies =-
So it is not one to one function
Onto
   [f(x)=y]
f(x)=x2
y=x2 {y be any element of co domain.]
x=
y
[if y =-3,then x= which is not real ]
So x cant be real
f(x) is not onto function .
Hence it doesn’t exist inverse.
……..Continued

Composite function :
A composite function is a function that depends on another function. A composite function is
created when one function is substituted into another function.

For example, f(g(x)) is the composite function that is formed when g(x) is substituted for x in
f(x).
f(g(x)) is read as “f of g of x”.

f(g(x)) can also be written as (f ο g)(x) or fg(x),


In the composition (f ο g)(x), the domain of f becomes g(x).
The following diagram shows some examples of composite functions. Scroll down the page for
more examples and solutions.
….Continued
Let, f : A → B and g : B → C. Then the composition f and g is denoted by g0f defined as g0f : A →C
Example :
If f:A→B = {(1,a), (2,b), (3,c)}
g:B→C = {(a,p), (b,q), (c,r)}
then it follows,
gof
gof = {(1,p), (2,q), (3,r)}
f g

` A B C
1 a p

2 b q

3 c r
1.
  

If g(x)=2x-3,f(x)=x2
Then find i. fog(x)
Solu.
fog(x) = f[g(x)] =f(2x-3)=(2x-3)2= 4x2 -12x+9

x2-4,g(x)=7x-3 then
2. If f(x)=

Find i.fo
ii. g0f(-1/2)

Вам также может понравиться