0% found this document useful (0 votes)
83 views43 pages

MFCS Unit - 2

The document defines basic concepts of set theory, including: 1) A set is an unordered collection of elements that can be represented in roster or set builder notation. 2) There are different types of sets such as finite, infinite, subset, universal, and empty sets. 3) Set operations include union, intersection, difference, and complement. Venn diagrams can be used to represent relationships between sets.

Uploaded by

paavanmoksha
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)
83 views43 pages

MFCS Unit - 2

The document defines basic concepts of set theory, including: 1) A set is an unordered collection of elements that can be represented in roster or set builder notation. 2) There are different types of sets such as finite, infinite, subset, universal, and empty sets. 3) Set operations include union, intersection, difference, and complement. Venn diagrams can be used to represent relationships between sets.

Uploaded by

paavanmoksha
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/ 43

UNIT -2

Set Theory

VEMU, Dept of CSE Page 35


1. Basic Concepts of Set-Theory
Set – Definition

A set is an unordered collection of different elements. A set can be written explicitly by listing its
elements using set bracket. If the order of the elements is changed or any element of a set is
repeated, it does not make any changes in the set.

Some Example of Sets

• A set of all positive integers


• A set of all the planets in the solar system
• A set of all the states in India
• A set of all the lowercase letters of the alphabet

Representation of a Set

Sets can be represented in two ways −

• Roster or Tabular Form


• Set Builder Notation

Roster or Tabular Form

The set is represented by listing all the elements comprising it. The elements are enclosed within
braces and separated by commas.

Example 1 − Set of vowels in English alphabet, A = {a,e,i,o,u}

Example 2 − Set of odd numbers less than 10, B = {1,3,5,7,9}

Set Builder Notation

The set is defined by specifying a property that elements of the set have in common. The set is
described as A = { x : p(x)}

Example 1 − The set {a,e,i,o,u} is written as −

A = { x : x is a vowel in English alphabet}

Example 2 − The set {1,3,5,7,9} is written as −

B = { x : 1≤x<10 and (x%2) ≠ 0}

VEMU, Dept of CSE Page 36


If an element x is a member of any set S, it is denoted by x ∈ S and if an element y is not a
member of set S, it is denoted by y ∉ S.

Example − If S = {1, 1.2, 1.7, 2}, 1 ∈ S but 1.5 ∉ S

Some Important Sets

N − the set of all natural numbers = {1, 2, 3, 4, ..... }

Z − the set of all integers = {....., −3, −2, −1, 0, 1, 2, 3, ..... }

Z+ − the set of all positive integers

Q − the set of all rational numbers

R − the set of all real numbers

W − the set of all whole numbers

Cardinality of a Set

Cardinality of a set S, denoted by |S|, is the number of elements of the set. If a set has an infinite
number of elements, its cardinality is ∞.

Example − |{1, 4, 3, 5}| = 4, |{1, 2, 3, 4, 5,…}| = ∞

If there are two sets X and Y,

• |X| = |Y| represents two sets X and Y that have the same cardinality, if there exists a
bijective function ‘f’ from X to Y.
• |X| ≤ |Y| represents set X has cardinality less than or equal to the cardinality of Y, if there
exists an injective function ‘f’ from X to Y.
• |X| < |Y| represents set X has cardinality less than the cardinality of Y, if there is an
injective function f, but no bijective function ‘f’ from X to Y.
• If |X| ≤ |Y| and |X| ≤ |Y| then |X| = |Y|

Types of Sets

Sets can be classified into many types. Some of which are finite, infinite, subset, universal,
proper, singleton set, etc.

Finite Set

A set which contains a definite number of elements is called a finite set.

Example − S = {x | x ∈ N and 70 > x > 50}

VEMU, Dept of CSE Page 37


Infinite Set

A set which contains infinite number of elements is called an infinite set.

Example − S = {x | x ∈ N and x > 10}

Subset

A set Y is a subset of set X (Written as X ⊆ Y) if every element of X is an element of set Y.

Example 1 − Let, X = { 1, 2, 3, 4, 5, 6 } and Y = { 1, 2 }. Here set Y is a subset of set X as all


the elements of set Y is in set X. Hence, we can write Y ⊆ X.

Example 2 − Let, X = {1, 2, 3} and Y = {1, 2, 3}. Here set Y is a subset (Not a proper subset) of
set X as all the elements of set Y is in set X. Hence, we can write Y ⊆ X.

Proper Subset

The term “proper subset” can be defined as “subset of but not equal to”. A Set X is a proper
subset of set Y (Written as X ⊂ Y) if every element of X is an element of set Y and |X| < |Y|.

Example − Let, X = {1, 2, 3, 4, 5, 6} and Y = {1, 2}. Here set Y is a proper subset of set X as at
least one element is more in set X. Hence, we can write Y ⊂ X.

Universal Set

It is a collection of all elements in a particular context or application. All the sets in that context
or application are essentially subsets of this universal set. Universal sets are represented as U.

Consider the following sets.


A = {x : x is a student of your school}
B = {y : y is a male student of your school}
C = {z : z is a female student of your school}
D = {a : a is a student of class XII in your school}
Clearly the set B, C, D are all subsets of A.

A can be considered as the universal set for this particular example. Universal set is generally
denoted by U.
In a particular problem a set U is said to be a universal set if all the sets in that problem are
subsets of U.

Example1 − We may define U as the set of all animals on earth. In this case, set of all mammals
is a subset of U, set of all fishes is a subset of U, set of all insects is a subset of U, and so on.

VEMU, Dept of CSE Page 38


Note:

1. Universal set does not mean a set containing all objects of the universe.
2. A set which is a universal set for one problem may not be a universal set for another
problem.
Example2 :
Which of the following set can be considered as a universal set ?
X = {x : x is a real number}
Y= {y : y is a negative integer}
Z = {z : z is a natural number}
Solution : As it is clear that both sets Y and Z are subset of X
∴ X is the universal set for this problem
Empty Set or Null Set

An empty set contains no elements. It is denoted by ∅. As the number of elements in an empty


set is finite, empty set is a finite set. The cardinality of empty set or null set is zero.

Example − ∅ = {x | x ∈ N and 7 < x < 8}

Singleton Set or Unit Set

Singleton set or unit set contains only one element. A singleton set is denoted by {s}.

Example − S = {x | x ∈ N, 7 < x < 9}

Equal Set

If two sets contain the same elements they are said to be equal.

Example − If A = {1, 2, 6} and B = {6, 1, 2}, they are equal as every element of set A is an
element of set B and every element of set B is an element of set A.

Equivalent Set

If the cardinalities of two sets are same, they are called equivalent sets.

Example − If A = {1, 2, 6} and B = {16, 17, 22}, they are equivalent as cardinality of A is equal
to the cardinality of B. i.e. |A| = |B| = 3

Overlapping Set

Two sets that have at least one common element are called overlapping sets.

VEMU, Dept of CSE Page 39


In case of overlapping sets −

• n(A ∪ B) = n(A) + n(B) − n(A ∩ B)


• n(A ∪ B) = n(A − B) + n(B − A) + n(A ∩ B)
• n(A) = n(A − B) + n(A ∩ B)
• n(B) = n(B − A) + n(A ∩ B)

Example − Let, A = {1, 2, 6} and B = {6, 12, 42}. There is a common element ‘6’, hence these
sets are overlapping sets.

Disjoint Set

If two sets C and D are disjoint sets as they do not have even one element in common. Therefore,
n(A ∪ B) = n(A) + n(B)

Example − Let, A = {1, 2, 6} and B = {7, 9, 14}, there is no common element; hence these sets
are overlapping sets.

Venn Diagrams
Venn diagram, invented in 1880 by John Venn, is a schematic diagram that shows all possible logical
relations between different mathematical sets. Diagrammatical representation of sets is known as a Venn
diagram. According to him universal set is represented by the interior of a rectangle and other sets
are represented by interior of circles.

Examples

Set Operations

Set Operations include Set Union, Set Intersection, Set Difference, Complement of Set, and
Cartesian Product.

Set Union

The union of sets A and B (denoted by A ∪ B) is the set of elements which are in A, in B, or in
both A and B. Hence, A ∪B = {x | x ∈ A OR x ∈ B}.

Example − If A = {10, 11, 12, 13} and B = {13, 14, 15}, then A ∪B = {10, 11, 12, 13, 14, 15}.
(The common element occurs only once)

VEMU, Dept of CSE Page 40


Set Intersection

The intersection of sets A and B (denoted by A ∩ B) is the set of elements which are in both A
and B. Hence, A ∩ B = {x | x ∈ A AND x ∈ B}.

Example − If A = {11, 12, 13} and B = {13, 14, 15}, then A ∩ B = {13}.

Set Difference/ Relative Complement

The set difference of sets A and B (denoted by A − B) is the set of elements which are only in A
but not in B. Hence, A − B = {x | x ∈A AND x ∈ B}.

Example − If A = {10, 11, 12, 13} and B = {13, 14, 15}, then (A− B) = {10, 11, 12} and (B −
A) = {14, 15}. Here, we can see (A − B) ≠ (B − A)

VEMU, Dept of CSE Page 41


Complement of a Set

The complement of a set A (denoted by A’) is the set of elements which are not in set A. Hence,
A' = {x | x ∈ A}.

More specifically, A'= (U − A) where U is a universal set which contains all objects.

Example − If A = {x | x belongs to set of odd integers} then A' = {y | y does not belong to set of
odd integers}

Cartesian Product / Cross Product

The Cartesian product of n number of sets A1, A2 .....An, defined as A1 × A2 ×..... × An, are the
ordered pair (x1, x2,....xn) where x1 ∈ A1, x2 ∈ A2, ..............xn ∈An

Example − If we take two sets A = {a, b} and B = {1, 2},

The Cartesian product of A and B is written as − A × B = {(a, 1), (a, 2), (b, 1), (b, 2)}

The Cartesian product of B and A is written as − B × A = {(1, a), (1, b), (2, a), (2, b)}

Power Set

Power set of a set S is the set of all subsets of S including the empty set. The cardinality of a
power set of a set S of cardinality n is 2n. Power set is denoted as P(S).

Example −

For a set S = {a, b, c, d} let us calculate the subsets −

• Subsets with 0 elements − {∅} (the empty set)


• Subsets with 1 element − {a}, {b}, {c}, {d}
• Subsets with 2 elements − {a,b}, {a,c}, {a,d}, {b,c}, {b,d},{c,d}
• Subsets with 3 elements − {a,b,c},{a,b,d},{a,c,d},{b,c,d}
• Subsets with 4 elements − {a,b,c,d}

VEMU, Dept of CSE Page 42


Hence, P(S) = { {∅}, {a}, {b}, {c}, {d}, {a,b}, {a,c}, {a,d}, {b,c}, {b,d}, {c,d}, {a,b,c}, {a,b,d},
{a,c,d}, {b,c,d}, {a,b,c,d}}

| P(S) | = 24 = 16

Note − The power set of an empty set is also an empty set. | P ({∅}) | = 20 = 1.

Any set of elements in a mathematical system may be defined with a set of operators and a
number of postulates.

SUB- SET

Let set A be a set containing all students of your school and B be a set containing all students of
class XII of the school. In this example each element of set B is also an element of set A. Such a
set B is said to be subset of the set A. It is written as B⊆ A.

Consider
D ={1, 2, 3, 4,. ......}
E = {.....−3,−2,−1, 0, 1, 2, 3, ....... }

Clearly each element of set D is an element of set E also ∴ D⊆ E


If A and B are any two sets such that each element of the set A is an element of the set B also,
then A is said to be a subset of B.

Remarks
(i) Each set is a subset of itself i.e. A⊆ A
(ii) Null set has no element so the condition of becoming a subset is automatically
satisfied. Therefore null set is a subset of every set.
(iii) If A⊆ B and B⊆ A then A = B.
(iv) If A⊆ B and A≠ B then A is said to be a proper subset of B and B is said to
be a super set of A. i.e. A⊂ B or B⊃A.

Example 2: If A = {x : x is a prime number less than 5} and B = {y : y is an even prime


number} then is B a proper subset of A ?

Solution : It is given that


A = {2, 3 }, B = {2}. Clearly
B⊆ A and B≠ A
We write B⊂ A and say that B is a proper subset of A.

Example 3: If A = {1, 2, 3, 4}, B = {2, 3, 4, 5}. is A⊆B or B⊆ A ?


Solution : Here 1∈A but1∉B⇒A⊆/ B.
Also 5∉ B but 5∈A⇒ B⊆/A.
Hence neither A is a subset of B nor B is a subset of A.

VEMU, Dept of CSE Page 43


Example 4: If A = {a, e, i, o, u} ,B = {e, i, o, u, a } Is A⊆B or B⊆ A or both ?
Solution : Here in the given sets each element of set A is an element of set B also
⇒ ⊆
and each element of set B is an element of set A also. ⇒ ⊆
From (i) and (ii)
A=B

Binary Operator
A binary operator defined on a set of elements is a rule that assigns to each pair of elements a
unique element from that set. For example, given the set A = {1, 2, 3, 4, 5}, we can say ⊗ is a
binary operator for the operation c = a ⊗ b, if it specifies a rule for finding c for the pair of (a,b),
such that a, b, c ∈ A.

Closure

A set is closed with respect to a binary operator if for every pair of elements in the set, the
operator finds a unique element from that set.

Example − Let A = {0, 1, 2, 3, 4, 5, .................. }

This set is closed under binary operator into (*), because for the operation c = a + b, for any a, b
∈A, the product c ∈ A.

The set is not closed under binary operator divide (÷), because, for the operation c = a + b, for
any a, b ∈ A, the product c may not be in the set A. If a = 7, b = 2, then c = 3.5. Here a, b ∈ A but
c ∈ A.

Associative Laws

A binary operator ⊗ on a set A is associative when it holds the following property

− (x ⊗ y) ⊗ z = x ⊗ (y ⊗ z), where x, y, z ∈ A

Example − Let A = { 1, 2, 3, 4 }

The operator plus ( + ) is associative because for any three elements, x, y, z ∈ A, the property (x
+ y) + z = x + ( y + z ) holds.The operator minus ( − ) is not associative since

(x−y)−z≠x−(y−z)

Commutative Laws

A binary operator ⊗ on a set A is commutative when it holds the following property −

VEMU, Dept of CSE Page 44


x ⊗ y = y ⊗ x, where x, y ∈A

Example − Let A = { 1, 2, 3, 4 }

The operator plus ( + ) is commutative because for any two elements, x, y ∈ A, the property x +
y = y + x holds.

The operator minus ( − ) is not associative since x − y ≠ y − x

Distributive Laws

Two binary operators ⊗ and ⊛on a set A, are distributive over operator ⊛when the following
property holds −

x ⊗ (y ⊛z) = (x ⊗ y) ⊛ (x ⊗ z), where x, y, z ∈ A

Example − Let A = { 1, 2, 3, 4 }

The operators into ( * ) and plus ( + ) are distributive over operator + because for any three
elements, x, y, z ∈ A, the property x * (y + z) = (x * y) + (x * z) holds.

However, these operators are not distributive over * since

x+(y*z)≠(x+y)*(x+z)

Identity Element

A set A has an identity element with respect to a binary operation ⊗ on A, if there exists an
element e ∈A, such that the following property holds −

e ⊗ x = x ⊗ e, where x ∈ A

Example − Let Z = { 0, 1, 2, 3, 4, 5, ........................... }

The element 1 is an identity element with respect to operation * since for any element x ∈ Z,

1*x=x*1

On the other hand, there is no identity element for the operation minus ( − )

Inverse

If a set A has an identity element e with respect to a binary operator ⊗, it is said to have an
inverse whenever for every element x ∈ A, there exists another element y ∈ A, such that the
following property holds −

VEMU, Dept of CSE Page 45


x⊗y=e

Example − Let A = { ………….. −4, −3, −2, −1, 0, 1, 2, 3, 4, 5, ................... }

Given the operation plus ( + ) and e = 0, the inverse of any element x is (−x) since x + (− x) = 0

De Morgan’s Law

De Morgan’s Laws gives a pair of transformations between union and intersection of two (or
more) sets in terms of their complements. The laws are −

(A ∪ B)′ = A′ ∩ B′

(A ∩ B)′ = A′∪ B′

Example − Let A = { 1, 2, 3, 4}, B = {1, 3, 5, 7}, and

Universal set U = { 1, 2, 3,............., 9, 10 }

A′ = { 5, 6, 7, 8, 9, 10}

B′ = { 2, 4, 6, 8, 9, 10}

A ∪ B = {1, 2, 3, 4, 5, 7}

A ∩ B = { 1, 3}

(A ∪ B)′ = { 6, 8, 9, 10}

A′ ∩ B′ = { 6, 8, 9, 10}

Thus, we see that (A ∪ B)′ = A′∩ B′

(A ∩ B)′ = { 2, 4, 5, 6, 7, 8, 9, 10}

A′ ∪ B′ = { 2, 4, 5, 6, 7, 8, 9, 10}

Thus, we see that (A ∩ B)′ = A′∪ B′.

Partitioning of a Set

Partition of a set, say S, is a collection of n disjoint subsets, say P1, P2,........... Pn, that satisfies the
following three conditions –

VEMU, Dept of CSE Page 46


• Pi does not contain the empty set.

[ Pi ≠ {∅ } for all 0 < i ≤ n]

• The union of the subsets must equal the entire original set.

[P1 ∪P2 ∪ ......∪Pn = S]

• The intersection of any two distinct sets is empty.

[Pa ∩ Pb = {∅ }, for a ≠ b where n ≥ a, b ≥ 0 ]

The number of partitions of the set is called a Bell number denoted as Bn.

Example

Let S = {a, b, c, d, e, f, g, h}

One probable partitioning is {a}, {b, c, d}, {e, f, g, h}

Another probable partitioning is {a, b}, { c, d}, {e, f, g, h}

In this way, we can find out Bn number of different partitions.

VEMU, Dept of CSE Page 47


2. Relations and Partial Ordering
Whenever sets are being discussed, the relationship between the elements of the sets is the next
thing that comes up. Relations may exist between objects of the same set or between objects of
two or more sets.

Definition and Properties

A binary relation R from set x to y (written as xRy or R(x,y)) is a subset of the Cartesian product
x × y. If the ordered pair of G is reversed, the relation also changes.

Generally an n-ary relation R between sets A1, ... , and An is a subset of the n-ary product A1 × ...
× An. The minimum cardinality of a relation R is Zero and maximum is n2 in this case.

A binary relation R on a single set A is a subset of A × A.

For two distinct sets, A and B, having cardinalities m and n respectively, the maximum
cardinality of a relation R from A to B is mn.

Domain and Range

If there are two sets A and B, and relation R have order pair (x, y), then −

• The domain of R is the set { x | (x, y) ∈ R for some y in B }


• The range of R is the set { y | (x, y) ∈ R for some x in A }

Examples

Let, A = {1, 2, 9} and B = {1, 3, 7}

• Case 1 − If relation R is ‘equal to’ then R = {(1, 1), (3, 3)}


• Case 2 − If relation R is ‘less than’ then R = {(1, 3), (1, 7), (2, 3), (2, 7)}
• Case 3 − If relation R is ‘greater than’ then R = {(2, 1), (9, 1), (9, 3), (9, 7)}

Representation of Relations using Graph

A relation can be represented using a directed graph.

The number of vertices in the graph is equal to the number of elements in the set from which the
relation has been defined. For each ordered pair (x, y) in the relation R, there will be a directed
edge from the vertex ‘x’ to vertex ‘y’. If there is an ordered pair (x, x), there will be self- loop on
vertex ‘x’.

VEMU, Dept of CSE Page 48


Suppose, there is a relation R = {(1, 1), (1,2), (3, 2)} on set S = {1, 2, 3}, it can be represented by
the following graph −

Types of Relations

• The Empty Relation between sets X and Y, or on E, is the empty set ∅


• The Full Relation between sets X and Y is the set X × Y
• The Identity Relation on set X is the set {(x, x) | x ∈ X}
• The Inverse Relation R' of a relation R is defined as − R’ = {(b, a) | (a, b) ∈ R}

Example − If R = {(1, 2), (2, 3)} then R’ will be {(2, 1), (3, 2)}

• A relation R on set A is called Reflexive if ∀a∈A is related to a (aRa holds).

Example − The relation R = {(a, a), (b, b)} on set X = {a, b} is reflexive

• A relation R on set A is called Irreflexive if no a ∈ A is related to a (aRa does not hold).

Example − The relation R = {(a, b), (b, a)} on set X = {a, b} is irreflexive

• A relation R on set A is called Symmetric if xRy implies yRx, ∀x∈A and ∀y∈A.

Example − The relation R = {(1, 2), (2, 1), (3, 2), (2, 3)} on set A = {1, 2, 3} is
symmetric.

• A relation R on set A is called Anti-Symmetric if xRy and yRx implies x = y , ∀x ∈ A


and ∀y ∈ A.

Example − The relation R = {(1, 2), (3, 2)} on set A = {1, 2, 3} is antisymmetric.

• A relation R on set A is called Transitive if xRy and yRz implies xRz, ∀x,y,z ∈ A.

VEMU, Dept of CSE Page 49


Example − The relation R = {(1, 2), (2, 3), (1, 3)} on set A = {1, 2, 3} is transitive

• A relation is an Equivalence Relation if it is reflexive, symmetric, and transitive.

Example − The relation R = {(1, 1), (2, 2), (3, 3), (1, 2), (2,1), (2,3), (3,2), (1,3), (3,1)}
on set A = {1, 2, 3} is an equivalence relation since it is reflexive, symmetric, and
transitive.

Partially Ordered Set (POSET)

A partially ordered set consists of a set with a binary relation which is reflexive, antisymmetric
and transitive. "Partially ordered set" is abbreviated as POSET.

Examples

• The set of real numbers under binary operation less than or equal to (≤) is a poset.

Let the set S = {1, 2, 3} and the operation is ≤

The relations will be {(1, 1), (2, 2), (3, 3), (1, 2), (1, 3), (2, 3)}

This relation R is reflexive as {(1, 1), (2, 2), (3, 3)} ∈ R

This relation R is anti-symmetric, as

{(1, 2), (1, 3), (2, 3)} ∈ R and {(1, 2), (1, 3), (2, 3)} ∉ R

This relation R is also transitive. Hence, it is a poset.

• The vertex set of a directed acyclic graph under the operation ‘reachability’ is a poset.

Relations
Consider the following example :
A={Mohan, Sohan, David, Karim}
B={Rita, Marry, Fatima}
Suppose Rita has two brothers Mohan and Sohan, Marry has one brother David, and Fatima has
one brother Karim. If we define a relation R " is a brother of" between the elements of A and B
then clearly.

Mohan R Rita, Sohan R Rita, David R Marry, Karim R Fatima. After omiting R between two
names these can be written in the form of ordered pairs as : (Mohan, Rita), (Sohan, Rita), (David,
Marry), (Karima, Fatima).

VEMU, Dept of CSE Page 50


The above information can also be written in the form of a set R of ordered pairs as
R= {(Mohan, Rita), (Sohan, Rita), (David, Marry), Karim, Fatima}
Clearly R  AB, i.e.R = {(a,b): aA, bB and aRb}
If A and B are two sets then a relation R from A toB is a sub set of A×B.

Void Relation
If (i) R = , R is called a void relation.
(ii) R=A×B, R is called a universal relation.
(iii) If R is a relation defined from A to A, it is called a relation defined on A.
(iv) R =  (a,a) a A  , is called the identity relation.

Domain and Range of a Relation

If R is a relation between two sets then the set of its first elements (components) of all the
ordered pairs of R is called Domain and set of 2nd elements of all the ordered pairs of R is
called range, of the given relation. Consider previous example given above.
Domain = {Mohan, Sohan, David, Karim}
Range = {Rita, Marry, Fatima}

Example1: Given that A = {2, 4, 5, 6, 7}, B = {2, 3}.R is a relation from A to B defined by
R = {(a, b) : a A, bB and a is divisible by b} find (i) R in the roster form (ii) Domain of R (iii)
Range of R (iv) Repersent R diagramatically.
Solution : (i) R = {(2, 2), (4, 2), (6, 2), (6, 3)}
(ii) Domain of R = {2, 4, 6}
(iii) Range of R = {2, 3}

Example 2: If R is a relation 'is greater than' from A to B, where


A= {1, 2, 3, 4, 5} and B = {1,2,6}. Find (i) R in the roster form. (ii) Domain of R (iii) Range of
R.
Solution :
(i) R = {(3, 1), (3, 2), (4, 1), (4, 2), (5, 1), (5, 2)}
(ii) Domain of R = {3, 4, 5}
(iii) Range of R = {1, 2}

VEMU, Dept of CSE Page 51


3. Functions
A Function assigns to each element of a set, exactly one element of a related set. Functions find
their application in various fields like representation of the computational complexity of
algorithms, counting objects, study of sequences and strings, to name a few. The third and final
chapter of this part highlights the important aspects of functions.

Function – Definition

A function or mapping (Defined as f: X→Y) is a relationship from elements of one set X to


elements of another set Y (X and Y are non-empty sets). X is called Domain and Y is called
Codomain of function ‘f’.

Function ‘f’ is a relation on X and Y s.t for each x ∈ X, there exists a unique y ∈ Y such that
(x,y) ∈ R. x is called pre-image and y is called image of function f.

A function can be one to one, many to one (not one to many). A function f: A→B is said to be
invertible if there exists a function g: B→A

Injective / One-to-one function

A function f: A→B is injective or one-to-one function if for every b ∈ B, there exists at most one
a ∈ A such that f(s) = t.

This means a function f is injective if a1 ≠ a2 implies f(a1) ≠ f(a2).

Example

• f: N→N, f(x) = 5x is injective.


• f: Z+→Z+, f(x) = x2 is injective.
• f: R→R, f(x) = x2 is not injective as (−x)2 = x2

VEMU, Dept of CSE Page 52


Surjective / Onto function

A function f: A→B is surjective (onto) if the image of f equals its range. Equivalently, for every
b ∈ B, there exists some a ∈A such that f(a) = b. This means that for any y in B, there exists
some x in A such that y = f(x).

Example

• f : Z+→Z+, f(x) = x2 is surjective.


• f : N→N, f(x) = x2 is not injective as (−x)2 = x2

Bijective / One-to-one Correspondent

A function f: A→B is bijective or one-to-one correspondent if and only if f is both injective and
surjective.

Problem

Prove that a function f: R→R defined by f(x) = 2x − 3 is a bijective function.

Explanation − We have to prove this function is both injective and surjective.

If f(x1) = f(x2), then 2x1 − 3 = 2x2 − 3 and it implies that x1 = x2.

Hence, f is injective.

Here, 2x − 3 = y

So, x = (y + 5)/3 which belongs to R and f(x) = y.

Hence, f is surjective.

Since f is both surjective and injective, we can say f is bijective.

Composition of Functions

Two functions f: A→B and g: B→C can be composed to give a composition g o f. This is a
function from A to C defined by (gof)(x) = g(f(x))

VEMU, Dept of CSE Page 53


Example

Let f(x) = x + 2 and g(x) = 2x, find ( f o g)(x) and ( g o f)(x)

Solution

(f o g)(x) = f (g(x)) = f(2x) = 2x+2

(g o f)(x) = g (f(x)) = g(x+2) = 2(x+2) = 2x+4

Hence, (f o g)(x) ≠ (g o f)(x)

Some Facts about Composition

• If f and g are one-to-one then the function (g o f) is also one-to-one.


• If f and g are onto then the function (g o f) is also onto.
• Composition always holds associative property but does not hold commutative property.

Types of functions
A relation is a function if for every x in the domain there is exactly one y in the codomain. A
vertical line through any element of the domain should intersect the graph of the function exactly
once. (one to one or many to one but not all the Bs have to be busy)

A function is injective if for every y in the codomain B there is at most one x in the domain. A
horizontal line should intersect the graph of the function at most once (i.e.not at all or once). (one to
one only but not all the Bs have to be busy)

VEMU, Dept of CSE Page 54


A function is bijective if for every y in the codomain there is exactly one x in the domain. A
horizontal line through any element of the range should intersect the graph of the function exactly
once. (one to one only and all the Bs must be busy).

A function is surjective if for every y in the codomain B there is at least one x in the domain. A
horizontal line intersects the graph of the function at least once (i.e.once or more). The range
and the codomain are identical. (one to one or many to one and all the Bs must be busy)

• Identity function: maps any given element to itself.

• Constant function: has a fixed value regardless of arguments.

• Empty function: whose domain equals the empty set.

Example1: Without using graph prove that the function


F : R → R defined by f ( x ) = 4 +3x is one-to-one.

Solution : For a function to be one-one function


F ( x1 ) = f ( x2 )  x1 = x2  x1, x2  domain
Now f ( x1 ) = f ( x2 ) gives
4 + 3x1 = 4 +3x2 or x1 =x2.
 F is a one-one function.

VEMU, Dept of CSE Page 55


Example2: Prove that F : R → R defined by f ( x ) = 4x3 −5 is a bijection

Solution : Now f ( x1 ) = f ( x2 )  x1, x2 Domain


 4x13 − 5 = 4x23 − 5
 x13 = x23

( )
 x13 − x23 = 0  ( x2 − x1 ) x12 + x1x2 + x2 2 = 0  x1 = x2 or x12 + x1x2 + x2 2 = 0
(rejected). It has no real value of x1 and x2 .  F is a one-one function.
Again let y = ( x3 ) where y  codomain, x  domain.
We have y = 4x −5 or x= 𝑦+5 1 / 3
( 𝑛 )
 For each y  codomain  x  domain such that f ( x ) = y .
Thus F is onto function.
 F is a bijection.

Example3: Prove that F : R → R defined by F ( x ) = x 2 +3 is neither one-one nor onto


function.
Solution : We have F ( x1 ) = F ( x2 )  x1, x2  domain giving x12 + 3 = x22 +3 x1 2=x22
or x12 − x2 2= 0 x1 =x2 or x1 = x2
or F is not one-one function.
Again let y = F ( x ) where y  codomain x  domain.
 y = x 2 + 3  x = √ y −3
  y 3 no real value of x in the domain.

 F is not an onto finction.

Example4:Find domain of each of the following functions :


(a) y = + x − 2 (b) y = + ( 2 − x ) ( 4 + x )
Solution :(a) Consider the function y = + x − 2
In order to have real values of y, we must have ( x − 2 )  0
i.e. x  2
 Domain of the function will be all real numbers  2 .
(b) y = + ( 2 −x ) ( 4 +x )
In order to have real values of y, we must have ( 2 − x ) ( 4 + x ) 0
We can achieve this in the following two cases :
Case I : ( 2 − x )  0 and ( 4 + x ) 0
 x  2 and x  −4
 Domain consists of all real values of x such that −4  x  2
Case II : 2 − x  0 and 4 + x 0
 2  x and x  −4 .
But, x cannot take any real value which is greater than or equal to 2 and less than or equal to
−4 .

VEMU, Dept of CSE Page 56


 From both the cases, we have
Domain = −4  x  2 x R

Example5: For the function


f ( x ) = y = 2x + 1, find the range when domain = −3, −2, −1,0,1,2,3 .

Solution : For the given values of x, we have


f ( −3 ) = 2 (−3 ) + 1 = −5
f ( −2 ) = 2 ( −2) +1 = 3−
f ( −1) = 2 ( −1 ) +1 = 1−
f ( 0 ) = 2 ( 0 ) +1 =1
f (1 ) = 2 (1) +1 =3
f ( 2 ) = 2 ( 2 ) +1 =5
f ( 3 ) = 2 ( 3 ) +1 =7

The given function can also be written as a set of ordered pairs.

( −3, −5 ) , ( −2, −3 ) , ( −1, −1 ) , ( 0,1 ) (1, 3 ) ,( 2,5 ) ( 3,7 )


 Range = −5, −3, −1,1,3,5,7

Example 6: If f ( x ) = x +3, 0 x 4,find its range.


Solution : Here 0  x  4
or 0 + 3  x + 3  4 +3
or 3  f ( x )  7
 Range = f ( x ) : 3  f ( x )  7

Example 7: If f ( x ) = x2 , −3 x 3 ,find its range.


Solution : Given − 3  x  3
or 0  x2  9 or 0  f ( x )  9

 Range = f ( x ) : 0  f ( x )  9

VEMU, Dept of CSE Page 57


UNIT -2

Lattices and Boolean


Algebra
2. Lattices
Lattice

A lattice is a poset (L, ≤) for which every pair {a, b} ∈ L has a least upper bound
(denoted by a ∨ b) and a greatest lower bound (denoted by a ∧ b). LUB ({a,b}) is called the join
of a and b. GLB ({a,b}) is called the meet of a and b.

Example

This above figure is a lattice because for every pair {a, b} ∈ L, a GLB and a LUB exists.

VEMU, Dept of CSE Page 63


This above figure is a not a lattice because GLB (a, b) and LUB (e, f) does not exist.

Some other lattices are discussed below −

Bounded Lattice

A lattice L becomes a bounded lattice if it has a greatest element 1 and a least element 0.

Complemented Lattice

A lattice L becomes a complemented lattice if it is a bounded lattice and if every element in the
lattice has a complement. An element x has a complement x’ if ∃x(x ∧ x’= 0 and x ∨ x’ = 1)

Distributive Lattice

If a lattice satisfies the following two distribute properties, it is called a distributive lattice.

• a ∨ (b ∧ c) = (a ∨ b) ∧ (a ∨ c)
• a ∧ (b ∨ c) = (a ∧ b) ∨ (a ∧ c)

Modular Lattice

If a lattice satisfies the following property, it is called modular lattice.

a ∧( b ∨ (a ∧ d)) = (a ∧ b) ∨ (a ∧ d)

Properties of Lattices
Idempotent Properties

• a ∨a = a
• a ∧a = a

VEMU, Dept of CSE Page 64


Absorption Properties

• a ∨ (a ∧ b) = a
• a ∧ (a ∨ b) = a

Commutative Properties

• a ∨b = b ∨a
• a ∧b = b ∧a

Associative Properties

• a ∨ (b ∨ c) = (a ∨ b) ∨ c
• a ∧ (b ∧ c) = (a ∧ b) ∧ c

Dual of a Lattice

The dual of a lattice is obtained by interchanging the ‘∨’ and ‘∧’ operations.

Example

The dual of [a ∨ (b ∧ c)] is [a ∧ (b ∨ c)]

Partially Ordered Set (POSET)

A partially ordered set consists of a set with a binary relation which is reflexive, antisymmetric
and transitive. "Partially ordered set" is abbreviated as POSET.

Examples

• The set of real numbers under binary operation less than or equal to (≤) is a poset.

Let the set S = {1, 2, 3} and the operation is ≤

The relations will be {(1, 1), (2, 2), (3, 3), (1, 2), (1, 3), (2, 3)}

This relation R is reflexive as {(1, 1), (2, 2), (3, 3)} ∈ R

This relation R is anti-symmetric, as

{(1, 2), (1, 3), (2, 3)} ∈ R and {(1, 2), (1, 3), (2, 3)} ∉ R

This relation R is also transitive. Hence, it is a poset.

• The vertex set of a directed acyclic graph under the operation ‘reachability’ is a poset.

VEMU, Dept of CSE Page 65


Hasse Diagram

The Hasse diagram of a poset is the directed graph whose vertices are the element of that poset
and the arcs covers the pairs (x, y) in the poset. If in the poset x<y, then the point x appears lower
than the point y in the Hasse diagram.If x<y<z in the poset, then the arrow is not shown between
x and z as it is implicit.

Example

The poset of subsets of {1, 2, 3} = {φ, {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3}} is shown
by the following Hasse diagram −

Linearly Ordered Set

A Linearly ordered set or Total ordered set is a partial order set in which every pair of element is
comparable. The elements a, b ∈ S are said to be comparable if either a ≤ b or b ≤ a holds.
Trichotomy law defines this total ordered set. A totally ordered set can be defined as a
distributive lattice having the property {a ∨ b, a ∧ b} = {a, b} for all values of a and b in set S.

Example

The powerset of {a, b} ordered by ⊆ is a totally ordered set as all the elements of the
power set P = {φ, {a}, {b}, {a, b}} are comparable.

Example of non-total order set

A set S = {1, 2, 3, 4, 5, 6} under operation x divides y is not a total ordered set.

Here, for all (x, y) ∈ S, x ≤ y have to hold but it is not true that 2 ≤ 3, as 2 does not divide 3 or 3
does not divide 2. Hence, it is not a total ordered set.

VEMU, Dept of CSE Page 66


VEMU, Dept of CSE Page 67
VEMU, Dept of CSE Page 68
VEMU, Dept of CSE Page 69
VEMU, Dept of CSE Page 70
VEMU, Dept of CSE Page 71
VEMU, Dept of CSE Page 72
VEMU, Dept of CSE Page 73
4.Boolean Algebra
Boolean algebra is algebra of logic. It deals with variables that can have two discrete values, 0
(False) and 1 (True); and operations that have logical significance. The earliest method of
manipulating symbolic logic was invented by George Boole and subsequently came to be known
as Boolean Algebra.

Boolean algebra has now become an indispensable tool in computer science for its wide
applicability in switching theory, building basic electronic circuits and design of digital
computers.

VEMU, Dept of CSE Page 74


VEMU, Dept of CSE Page 75
VEMU, Dept of CSE Page 76
UNIT -2

Algebraic Systems
1. Algebraic Systems
Semigroup

A finite or infinite set ‘S’ with a binary operation ‘0’ (Composition) is called semigroup if it
holds following two conditions simultaneously −

• Closure − For every pair (a, b) ∈S, (a 0 b) has to be present in the set S.
• Associative − For every element a, b, c ∈ S, (a 0 b) 0 c = a 0 (b 0 c) must hold.

Example

The set of positive integers (excluding zero) with addition operation is a semigroup. For
example, S = {1, 2, 3,...}

Here closure property holds as for every pair (a, b) ∈ S, (a + b) is present in the set S. For
example, 1 + 2 = 3 ∈ S]

Associative property also holds for every element a, b, c ∈ S, (a + b) + c = a + (b + c). For


example, (1 + 2) + 3 = 1 + (2 + 3) = 5

Monoid

A monoid is a semigroup with an identity element. The identity element (denoted by e or E) of a


set S is an element such that (a 0 e) = a, for every element a ∈ S. An identity element is also
called a unit element. So, a monoid holds three properties simultaneously − Closure,
Associative, Identity element.

Example

The set of positive integers (excluding zero) with multiplication operation is a monoid. S = {1, 2,
3,...}

Here closure property holds as for every pair (a, b) ∈ S, (a × b) is present in the set S. [For
example, 1 × 2 = 2 ∈S and so on]

Associative property also holds for every element a, b, c ∈ S, (a × b) × c = a × (b × c) [For


example, (1 × 2) × 3 = 1 × (2 × 3) = 6 and so on]

Identity property also holds for every element a ∈ S, (a × e) = a [For example, (2 × 1) = 2, (3 × 1)


= 3 and so on]. Here identity element is 1.

VEMU, Dept of CSE Page 59


Group

A group is a monoid with an inverse element. The inverse element (denoted by I) of a set S is an
element such that (a 0 I) = (I 0 a) = a, for each element a ∈ S. So, a group holds four properties
simultaneously − i) Closure, ii) Associative, iii) Identity element, iv) Inverse element. The
order of a group G is the number of elements in G and the order of an element in a group is the
least positive integer n such that an is the identity element of that group G.

A binary operation * on a set G is a function that associates with every ordered pair of elements a,
b ∈ G, a unique element of G, denoted by a * b.
A group (G, *) is a set G together with a binary operation * such that:
(1) Closure Law: a * b ∈ G for all a, b ∈ G.
(2) Associative Law: (a * b) * c = a * (b * c) for all a, b, c ∈ G.
(3) Identity Law: There exists e ∈ G such that a * e = a = e * a for all a ∈ G.
(4) Inverse Law: For all a ∈ G there exists b ∈ G such that a * b = e = b * a.

Examples

The set of N × N non-singular matrices form a group under matrix multiplication operation.

The product of two N × N non-singular matrices is also an N × N non-singular matrix which


holds closure property.

Matrix multiplication itself is associative. Hence, associative property holds.

The set of N × N non-singular matrices contains the identity matrix holding the identity element
property.

As all the matrices are non-singular they all have inverse elements which are also non-singular
matrices. Hence, inverse property also holds.

Abelian Group

An abelian group G is a group for which the element pair (a, b) ∈ G always holds commutative
law. So, a group holds five properties simultaneously − i) Closure, ii) Associative, iii) Identity
element, iv) Inverse element, v) Commutative.

Example

The set of positive integers (including zero) with addition operation is an abelian group. G = {0,
1, 2, 3,…}

Here closure property holds as for every pair (a, b) ∈ S, (a + b) is present in the set S. [For
example, 1 + 2 = 2 ∈ S and so on]

VEMU, Dept of CSE Page 60


Associative property also holds for every element a, b, c ∈ S, (a + b) + c = a + (b + c) [For
example, (1 + 2) + 3 = 1 + (2 + 3) = 6 and so on]

Identity property also holds for every element a ∈ S, (a × e) = a [For example, (2 × 1) = 2, (3 × 1)


= 3 and so on]. Here, identity element is 1.

Commutative property also holds for every element a ∈ S, (a × b) = (b × a) [For example, (2 × 3)


= (3 × 2) = 3 and so on]

Cyclic Group and Subgroup

A cyclic group is a group that can be generated by a single element. Every element of a cyclic
group is a power of some specific element which is called a generator. A cyclic group can be
generated by a generator ‘g’, such that every other element of the group can be written as a
power of the generator ‘g’.

Example

The set of complex numbers {1, −1, i, − i} under multiplication operation is a cyclic group.

There are two generators − i and −i as i1 = i, i2 = −1, i3 = −i, i4 = 1 and also (−i)1 = −i, (−i)2 = −1,
(−i)3 = i, (−i)4 = 1 which covers all the elements of the group. Hence, it is a cyclic group.

Note − A cyclic group is always an abelian group but not every abelian group is a cyclic group.
The rational numbers under addition is not cyclic but is abelian.

Subgroup

A subgroup H is a subset of a group G (denoted by H ≤ G) if it satisfies the four properties


simultaneously − Closure, Associative, Identity element, and Inverse.

A subgroup H of a group G that does not include the whole group G is called a proper subgroup
(Denoted by H<G). A subgroup of a cyclic group is cyclic and a abelian subgroup is also abelian.

A subset H of G is a subgroup if:


(1) a* b ∈ H for all a, b ∈ H;
(2) e (the identity element of G) ∈ H;
(3) the inverse of every element of H is in H.

Notation: H ≤ G.

Example1:
Let a group G = {1, i, −1, −i}
Then some subgroups are H1 = {1}, H2 = {1, −1},
This is not a subgroup: H3 = {1, i} because that (i)−1 = −i is not in H3

VEMU, Dept of CSE Page 61


Example2: Let G = {x ∈ ℝ | x ≠ 1} and define x * y = xy − x − y + 2. Prove that (G, *) is a group.
Solution:

Closure: Let a, b ∈ G, so a ≠ 1 and b ≠ 1. Suppose a * b = 1.


Then ab − a − b + 2 = 1 and so (a − 1)(b − 1) = 0 which implies that a = 1 or b = 1, a contradiction.

Associative: Unlike the examples in exercise 1, this is a totally new operation that we have never
encountered before. We must therefore carefully check the associative law.
(a * b) * c = (a * b)c − (a * b) − c + 2
= (ab − a − b + 2)c − (ab − a − b + 2) − c + 2
= abc − ac − bc + 2c − ab + a + b − 2 − c + 2
= abc − ab − ac − bc + a + b + c
Similarly a * (b * c) has the same value (we can actually see this by the symmetry of the expression.

Identity: An identity, e, would have to satisfy: e * x = x = x * e for all x ∈ G, that is, ex − e − x + 2 =


x, or (e − 2)(x − 1) = 0 for all x. Clearly e = 2 works. We can now check that 2 is indeed the identity.

Inverses: If x * y = 2, then xy − x − y + 2 = 2. So y(x − 1) = x + 2 and hence y = x + 2x − 1 . This


exists for all x ≠ 1, i.e. for all x ∈ G. But we must also check that it is itself an element of G. Clearly
this is so because x + 2x − 1 ≠ 1 for all x ≠ 1.

VEMU, Dept of CSE Page 62

You might also like