CSC 204 SS5
CSC 204 SS5
Introduction
Sets are usually used to group objects together. Often, the objects in a set have similar properties.
For instance, all the students who are currently enrolled in this course makeup a set. The language
of set is a means to study such collections in an organized fashion.
In this study session, you will also be provided with the definition of a set, as well as the operations
that can be performed on sets. You will also get to know about set notations and cardinality of sets.
Page 1 of 12
CSC 204: Fundamentals of Data Structures
For example, the number of students in this classroom is a set. Similarly, the English alphabets may
be viewed as the set of letters of the English language.Also, the set of natural numbers is a set, and
so on. So, sets can consist of elements of various natures, such as, people, physical objects,
numbers, signs, other sets, and so on.
Note: We will use the word object or entity in a very broad way to include all these different kinds
of things. So, in general, a set is an ABSTRACT object; its members do not have to be physically
collected together for them to constitute a set.
5.2.2 Subset
A is a subset of B, if every element of A is also an element of B. That is, A is included in B or B
includes A or B is a superset of A. This is defined symbolically as, A Ϲ B or B Ͻ A. For example, if
A ═ {a, b, c, e, h} and B ═ {a ,b, c, d, e, f g, h, i},therefore A is a subset of B.
Page 2 of 12
CSC 204: Fundamentals of Data Structures
It is now worthy of note that, if A and B can be any sets, then the following propositions can be
proved easily:
(2) A Ϲ A and Ø Ϲ A,
(4) P( Ø) = { Ø }. Note that P (Ø) is not empty but has exactly one element, i.e. Ø.
(ii) A ═ {Aα : α ϵΓ} where Γ is the so called indexing set and Aα 's are sets.
Page 3 of 12
CSC 204: Fundamentals of Data Structures
b. Z ═ {0, -1, +1, -2, +2, …}, that is, the set of all integers,
c. Q ═ { p/q : p ϵ Z : q ϵ N+ }, that is, the set of all rational numbers,
Q+═ {r ϵ Q : r > 0},
Page 4 of 12
CSC 204: Fundamentals of Data Structures
The language to describe these predicates is not usually fixed in a strict way. But it is known that
unrestricted language can result in paradoxes. Example: { x | x∉ x}. The moral: not everything that
looks on the surface like a predicate can actually be considered to be a good defining condition for
a set.
a) 4∈E
b) if x ∈ E, then x + 2 ∈ E
c) Nothing else belongs to E.
The first rule is the basis of recursion, the second one generates new elements from the elements
defined before and the third rule restricts the defined set to the elements generated by rules a and b.
(The third rule should always be there. Sometimes in practice it is left implicit. It is best when you
are a beginner to make it explicit.
a) K ∪ L = {a, b, c, d}
b) K ∪ M = {a, b, d}
Page 5 of 12
CSC 204: Fundamentals of Data Structures
c) L ∪ M = {b, c ,d}
d) (K ∪ L) ∪ M = K ∪ (L ∪ M) = {a, b, c, d}
e) K ∪ K = K ═ {a, b}
f) K ∪∅ = ∅∪ K = K = {a, b}.
i. K∩L = ∅
ii. K∩M = {b}
iii. L∩M = {d}
iv. (K ∩ L) ∩ M = K ∩ (L ∩ M) = ∅
v. K ∩ K = K ═ {a, b }
vi. K∩∅=∅∩K=∅
A – B =def { x| x ∈ A and x ∉ B}
1. K – L = {a,b}
2. K – M = {a}
3. L – M = {c}
4. K – K = ∅
5. K – ∅ = K ═ {a, b}
6. ∅ – K = ∅.
Page 6 of 12
CSC 204: Fundamentals of Data Structures
It is natural to ask, where do these objects come from which do not belong to A? In this case, it is
presupposed that there exists a universe of discourse and all other sets are subsets of this set. The
universe of discourse is conventionally denoted by the symbol U.
A' =def U – A
1. Idempotent Laws
(a) X ∪ X = X (b) X ∩ X = X
2. Commutative Laws
(a) X ∪ Y = Y ∪ X
(b) X ∩ Y = Y ∩ X
3. Associative Laws
(a) (X ∪ Y) ∪ Z = X ∪ (Y ∪ Z)
(b) (X ∩ Y) ∩Z = X ∩ (Y ∩ Z)
4. Distributive Laws
(a) X ∪ (Y ∩ Z) = (X ∪ Y) ∩ (X ∪ Z)
(b) X ∩ (Y ∪ Z) = (X ∩ Y) ∪ (X ∩ Z)
5. Identity Laws
(a) X ∪∅ = X (c) X ∩ ∅ = ∅
(b) X ∪ U = U (d) X ∩ U = X
6. Complement Laws
Page 7 of 12
CSC 204: Fundamentals of Data Structures
7. DeMorgan’s Laws
8. Consistency Principle
Firstly, you say that X and Y have the same cardinality and write | X | = |Y | or say that X and Y are
equivalent sets and write X ˜ Y if there exists a bijective function f : X → Y .
Secondly, you say that the cardinality of X is not greater than the cardinality of Y (or the cardinality
of Y is not less than the cardinality of X) and write | X | ≤ |Y | if there exists an injective function
F: X →Y .
Thirdly, you say that the cardinality of X is less than the cardinality of Y (or the cardinality of Y is
greater than the cardinality of X) and write | X | < | Y | if | X |≤| Y | and | X | ≠ | Y |.
Page 8 of 12
CSC 204: Fundamentals of Data Structures
1. A set is any collection of definite, distinguishable objects, and these objects are
called the elements of the set. It is a computer implementation of the mathematical
concept of a finite set.
2. Sets are usually denoted by capital letters (A, B, C, …). And the elements of the set
are usually denoted by small letters (a, b, c, …).
3. The union of sets A and B, written as A ∪ B, is the set whose elements are just the
elements of A or B or of both.
4. The intersection of A and B, written usually as A ∩ B, is the set whose elements are
just the elements of both A and B.
5. Two sets A and B are said to be equal to each other, if A and B have the same
elements.
6. We say that A is a subset of B, if every element of A is also an element of B.
7. Another binary operation on arbitrary sets is the difference, that is, “A minus B”,
usually written A – B, which reads as, ‘subtracts’ from A all elements which are in B.
8. Cardinality of a set is the number of elements contained in the set.
Page 9 of 12
CSC 204: Fundamentals of Data Structures
Pilot Answers
Pilot Answer 5.1
A set is a collection of definite distinguishable objects, and these objects are called the elements of
the set.
a) List notation
b) Predicate notation
c) Recursive rules
Pilot Answer 5.4
i. Idempotent laws states that: (i)X∪X=X (ii)X∩X=X
ii. Commutative laws states that: (i)X∪Y=Y∪X (ii)X∩Y=Y∩X
iii. Operations on set includes:
Page 10 of 12
CSC 204: Fundamentals of Data Structures
Glossary of Terms
Set:A set is any collection of definite, distinguishable objects, and these objects are called the
elements of the set.
Empty set: The set which has no element is called the empty set and is denoted by Ø.
Union of sets: The union of sets A and B, written as A ∪ B, is the set whose elements are just the
elements of A or B or both.
Intersection: The intersection of A and B,denoted as A ∩ B is the set whose elements are just the
elements of both A and B. In other words, they are elements in common.
Cardinality of set: Cardinality of a set is the number of elements contained in the set
Page 11 of 12
CSC 204: Fundamentals of Data Structures
i. Define a set?
ii. What is an empty set and how is it denoted?
iii. Mention the 3 ways of specifying sets.
iv. Mention any two operations that can be carried out on sets as discussed in this Study
Session.
v. What is cardinality of a set?
Page 12 of 12