0% found this document useful (0 votes)
54 views23 pages

Unit-1 Set Theory

Set theory

Uploaded by

dhruvraj1002
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views23 pages

Unit-1 Set Theory

Set theory

Uploaded by

dhruvraj1002
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

SUBJECT

(Discrete Mathematics)

SEMESTER: 1st PREPARED BY: A/P. Keyuri Shah

CHAPTER 1 Set Theory


History of set theory
The concept of set theory was propounded in the year 1874 by Georg Cantor in his paper name ‘on a
property of collection of all real algebraic number’. His concept of set theory was later used by other
mathematicians in giving various other theories such as Klein’s Encyclopedia and Russell Paradox.

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 aA, which
read as “ a belongs to A”, and bA(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)

SEMESTER: 1st PREPARED BY: A/P. Keyuri Shah

2. Property method ( Set builder form)

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}

Cardinal number of set


The number of the elements preset in a set is called cardinal number of a set. For example A is set of
first five even number given by A = {2, 4, 6 8, 10}, then the cardinal number of set A is 5.
It’s represented by n(A) or |A| = 5.

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 | xN and 4 < x < 6}, so set A= { 5 }, here in set A having only one element.

DEPARTMENT OF COMPUTER APPLICATION Page | 2


*Proprietary material of SILVER OAK UNIVERSITY
SUBJECT
(Discrete Mathematics)

SEMESTER: 1st PREPARED BY: A/P. Keyuri Shah

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.

DEPARTMENT OF COMPUTER APPLICATION Page | 3


*Proprietary material of SILVER OAK UNIVERSITY
SUBJECT
(Discrete Mathematics)

SEMESTER: 1st PREPARED BY: A/P. Keyuri Shah

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 set A is subset of set B, but set B isn’t subset of set A.


 Improper subset

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

 An empty Set is a subset of every set.

 The number of possible subsets for a given finite set with ‘n’ number of
elements is equal to 2n.

3. Superset

If all the element of set A is in set B then set B is superset then A  B.


 Every set is a superset of itself.

 Every set is a superset of an empty set.

 Total number of possible supersets for a given subset is infinite

 If B is a superset of A then A is a subset of B

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.

DEPARTMENT OF COMPUTER APPLICATION Page | 4


*Proprietary material of SILVER OAK UNIVERSITY
SUBJECT
(Discrete Mathematics)

SEMESTER: 1st PREPARED BY: A/P. Keyuri Shah

Sets
Symbol Explanation Symbol Explanation

{ } Set A⊂B A is the Proper subset of B

x∈A x is an element of set A A⊃B B is the Proper subset of A

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

Φ Empty Set B⊃A B is a proper superset of A

A=B Equal Sets B⊉A B is not a superset of A

Cardinal Number of
n(A) A⋃B A union B
Set A

P(A) Power Set A⋂B A intersection B

A⊆B A is a subset of B A’ Complement of 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.

The union of sets is given by A ⋃ B.

For Example if Set A = {1, 4} and Set B = {4, 7}

Then A ⋃ B = {1, 4} ⋃ {4, 7}

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

SEMESTER: 1st PREPARED BY: A/P. Keyuri Shah

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.

For Example if Set A = {2, 4} and B = {4, 6}

Then A – B = {2, 4}–{4, 6}

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

Set. It is given by A’.

DEPARTMENT OF COMPUTER APPLICATION Page | 6


*Proprietary material of SILVER OAK UNIVERSITY
SUBJECT
(Discrete Mathematics)

SEMESTER: 1st PREPARED BY: A/P. Keyuri Shah

5. Cartesian product of Sets

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}

Then A ✕ B = {(1, 4), (1, 7), (4, 4), (4, 7)}.

6. Symmetric difference set

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.

Symmetric difference of set A and B denoted by A △ B.


A △ B = (A ⋃ B) – (A ⋂ B)

Properties of Sets
Property Expression

A∪B=B∪A
Commutative Property
A∩B=B∩A

DEPARTMENT OF COMPUTER APPLICATION Page | 7


*Proprietary material of SILVER OAK UNIVERSITY
SUBJECT
(Discrete Mathematics)

SEMESTER: 1st PREPARED BY: A/P. Keyuri Shah

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

Number of element of finite set

n(A ∪ B) n(A) + n(B) – n(A ∩ B)

n(A ∩ B) n(A) + n(B) – n(A ∪ B)

n(A) n(A ∪ B) + n(A ∩ B) – n(B)

n(B) n(A ∪ B) + n(A ∩ B) – n(A)

n(A – B) n(A ∪ B) – n(B)

n(A – B) n(A) – n(A ∩ B)

n(A) + n(B) + n(C) – n(A∩B) – n(B∩C)


n(A ∪ B ∪ C)
– n(C∩A) + n(A∩B∩C)

DEPARTMENT OF COMPUTER APPLICATION Page | 8


*Proprietary material of SILVER OAK UNIVERSITY
SUBJECT
(Discrete Mathematics)

SEMESTER: 1st PREPARED BY: A/P. Keyuri Shah

If two sets A and B are disjoint sets

n(A ∪ B) n(A) + n(B)

(A ∩ B) Φ

n(A – B) n(A)

Example 1: Prove that X ⊂ Y and Y  Z  X  Z.

Solution: Since X ⊂ Y, ∀x, x ∈ X ⇒ x ∈ Y

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} ∪ {2, 3, 4, 5})∩{5, 6, 7, 8, 9}

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

SEMESTER: 1st PREPARED BY: A/P. Keyuri Shah

= ({1, 2, 3} − {2, 3, 4, 5}) ∩ ({2, 3, 4, 5} – {5, 6, 7, 8, 9})

= {1}∩{2, 3, 4}

= {ϕ}

Example 3: If A = {1, 2} and B = {2, 3, 4}, find A × B.

Solution: A × B

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

Example 4: If A = {1, 2, 3} B = {2, 4, 6, 8} and C = {4, 5, 6}, find (A – B ) × ( B – C ).


Solution: A–B = {1, 2, 3} – {2, 4, 6, 8}
= {1, 3}
B – C = {2, 4, 6, 8} – {4, 5, 6}
= {2, 8}
Now,

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

Example 6: If A = {1, 3, 5, 7} and B = {2, 4 }, verify n(A × B) = n(A). n(B).


Solution: Let A = {1, 3, 5, 7} , B = {2, 4 }

DEPARTMENT OF COMPUTER APPLICATION Page | 10


*Proprietary material of SILVER OAK UNIVERSITY
SUBJECT
(Discrete Mathematics)

SEMESTER: 1st PREPARED BY: A/P. Keyuri Shah

Here A × B = {(1,2), (1,4), (3,2), (3,4), (5,2), (5,4), (7,2), (7,4)}


n(A × B) = 8

∴ n(A) = 4 and n(B) = 2


∴ n(A). n(B) = 4.2 = 8
Hence,

n(A × B) = n(A). n(B).

Example 7: If A = {2, 3, 4, 5} and B = {2, 5, 7}, Verify commutative law.


Solution:
Commutative law
(1) 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, 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)

SEMESTER: 1st PREPARED BY: A/P. Keyuri Shah

1. ( A ∩ B ) × (B ∩ C )

= ({W, H, A, T} ∩ {H, A, T, E}) × ({H, A, T, E} ∩ {E, T, A})

= {H, A, T}× {A, T, E}


= {(H,A), (H,T), (H,E), (A,A), (A,T), (A,E) ,(T,A), (T,T), (T,E)}

2. A ∩ (B − C)

= {W, H, A, T} ∩ ({H, A, T, E} − {E, T, A})

= {W, H, A, T} ∩ {H}
= {H}
3. (A – B)’ = U – (A – B)

= {W, H, E, A, T} - ({W, H, A, T} - {H, A, T, E})


= {W, H, E, A, T} – {W}
= {H, E, A, T}

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}

DEPARTMENT OF COMPUTER APPLICATION Page | 12


*Proprietary material of SILVER OAK UNIVERSITY
SUBJECT
(Discrete Mathematics)

SEMESTER: 1st PREPARED BY: A/P. Keyuri Shah

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,∗}

Visual Representation of Relation


Let Relation from A to B is given by S = {(1, A), (2, B), (3, D), (4, C)}

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.

Union, intersection and complement operations on relations

DEPARTMENT OF COMPUTER APPLICATION Page | 13


*Proprietary material of SILVER OAK UNIVERSITY
SUBJECT
(Discrete Mathematics)

SEMESTER: 1st PREPARED BY: A/P. Keyuri Shah

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

Properties of binary relations in a set


Reflexive
A binary relation R in a set A is said to be reflexive if, for every x ∈ A, (x, x) ∈ R

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)

SEMESTER: 1st PREPARED BY: A/P. Keyuri Shah

The set A is called domain of the function. (i. e. Df = A)


The set B is called co-domain of the function.

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.

Finally, we shall learn about special relations called functions.


The function is a special relation from one set to another set, in which every element of first set is in
relation (uniquely) with the elements of another set.

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.

DEPARTMENT OF COMPUTER APPLICATION Page | 15


*Proprietary material of SILVER OAK UNIVERSITY
SUBJECT
(Discrete Mathematics)

SEMESTER: 1st PREPARED BY: A/P. Keyuri Shah

A program written in a high-level language is mapped into a machine language by a compiler.


Similarly, the output from a computer is a function of its input.

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, ... }

Some standard functions


Identity function
Let A be a non-empty set. The function f ∶ A → A define by f(x) = x, ∀x ∈ A is called an identity function
on A. Also, an identity function on A is denoted by I A.
This function maps any element of A onto itself. For this function, the range is entire co-domain.

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

DEPARTMENT OF COMPUTER APPLICATION Page | 16


*Proprietary material of SILVER OAK UNIVERSITY
SUBJECT
(Discrete Mathematics)

SEMESTER: 1st PREPARED BY: A/P. Keyuri Shah

Least integer function (Ceiling function)


A function f ∶ R → R, f(x) = ⌈x⌉, ∀x ∈ R is called a ceiling function defined as,⌈x⌉ = least integer not less
than x
⌈1.2⌉ = 2,⌈2⌉ = 2,⌈−1.7⌉ = −1, ... ... etc.
The range of this function is Z.

Algebra of real functions


Let f ∶ A → R and g ∶ B → R are two functions with A ∩ B ≠ φ. Then, The addition of functions is defined
as
(f + g) ∶ (A ∩ B) → R, (f + g)(x) = f(x) + g(x), ∀x ∈ A ∩ B
The subtraction of functions is defined as (f − g) ∶ (A ∩ B) → R, (f − g)(x) = f(x) − g(x), ∀x ∈ A ∩ B
The multiplication of functions is defined as (f ∙ g) ∶ (A ∩ B) → R, (f ∙ g)(x) = f(x) ∙ g(x), ∀x ∈ A ∩ B

𝑓 𝑓 𝑓(𝑥)
The division (quotient) of functions is defined as ∶ (A ∩ B) − {x ∶ g(x) = 0} → R, ( ) (x) = , ∀x ∈ (A ∩
𝑔 𝑔 𝑔(𝑥)
B) − {x ∶ g(x) = 0}

Injective function (one to one function)


A function f ∶ A → B is called a one to one (injective) function if distinct elements of A are mapped into
distinct elements of B. In other words, f is one to one if ∀x1, x2 ∈ A
x1 ≠ x2 ⟹ f(x1) ≠ f(x2) or f(x1) = f(x2) ⟹ x1 = x2

A function, shown in figure is a one to one function.


Example: Let A = {1, 2, 3}, B = {1, 2, 3, 4, 5, 6}. Then,
f ∶ A → B, f = {(1, 2), (2, 4), (3, 6)} is a one to one function.
f ∶ A → B, f = {(1, 2), (2, 2), (3, 6)} is not a one to one function. [f(1) = 2 & f(2) = 2]
f ∶ R → R, f(x) = 2x + 3 is a one to one function.

Surjective function (onto function)


A function f ∶ A → B is called an onto (surjective) if Rf = B(Range of f = Co-domain of f ).
Notes

DEPARTMENT OF COMPUTER APPLICATION Page | 17


*Proprietary material of SILVER OAK UNIVERSITY
SUBJECT
(Discrete Mathematics)

SEMESTER: 1st PREPARED BY: A/P. Keyuri Shah

If a given function is not an onto function, then it is called an into function.

A function, shown in figure is an onto function.


Example: Let A = {1, 2, 3}, B = {1, 4, 9}. Then,
f ∶ A → B, f = {(1, 1), (2, 4), (3, 9)} is an onto function.
f ∶ A → B, f = {(1, 4), (2, 9), (3, 4)} is not an onto function. [R f = {4, 9} ≠ B]
f ∶ N → N, f(n) = n + 2 is not an onto function. [R f = {3, 4, 5, 6, ...} ≠ N(co-domain)]

Bijective function
A function is said to be bijective function if it is one to one and onto both.

Composition of two functions


Consider functions f ∶ A → B and g ∶ C → D. Then, we may define g ∘ f ∶ A → D, called the composition
of f & g, as follows.
(g ∘ f) (x) = g(f(x)), x ∈ A, where B ⊆ C
That is, we find the image of x under f and then find the image of f(x) under g.
Note: Similarly, we can define f ∘ g.

Example: Let f, g ∶ R → R, f(x) = x + 2 and g(x) = x − 2, then


(g ∘ f)(x) = g(f(x)) = g(x + 2) = (x + 2) − 2 = x
(f ∘ g)(x) = f(g(x)) = f(x − 2) = (x − 2) + 2 = x

Properties of composition of functions


Let f ∶ A → B, then f ∘ IA = f = IB ∘ f.
Let the function f ∶ A → B and g ∶ B → C satisfy g ∘ f = IA & f ∘ g = IB then g is unique.
In general, f ∘ g ≠ g ∘ f.
Let the function f ∶ A → B and g ∶ B → C, then
If f and g are one to one functions, then g ∘ f is also one to one function.
If f and g are onto functions, then g ∘ f is also onto function.

DEPARTMENT OF COMPUTER APPLICATION Page | 18


*Proprietary material of SILVER OAK UNIVERSITY
SUBJECT
(Discrete Mathematics)

SEMESTER: 1st PREPARED BY: A/P. Keyuri Shah

In usual notation, ( g∘ f )−1(x) = ( f−1∘ g−1)(x).

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, xA, yB} 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)

SEMESTER: 1st PREPARED BY: A/P. Keyuri Shah

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)

Solution: we have function f(x) = x + 1


So,
f(1) = 1 + 1 = 2
f(2) = 2 + 1 = 3
f(5) = 5 + 1 = 6
f(0) = 0 + 1 = 1
Then
𝑓(2)−𝑓(1) 3−2 1
𝑓(0).𝑓(5)
= (1)(6)
= 6.

Application of Set, Relation and Function


Computer applications:
Sets can be used to represent data structures like arrays, lists, or sets in programming languages.
Relations can be employed to model relationships between data entities, such as in databases or graph
data structures.
Functions are essential for defining algorithms and performing computations. They are commonly
used in programming to transform input data into output data.

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

DEPARTMENT OF COMPUTER APPLICATION Page | 20


*Proprietary material of SILVER OAK UNIVERSITY
SUBJECT
(Discrete Mathematics)

SEMESTER: 1st PREPARED BY: A/P. Keyuri Shah

Social Networking Platform


Sets:
• Set of users on the platform.
• Set of posts or content shared on the platform.
• Set of user interests or categories.

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.

DEPARTMENT OF COMPUTER APPLICATION Page | 21


*Proprietary material of SILVER OAK UNIVERSITY
SUBJECT
(Discrete Mathematics)

SEMESTER: 1st PREPARED BY: A/P. Keyuri Shah

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.

DEPARTMENT OF COMPUTER APPLICATION Page | 22


*Proprietary material of SILVER OAK UNIVERSITY
SUBJECT
(Discrete Mathematics)

SEMESTER: 1st PREPARED BY: A/P. Keyuri Shah

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.

DEPARTMENT OF COMPUTER APPLICATION Page | 23


*Proprietary material of SILVER OAK UNIVERSITY

You might also like