Unit-1 Set Theory
Unit-1 Set Theory
(Discrete Mathematics)
Introduction
Set is collection of well defined objects. All objects in set are called element of set or member of set.
Objects or member of set are in unordered and all are unique.
All element or objects are write in curly bracket and separated by commas.
Example: A= {1, 2, 3}
Set theory is a branch of mathematics that studies the collection of objects and operation based on it.
Set is labeled as A and 1, 2 and 3 are members of this set. Set are generally denoted by A, B, C, etc. while
member are denoted by a, b, c, x, y, z, etc. if a is member (element) of a set A, then we write aA, which
read as “ a belongs to A”, and bA(read as “ b does not belongs to A”) means b is not a member of the
set A.
Some known sets are
N= the set of natural number = {1, 2, 3, 4, 5, 6 ,….}
Z= the set of all integer number = {…-3,-2,-1, 0, 1, 2, 3….}
W=the set of all whole number = { 0, 1, 2, 3…}
Q= the set of all rational number Example: A= {0.5, 0.32, 0.66} etc.
T= the set of all irrational number
R= the set of all real number
N Z Q R
Method of set
1. Listing method (Roster form)
In this method, objects or elements of the set are explicitly listed separated by commas.
For example A= { 2, 5, 7, 8 } has elements 2,5,7,8.
In listing or roster method no element is repeated. For example, the set of letter of the word
INDEPENDENCE is X= {I, N, D, E, P, C}.
Also the order in which element are listed is not important.
In this method if element is very large, it can be shortened by listing some initial elements
followed by three dots and then some element in the end. For example the set of odd natural
number less than 2000 is represented by {1, 3, 5, …, 1995, 1997, 1999}.
DEPARTMENT OF COMPUTER APPLICATION Page | 1
*Proprietary material of SILVER OAK UNIVERSITY
SUBJECT
(Discrete Mathematics)
In this method, a set is expressed by some common characteristics property P(x) of elements x of
the set. We having notation { x | p(x)}= {x | the property of x}.
For example
If we write, A = {x | x is natural number, x < 8}, then A = { 1, 2, 3, 4, 5, 6, 7}
Type of set
There are different types of sets categorized on various parameters.
1. Empty Set (Null Set)
If the set has no element inside it is called empty set or null set. It is represent by or { }.
For example, A= {x | x is set of natural number, 5 < x < 6}, so there between 5 and 6 no element
is in natural number, hence set A is empty set or null set.
2. Finite Set
A set that has a fixed or finite number of elements inside it is known as finite set. In finite set
element are countable.
Example: A= {1, 5, 8, 10, 15} here set A has 5 elements; hence set A is finite set.
3. Infinite set
A set that has a infinite number of elements inside it is known as infinite set. In infinite set element
are uncountable.
Example: A= {1, 2, 3, 4 …} here set A has unlimited elements, hence set A is infinite set.
4. Singleton set
A set that has only one element inside it is known as singleton set.
Example: A = {x | xN and 4 < x < 6}, so set A= { 5 }, here in set A having only one element.
5. Equivalents Sets
If the number of elements present in two sets are equal known as Equivalent set.
Example: A = {1, 2, 3, 4, 5, 6} and B = {2, 5, 6, 8, 9, 11} here in set A and B number of element is
same so set A and B are equivalent set.
6. Equal Set
If in any two set all elements are same and number of elements is also same so both set are Equal
set.
Example: A = {1,2,3,4} and B = {2,1,4,3}
So in two set A and B number of element and all elements are same so set A and set B are equal
set. We can have represented as A = B.
7. Unequal Sets
If in any set at least one element is differing from the elements of other set, then the two sets are
said unequal set.
Example: A = {1, 2, 3, 4} and B = {1, 2, 5}
Set A and set B are unequal set. We can represent as A B.
8. Overlapping sets
If at least one element of two set are same then the two sets are said to be overlapping sets.
Example; A = {1, 2, 3} and B = {3, 4, 5, 6} so here 3 is in both set A and set B. therefore set A and
set B are overlapping sets.
9. Disjoint sets
If none of the element common between two set, then the two sets are said to be disjoint set.
Example; A = {1, 2, 3} and B = {4, 5, 6}
Apart for the above mentioned sets, there are other sets called, subsets, supersets, universal sets and
power sets.
1. Universal sets
The set that contain all the set called universal set.
Example: A = {1, 2, 3, 4}, B = {3, 4, 5, 6} and C = {6, 7, 8, 9}
So U = {1,2,3,4,5,6,7,8,9} is universal set.
2. Subsets
If A and B are two set and all the element of set A is in set B then we can say A is subset of set
B, and represent by A B.
Here, a A a B
For example, A = {5, 6} and B = {1, 2, 3, 4, 5, 6}
Here all the element of set A is in set B so we can say A is subset of B.
Proper subsets
If two set A and B, here set A is subset of set B and set B is also subset of set A, so
therefore A and B are subset.
Remarks:
Every set is a subset of itself
The number of possible subsets for a given finite set with ‘n’ number of
elements is equal to 2n.
3. Superset
4. Power sets
A set that contains all the subsets as its element is called the Power Set. For Example, if set A =
{1, 2, 3} then its subsets are {Φ}, {1}, {2}, {3}, {1, 2}, {2,3}, {3,1} and {1, 2, 3} then its Power Set is
given as P(A) = {{Φ}, {1}, {2}, {3}, {1, 2}, {2,3}, {3, 1}, {1, 2, 3}}.
As we know the number of possible subsets for a finite set containing n elements is given by
2n then the number of elements in the power set is also 2n.
Sets
Symbol Explanation Symbol Explanation
x is not an element of
x∉A A⊈B A is not a subset of B
set A
There exist or there
∃or ∄ B⊇A B is the superset of A
doesn’t exist
Cardinal Number of
n(A) A⋃B A union B
Set A
Operation
1. Union of Sets
Union of Sets basically refers to uniting two sets and writing their elements in a single set without
repeating elements if common elements are present.
= {1, 4, 7}
2. Intersection of Sets
Intersection of sets refers to finding the common elements between two sets. It is given by A ∩ B.
DEPARTMENT OF COMPUTER APPLICATION Page | 5
*Proprietary material of SILVER OAK UNIVERSITY
SUBJECT
(Discrete Mathematics)
For Example if set A = {1, 4} and B = {4, 7} then A ∩ B = {1, 4} ∩ {4, 7} = {4}.
A∩B
3. Difference of Sets
Difference of Sets refers to the deletion of common elements of two sets and writing down the
remaining elements of two sets. It is represented as A – B.
= {2}
A–B
4. Complement of Set
The complement of a set is the set that includes all the elements of the universal set that are not present
in the give
Cartesian Product of Sets refers to the product between the elements of two sets in ordered pair. It is
given as A ✕ B. For Example, if set A = {1, 4} and B = {4, 7}
The set consisting of all elements which are in set A or in set B, but not in both is called symmetric
difference of the sets A and B.
Properties of Sets
Property Expression
A∪B=B∪A
Commutative Property
A∩B=B∩A
(A ∩ B) ∩ C = A ∩ (B ∩ C)
Associative Property
(A ∪ B) ∪ C = A ∪ (B ∪ C)
A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C)
Distributive Property
A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C)
A∪Φ=A
Identity Property
A∩U=A
De Morgan’s laws
1. The complement of the union of two sets is equal to the intersection of their complements i.e., (A
∪ B)’ = A’ ∩ B’
(A ∪ B)’
2. The complement of the intersection of two sets is equal to the union of their complements i.e., (A
∩ B)’ = A’ ∪ B’
(A ∩ B) Φ
n(A – B) n(A)
Further Y Z, ∀x, x ∈ Y ⇒ x ∈ ZX Z.
∴ ∀x, x ∈ X ⇒ x ∈ Z
∴X Z
Thus the relation between the subset has the transitivity property.
Example 2: U = {1, 2, 3, 4, 5, 6, 7, 8, 9}, A = {1, 2, 3}, B = {2, 3, 4, 5}, C = {5, 6, 7, 8, 9} then Find
I. A∪B
II. A–B
III. (A ∪ B) ∩ C
IV. C∩B
V. (A – B) ∩ (B – C)
Solution:
(1) A ∪ B
= {1, 2, 3} ∪ {2, 3, 4, 5}
= {1, 2, 3, 4, 5}
(2) A – B
= {1, 2, 3} − {2, 3, 4, 5}
= {1}
(3) (A ∪ B) ∩ C
= {1, 2, 3, 4, 5}∩{5, 6, 7, 8, 9}
= {5}
(4) C ∩ B
= {5, 6, 7, 8, 9}∩{2, 3, 4, 5}
= {5}
(5) (A – B) ∩ (B – C)
DEPARTMENT OF COMPUTER APPLICATION Page | 9
*Proprietary material of SILVER OAK UNIVERSITY
SUBJECT
(Discrete Mathematics)
= {1}∩{2, 3, 4}
= {ϕ}
Solution: A × B
= {1, 2} × {2, 3, 4}
= {(1,2), (1,3), (1,4), (2,2), (2,3), (2,4)}
= (A – B ) × ( B – C )
= {1, 3} × {2, 8}
= {(1, 2), (1, 8), (3, 2), (3, 8)}
Example 5: A and B are sets such that n(A ∪ B) = 75, n(A) = 50, n(B) = 30. Find n(A ∩ B).
Solution: n(A ∪ B) = n(A) + n(B) – n(A ∩ B)
∴ 75 = 50 + 30 – n(A ∩ B)
∴ n(A ∩ B) = 80-75
n(A ∩ B) = 5
LHS RHS
=A∪B =B∪A
={2, 3, 4, 5}∪{2,5, 7 } = {2,5, 7 }∪{2, 3, 4, 5}
={2, 3, 4, 5, 7} ={2, 3, 4, 5, 7}
LHS = RHS
(2) A ∩ B = B ∩ A
LHS RHS
=A∩B =B∩A
={2, 3, 4, 5}∩ {2,5, 7 } = {2,5, 7 }∩{2, 3, 4, 5}
={2, 5} ={2, 5}
LHS = RHS
Hence commutative law verified.
Example 8: If U = set of the letter of the “WHEAT”, A = Set of the letter of the “WHAT”, B = Set of the
letter of the “HATE”, C = Set of the letter of the “ETA”, Then find
1. ( A ∩ B ) × (B ∩ C )
2. A ∩ (B − C)
3. (A – B)’
Solution: We have
U = {W, H, E, A, T}
A = {W, H, A, T}, B = {H, A, T, E} and C = {E, T, A}
DEPARTMENT OF COMPUTER APPLICATION Page | 11
*Proprietary material of SILVER OAK UNIVERSITY
SUBJECT
(Discrete Mathematics)
1. ( A ∩ B ) × (B ∩ C )
2. A ∩ (B − C)
= {W, H, A, T} ∩ {H}
= {H}
3. (A – B)’ = U – (A – B)
RELATIONS
Much of mathematics is about finding a pattern – a recognizable link between quantities that change.
In our daily life, we come across many patterns that characterize relations such as brother and sister,
father and son, teacher and student.
In mathematics, also we come across many relations such as number m is less than number n, line l is
parallel to line m, set A is a subset of set B. In all these, we notice that a relation involves pairs of objects
in certain order.
Let A and B be non-empty sets. A binary relation or simply relation from A to B is a subset of A × B.
Suppose that R is a relation from A to B.
Then, R is a set of ordered pairs where each first element comes from A and each second element comes
from B.
That is, for each pair, x ∈A and y ∈ B, exactly one of the following is true.
(x, y) ∈ R, then we say x is R-related to y, written as x R y.
(x, y) ∉ R, then we say x is not R-related to y.
Note: If R is a relation from a set A to itself, that is, if R is a subset of A 2 = A × A, then we say that R is
a relation on A.
Domain
Let R be a binary relation from A to B. Then, the domain is denoted and defined as,
DR = {x ∈ A ∶ (x, y) ∈ R}
Range
Let R be a binary relation from A to B. Then, the range is denoted and defined as,
RR = {y ∈ B ∶ (x, y) ∈ R}
Examples
A familiar example is relation “greater than” for real numbers. This relation is denoted by “>”. In fact,”
>” should be considered as the name of a set whose elements are ordered pairs.
>= {(x, y) ∶ x and y are real numbers and x > y}
The definition of relation permits any set of ordered pairs to define a relation likes = {(2, 4), (1,3), (x, 6),
(veer,∗)}
Here, DR = {2, 1, x, veer} & RR = {4, 3, 6,∗}
This can be understood as A is related to B if there is an arrow from A to B. this method is called an
arrow diagram.
Universal relation
Let A and B be two non-empty sets. Then, A × B , subset of itself, is called universal relation from A to
B.
Example: Let A = {1, 2} and B = {x, y}.
A × B = {{1, x}, {1, y}, {2, x}, {2, y}}
Void relation
Let A and B be two non-empty sets. Then, the empty set {φ} ⊂ A × B is called void (null) relation from
A to B.
Example: Let A = {1,2} and B = {x, y}. Then, the relation presented by the set {∅} is called void (null)
relation.
Let A = {1, 2, 3, 4} and R = {(x, y) ∶ for x, y ∈ A, x − y is an integral multiple of 2} = {(1,3), (3,1), (2,4), (4,2)}
S = {(x, y) ∶ for x, y ∈ A, x − y is an integral multiple of 3} = {(1, 4), (4, 1)}
R ∪ S = {(1, 3), (3, 1), (2, 4), (4, 2), (1, 4), (4, 1)}
R∩S=∅
For complement, let A = {a, b} and B = {1, 2}, then
A × B = {{a, 1}, {b, 1}, {a, 2}, {b, 2}}. Also, Let R = {{a, 1}, {a, 2}, {b, 2}}.
Then, complement relation for R is {{b, 1}}.
Irreflexive
A binary relation R in a set A is said to be irreflexive if, for every x ∈ A, (x, x) ∉ R
Symmetric
A binary relation R in a set A is said to be symmetric if, for every x, y ∈ A, whenever (x, y) ∈ R, then (y,
x) ∈ R
Antisymmetric
A binary relation R in a set A is said to be antisymmetric if, for every x, y ∈ A, whenever (x, y) ∈ R &
(y, x) ∈ R, Then x = y
Transitive
A binary relation R in a set A is said to be transitive if, for every x, y, z ∈ A, whenever (x, y) ∈ R & (y,
z) ∈ R,
Then (x, z) ∈ R
Notes
If relations R and S both are reflexive, then R ∪ S and R ∩ S are also reflexive.
If relations R and S are symmetric and transitive, then R ∩ S is also symmetric and transitive.
FUNCTIONS
Let A and B be two non-empty sets. Suppose that to each element of set A we assign unique element of
set B, then collection of such assignments is called a function from A to B.
Functions are ordinarily denoted by symbols. For example, let f denote a function from A to B. Then,
We write f ∶ A → B.
DEPARTMENT OF COMPUTER APPLICATION Page | 14
*Proprietary material of SILVER OAK UNIVERSITY
SUBJECT
(Discrete Mathematics)
Function deals with linking pair of elements from two sets and then introduce relation between the two
elements in the pair. Practically in every day of our lives, we pair the members of two sets of numbers.
Examples
1. Each hour of the day is paired with the local temperature reading by T.V. Station's weatherman.
2. A teacher often pairs each set of score with the number of students receiving that score to see
more clearly how well the class has understood the lesson.
Figure 2 Figure 1
The relation, from A to B, shown in figure (1) is functions. But a relation, from A to B, shown in figure
(2) is not a function because 4 ∈ A is not in relation to any element of B.
Functions are ordinarily denoted by symbols. For example, let f denote a function from A to B. Then,
We write f ∶ A → B.
The set A is called domain of the function. (i. e. Df = A), The set B is called co-domain of the function.
Example: Let A = {1, 2, 3} and B = {a, b, c, d, e}, then
f = {(1, a), (2, b), (3, c)} is function from A to B.[f ∶ A → B, f(1) = a, f(2) = b, f(3) =[c].
f = {(1, a), (2, b), (3, b)} is function from A to B.[f ∶ A → B, f(1) = a, f(2) = b, f(3) =[b].
f = {(1, a), (2, a), (3, a)} is function from A to B.[f ∶ A → B, f(1) = a, f(2) = a, f(3) = [a].
Notes
If n(A) = m and n(B) = n, then we can create nm different functions from A to B. Any function from R to
R is called a real function.
Range of a function
The set of images of all elements of a domain is called range of a given function.
Example: Let f ∶ N → N, f(x) = 7x i.e. f(1) = 7, f(2) = 14, f(3) = 21, ... ...Here, 7 is an image of 1, 14 is an
image of 2, ... etc.
In above example range of f is Rf = {7, 14, 21, 28, ... }
Constant function
A function whose range is a singleton set is called a constant function.
Thus, a function f ∶ A → B, f(x) = c, ∀x ∈ A where c is a fixed element of B, is called a constant function.
Even function
A function f ∶ A → B is said to be an even function if f(−x) = f(x), ∀x ∈ A.
f ∶ R → R, f(x) = x2 is an even function.
Odd function
A function f ∶ A → B is said to be an odd function if f(−x) = −f(x),∀x ∈ A.
f ∶ R → R, f(x) = x3 is an odd function.
Modulus function
A function f ∶ R → R, f(x) = |x| is called a modulus function or absolute value function defined as,
−x ; x ≥ 0
|x| = { }
−x ; x < 0
The range of this function is R+ ∪ {0}.
𝑓 𝑓 𝑓(𝑥)
The division (quotient) of functions is defined as ∶ (A ∩ B) − {x ∶ g(x) = 0} → R, ( ) (x) = , ∀x ∈ (A ∩
𝑔 𝑔 𝑔(𝑥)
B) − {x ∶ g(x) = 0}
Bijective function
A function is said to be bijective function if it is one to one and onto both.
Inverse of a function
Let f : A → B be a function and if there exist a function g : B → A such that g ∘ f = IA and f ∘ g = IB, then
we say g is the inverse function of f and g is denoted by f −1.
Note: A function f has the inverse function g if and only if f is one to one and onto both.
Examples
Let A = {1, 2, 3}, B = {1, 4, 9} and f : A → B, f = {(1, 1), (2, 4), (3, 9)}, then f −1 : B → A, f−1 = {(1, 1), (4, 2), (9,
3)}
Let f : R → R, f(x) = x + 2. For the inverse of f, let y = x + 2.
x = y − 2 f−1(x) = x – 2
Example 9: A = {1, 2, 3, 4, 5} and B = {2, 4, 6}. A relation S is given by S = {(x, y)| the difference between
x and y is even, xA, yB} Write relation in listed form.
Solution: The difference between x and y is even
S = {(2, 2), (4, 2), (4, 4)}
Example 10: Let f(x) = 2x + 1 and g(x) = x2 be function from R to R then find f ∘ f, g ∘ f, f ∘g.
Solution: f(x) = 2x + 1 and g(x) = x2
1. f ∘ f(x) = f(f(x))
= f(2x + 1)
=2(2x + 1) + 1
= 4x + 2 + 1
= 4x + 3
2. g ∘ f(x) = g(f(x))
= g(2x + 1)
= (2x + 1)2
3. f ∘ g = f(g(x))
= f(x2)
= 2x2 + 1
Example 11: Let f(x) = x + 5 function from R to R then find f(1), f(-2) and f(5).
Solution: we have function f(x) = x + 1
So,
DEPARTMENT OF COMPUTER APPLICATION Page | 19
*Proprietary material of SILVER OAK UNIVERSITY
SUBJECT
(Discrete Mathematics)
f(1) = 1 + 5 = 6
f(-2) = -2 + 5 = 3
f(5) = 5 + 5 = 10
𝑓(2)−𝑓(1)
Example 12: Let f(x) = x + 1 function from R to R then find .
𝑓(0).𝑓(5)
Library management:
Suppose you're developing a computer application for managing a library. You can use these concepts
as follows:
Sets: The set of all books in the library, the set of all library members, the set of available books, etc.
Relations: A relation between books and their authors, a relation between library members and the
books they've borrowed.
Functions: A function that calculates the late fee for a borrowed book based on the number of days it's
overdue (e.g., late fee (days overdue)), or a function that checks if a book is available for borrowing
(e.g., is available (book)).
These mathematical concepts form the basis for modelling and solving various real-world problems in
computer applications
Relations:
• A relation between users and the posts they've liked or shared.
• A relation between users and their friends (friendship status).
• A relation between posts and the users who have commented on the.
Functions:
• A function that recommends posts to a user based on their interests and the posts their friends have
interacted with.
• A function that calculates a user's activity score based on their posts, likes, and comments.
• A function that determines the shortest path between two users in the friend network (used for friend
suggestions).
E-commerce Website
Sets:
• Set of products available for sale.
• Set of customers.
• Set of orders placed by customers.
Relations:
• A relation between customers and their orders.
• A relation between products and customer reviews.
• A relation between products and categories.
Functions:
• A function that calculates the total cost of items in a customer's shopping cart.
• A function that generates product recommendations for a customer based on their purchase history.
• A function that tracks inventory and updates product availability after an order is placed.
In these examples, sets, relations, and functions are used to model and manage data and interactions
within social networking platforms and e-commerce websites. They help in organizing and processing
information, making recommendations, and providing valuable features to users.
Cryptography
Sets:
• Key Sets: In cryptography, sets can represent various sets of keys used for encryption and decryption.
For example: a set of public keys or private keys.
• Message Sets: Sets can represent the possible messages or plaintexts that need to be encrypted or
decrypted.
Relations:
• Encryption Relations: Cryptographic algorithms often involve relations between plaintext and cipher
text. For example, in symmetric key encryption, the relation is between the plaintext and the cipher text
using the same secret key.
• Hash Functions: Cryptographic hash functions establish a relation between input data (message) and
a fixed-size hash value.
Functions:
• Encryption and Decryption Functions: Cryptographic systems heavily rely on functions for
encryption and decryption. For example, the encryption functions in RSA or the AES encryption
function.
Zomoto Application
In the context of a food delivery and restaurant discovery application like Zomato, sets, relations, and
functions play essential roles in various aspects of the platform. Here's how they can be applied:
Sets:
• Set of Restaurants: Zomato maintains a set of restaurants listed on its platform. Each restaurant is a
distinct element in this set.
• Set of Users: The application keeps a set of registered users who can place orders and leave reviews.
• Set of Cuisines: There is a set of cuisine types offered by different restaurants, such as Indian, Italian,
Chinese, etc.
Relations:
• User-Restaurant Relations: Zomato establishes relations between users and the restaurants they've
ordered from, reviewed, or favourite.
• Order-Item Relations: There are relations between customer orders and the specific items they've
ordered from a restaurant's menu.
• Review-Restaurant Relations: Relations connect user reviews to the restaurants they reviewed.
Functions:
• Recommendation Functions: Zomato uses functions to recommend restaurants or dishes to users
based on their previous orders, reviews, and preferences.
• Search Functions: Functions are employed to search for restaurants based on criteria like location,
cuisine, ratings, and opening hours.
• Order Processing Functions: Functions handle order processing, calculating costs, and notifying
restaurants and users.
• Rating and Review Functions: Functions allow users to rate and review restaurants and dishes, and
then aggregate and display these ratings.
Here's a specific example of how these concepts come into play in the Zomato application.
Sets, relations, and functions are fundamental to user interactions, content discovery, and
communication. They enable users to connect with others, share content, and engage with the
platform's features seamlessly. These mathematical concepts underpin the algorithms and systems that
power WhatsApp and Instagram many more.