Lecture 01
Lecture 01
BSc(Software Engineering)
Geethika Senarathne
Sets
Sets
Set is defined as a collection of distinct, well-defined objects
forming a group.
Example: Elements
Set A = {1, 2, 3, 4, 5 }
Elements of a Set: 1 ∈ A, 2 ∈ A, but 9 ∉ 𝐴
▪ Statement Form
{Positive integers less than 6}
B = {a,e,i,o,u}
Exercise
1. Write the following sets in tabular form.
a) Set of odd numbers less than 10.
b) Natural numbers between 20 and 30.
c) Last three letters in the English alphabet.
d) A = {x | x is a odd number, x<10}
▪ Singleton Set
A set which contains a single element
Eg: A{x | x is a whole number between 4 and 6} = {5}
▪ Finite Set
A set which consists of a definite number of elements
Eg: A{x | x is a natural numbers up to 10}
▪ Infinite Set
A set which is not finite is called an infinite set
Eg: Set of all natural numbers.
Types of Sets
▪ Equivalent Sets
If the number of elements is the same for two different sets, then they are called
equivalent sets.
Eg: if n(A) = n(B) , A and set B are equivalent.
▪ Equal Sets
The two sets A and B are said to be equal if they have exactly the same elements
Eg: A = {1,2,3,4} and B = {4,3,2,1}, then A=B
▪ Disjoint Sets
If two sets do not contain any common element, they are disjoint sets.
Eg: Set A = {1,2,3,4} and set B = {5,6,7,8} are disjoint sets.
Subsets
A set ‘A’ is said to be a subset of B if every element of A is also an element of B,
denoted as A ⊆ B. Even the null set is considered to be the subset of another set. In
general, a subset is a part of another set.
Eg: A = {1,2,3,4}
Then {1,2} ⊆ A. Subset
Similarly, other subsets of set A are:
{1},{2},{3},{1,2},{2,3},{1,3},{1,2,3},{}
Superset
▪ Proper Subset
If B ⊆ A and A ≠ B, then A is called the proper subset of B and it can be written
as A⊂B.
Eg: Set A = {1,2} and set B = {1,2,3,4} ,A is proper subset of B.
Universal Set
A set which contains all the sets relevant to a certain condition is called the universal
set. It is the set of all possible values.
Example: If A = {3,4,5} and B {1,5}, then universal set here will be:
U = {1,2,3,4,5,6}
Operations on Sets
▪ Union
▪ Intersection
▪ Complement
Overlapping Set
Two sets that have at least one common element are called overlapping sets.
4. Check whether the given sets are equal sets: A = {1, 2, 3, 4} and B = {2, 4, 1, 3}.
5. Draw a Venn diagram and find the followings, if A={10,12,13,15}, B={12,15,16,17,19} and
U={10,11,12,13,14,15,16,17,18,19,20}
a) A U B
b) A ∩ B
c) A’
d) (A ∩ B)’
Properties of Sets
1. Commutative Property :
A∪B = B∪A
A∩B = B∩A
2. Associative Property :
A ∪ ( B ∪ C) = ( A ∪ B) ∪ C
A ∩ ( B ∩ C) = ( A ∩ B) ∩ C
3. Distributive Property :
A ∪ ( B ∩ C) = ( A ∪ B) ∩ (A ∪ C)
A ∩ ( B ∪ C) = ( A ∩ B) ∪ ( A ∩ C)
De morgan’s Law
Law of union : ( A ∪ B )’ = A’ ∩ B’
Law of intersection : ( A ∩ B )’ = A’ ∪ B’
Complement Law
A ∪ A’ = A’ ∪ A =U
A ∩ A’ = ∅
Example
Let A and B be two finite sets such that n(A) = 20, n(B) = 28 and n(A ∪ B) = 36, find n(A ∩
B).
A B
Exercise
Example:
Here the first component of every ordered pair is from set A the second component is
from set B.
Cartesian Product of Sets
The Cartesian Product of two sets can be easily represented in the form of a matrix
where both sets are on either axis.
The cardinality of Cartesian products of sets A and B will be the total number of ordered
pairs in the A × B.
n(A) = p
n(B) = q
Then n(A × B) = pq
Exercise