Professional Documents
Culture Documents
Unit-1
BCA-102.
Unit 1- Sets, Relations & Functions.
Unit- 1: Syllabus
SETS: Sets, Subsets, Equal Sets Universal Sets, Finite and Infinite Sets,
Operation on Sets, Union, Intersection and Complements of Sets,
Cartesian Product, Cardinality of Set, Simple Applications.
RELATIONS AND FUNCTIONS: Properties of Relations, Equivalence
Relation, Partial Order Relation Function: Domain and Range, Onto, Into
and One to One Functions, Composite and Inverse Functions, Hashing
functions, Recursive function.
[No. of Hrs: 11]
Sets.
A set is a collection of well defined elements or objects.
Eg:
● {1, 2, 3}
● { x : x is a real number} = R
● { x : X is an integer and x>1} = {2, 3, 4, 5, 6, ……}
Different Notations in Sets
O → Odd numbers
P → Prime numbers
Q. Write five empty sets with mathematical condition & non mathematical
condition, each.
● Finite Sets: Finite sets are the sets having a finite/countable number of
members.
● Cardinality : The cardinality of a set is its size. For a finite set, the
cardinality of a set is the number of members it contains. In symbolic
notation the size of a set S is written |S|.
Symmetric Difference : The symmetric difference of two sets S and T is the
set of objects that are in one and only one of the sets.
S∆T = (S - T) U (T - S) = (T - S) U (S - T)
S = { a,b,c,d,e } T = { b,c }
S - T = { a,d,e } T-S=ɸ
Power Set : The set of all subsets of a set S is called the powerset of S. The
notation for the powerset of S is P(S)
S = { a,b,c}
ɸ is subset of S, and so are: {a}, {b}, {c}, {a,b}, {b,c}, {a,c}, {a,b,c}.
{ {a}, {b}, {c}, {a,b}, {b,c}, {a,c}, {a,b,c} } = P(S) = Power Set of S
Q: ‘inbox’ S = {i,n,b,o,x} Write power set of S.
To prove 2 sets are equal, we can prove they are subset of each other. But,
A = {1,2,3} is equal to B = {1,2,3,3} because A⊆B and B⊆A
● (S U T)c = Sc ∩ Tc
Let x ∈ (S U T)c
⇔ x ∉S U T
⇔ x ∉S & x ∉ T
⇔ x ∈ S c & x ∈ Tc
⇔ x ∈ S c ∩ Tc
⇔ (S U T)c ⊆ Sc ∩ Tc → (1)
Similarly,
Let x ∈ SC∩TC
=> SC∩TC ∈ (S U T)C → (2)
Using (1) and (2)
(S U T)C = SC∩TC
Alternate:
=> x ∈ SC∩TC
=> x ∈ SC & x ∈ TC
=> x ∉ S & x ∈ T
=> x ∉ S U T
=> x ∈ ( S U T )C
{ 2K + 1; 0 ≤ K ≤ 49 } = EC
Q. Disprove A Δ ( B U C ) = ( A Δ B ) U C
Let x ∈ L.H.S
L.H.S [A-(BUC)]U[(BUC)-A]
A = { 1,2,3 } C = { c,d }
B = { a,b } U = { 1,2,3,a,b,c,d }
=> x ∈ [ A - ( B U C ) ] or
=> x ∈ [ ( B U C ) - A ] or
A∩B=ϕ
● Mutually Disjoint
The sets in A are mutually disjoint if no two of them have any elements in
common.
1≤i j≤n
Solution:
| A U B | = |A| + |B| - | A ∩ B |
= 60 + 35 - 15
= 80
If
A = Ø , B = Ø then A × B = Ø
A ≠ Ø , B = Ø then A × B = Ø
A = Ø , B ≠ Ø then A × B = Ø
#
2
B=A; A×A=A
|A| = m ,|B| = n ,|A × B| = m × n
A = {1 , 2 , 3} , B = {a , b}
A × B = { (1 , a) , (2 , a) , (2 , b) , (1 , b) , (3 , b) , (3 , a) }
Q. A × B ≠ B×A?
Relation : Let A and B be two sets .
Then a subset R of A × B is called a Relation in A and B.
If
(a , b) ∈ A × B ⇔ a is related to b by R .
⇔aRb
⇔a~b
R1 ⊆ A × B
R1 is a relation in A and B .
1~a,2~a
{ (1 , a) , (2 , a) , (3 , a) , (2 , b) } = R2 ⊆ A × B
1~a,2~a,3~a,2~b
A = {1 , 2 , 3}
| A ×A | = 9
29 = 512
# Equivalence Relation :
Relation R on a set A is said to be an equivalence relation if it satisfies the
following conditions :
(1) Reflexivity : (a , a) ∈ R for all a ∈ A
(2) Symmetry : (a , b) ∈ R => (b , a) ∈ R for all a,b ∈ A
(3) Transitivity : (a , b) ∈ R & (b , c) ∈ R
=> (a , c) ∈ R for all a,b,c ∈ A
# A = {1 , 2 , 3} : A ×A = { }
R1 = { (1 , 1) , (1 , 2) , (2 , 1) , (2 , 2) , (3 , 3) }
is R1 an equivalence relation ?
(1 , 1) , (2 , 2) , (3 , 3) R => Reflexive .
=> R1 is Symmetric .
(1 , 1) , (1 , 2) ∈ R1 => (1 , 2) ∈ R1
(1 , 1) , (2 , 1) ∈ R1 => (1 , 1) ∈ R1
(1 , 2) , (2 , 2) ∈ R1 => (1 , 2) ∈ R1
(2 , 2) , (2 , 1) ∈ R1 => (2 , 1) ∈ R1
# Let X be a Set and S = { A : A ⊆ X }
Q R is a relation on S
R ⊆ S x S , R = { (A , B) : A ⊆ B ; A,B ∈ S }
Is R an Equivalence Relation .
R = { (a , b) : a,b ∈ T , a is congruent to b }
Is R an equivalence relation?
(a , a) ∈ R because every △ is congruent to itself .
=> R Reflexive
(a , b) ∈ R => (b , a) ∈ R
(a , b) , (b , c) ∈ R => (a , c) ∈ R
a ≅ b , b ≅ c => (a , c) ∈ R
=> a ≅ c
The Congruence Modulo Relation
If ‘m’ is a fixed integer, then the integers ‘a’ and ‘b’ are said to be
OR
To show reflexivity:
⇒ a-a = mk
To show symmetricity:
Where k is an integer.
Example:
Then,
Equivalence Classes
Example:
Sol:
[PTO]
❏ Every equivalence relation divides the set it is defined
upon into equivalence classes/ partitions.
Example:
Practice and examples
❏ Let Rₘ be the relation defined as “congruent modulo m” relation defined
on .
Is R an equivalence relation?
* Graphical representation of a relation on a finite set:
MR =
x∈A , y∈B
* A = {1,2,3} , B=(a,b,c,d,e}
f = { (1,a) , (2,c) , (3,b) }
Dom f = {1,2,3} , Range f = {a,c,b}
* Dom f = { x∈ A : (x f( x1) ∈d}
*Range f = { f(x) : x∈ A }
# Types of mapping :
1) One - One function / injective function :
f : A ---> B be a one - one function if
f (x1 ) = f( x2)
=> x = y - b
a
=> F(x) = Y => f is onto.
f = { x,y) : y = x , -∞ <x< ∞ }
f(x) = { (x,y) : y ≡ x mod 3 }
Bijective Function:
injective + surjective
A function is said to be bijective or bijection, if a function f: A → B satisfies
both the injective (one-to-one function) and surjective function (onto
function) properties.
It means that every element “b” in the codomain B, there is exactly one
element “a” in the domain A. such that f(a) = b.
For example:
Composition of Functions
Any two functions f and g are said to be composite functions iff the Range of g
is equal to the Domain of f.
f∘g = f( g(x) )
={ (1,α) , (2,α) , (3,γ) , (4,α) }
Q. A= ( 1, 2 , 3 ) ; R= { (1,1) , (1,2) , (2,3) , (3,1) }
Find self-composition of function.
1 1 1 1
2 2 2 2
3 3 3 3
R
R∘R R∘R∘R ?
R3= R∘R∘R = { (1,1) , (1,2) , (1,3) , (2,1) , (2,2) , (3,1) , (3,2) , (3,3) }
● In previous slide, R3 is relatively closed,
● R3 is not symmetrically closed.
Hashing Function:
H:K L is a Hashing function if it is one-to-one.
{ if K1 = K2 => H(K1) = H(K2) }
➢ In other words, a collision free function is called a Hash function.