Lecture 01a - Set and Operations
Lecture 01a - Set and Operations
Example: ( Because there does not exist any human being which is taller than 10 feet )
Example:
▪ ∅ ≠ {∅} , where ∅ means zero elements and {∅} means 1 elements
∅ belongs to A?
∅ belongs to S?
Types of Sets
Universal Set (U):
The set containing all possible elements under
consideration.
• The Universal Set is usually denoted by U.
The universal set is a set that contains everything you're talking about in a particular
situation. It's like a "big set" that includes all the items or elements being discussed or
used.
EXAMPLE
• Example:
• Let A = {5}.
• A is a singleton set because it has only one element.
Types of Sets
Subset (⊆) ( Less or equal members***):
A set A is a subset of set B if all elements of A are also elements of B.
Example:
A = {1, 2} , B = {1, 2, 3}
then A ⊆ B
List all the subsets of the set C={ {}, {1}, {5,a} }
True/False?
Example
● If A={1,2,3}, then:
● A IS A subset A⊆A
True/False?
● The empty set has no elements. This means there are no elements in ∅ that could
violate the subset condition.
● Because there are no elements in ∅ that need to be found in another set, it is true that
every element of ∅ is also in any set B.
Let B={1,2,3}
Then: ∅⊆B
Types of Subsets
▪ Proper Subset (⊂ ) ( A is strictly smaller than B , not equal to B***)
Example:
○ Let A={1,2}
○ Let B={1,2,3}
In this case:
● A ⊂ B (because A has elements that are in B, and B has an additional element,
which is 3).
Proper Set v/s Subsets
IMPORTANT
Subsets can include the original set itself, while proper subsets cannot.
Therefore, the number of proper subsets is always less than the total number of
subsets for any given set (unless the set is empty).
Example
For a set S={1,2}
Subsets: The subsets are ∅,{1},{2},{1,2} (Total = 4 subsets)
Proper Subsets: The proper subsets are ∅,{1},{2} (Total = 3 proper subsets)
Equal Sets
Two sets A and B are said to be equal (denoted A=B = B=B) if they contain
exactly the same elements. The order of the elements does not matter, and
duplicates are ignored (denoted A = B)
Symbolically:
A = B iff A ⊆ B and B ⊆ A
EXAMPLE:
Let A = {1, 2, 3, 6}
B = the set of positive divisors of 6
C = {3, 1, 6, 2}
Note!
Then A, B and C are all equal sets.
Activity
Equal sets or NOT Equal?
Equivalent Sets
Two sets A and B are said to be equivalent (denoted A∼B)
if they have the same number of elements, regardless of
what those elements are.
This means that the cardinality (size) of the sets is the
same, but the actual elements may differ.
Here, C and D are equivalent because both sets contain exactly two
elements.
Therefore, C∼D even though the elements are different.
Key Differences
● Nature of Comparison:
○ Equal Sets: Focus on the actual elements present in the sets.
○ Equivalent Sets: Focus on the number of elements in the sets.
● Notation:
○ Equal sets are denoted as A=B
○ Equivalent sets are denoted as A∼B
Types of Sets
▪ Disjoint Sets
• Two sets A and B are disjoint if they have no elements in
common.
• In other words, A ∩ B = ∅ (empty set).
• Example:
▪ Let A = {1, 2, 3} and B = {4, 5, 6}.
▪ Since A and B share no elements, A and B are disjoint sets.
Types of Sets
Power Set:
A power set is the set of all possible subsets of a given set, including the empty set
and the set itself.
The set of all subsets of a set A.
• Example:
• If A = {1, 2},
• then the power set of A is P(A) = {∅, {1}, {2}, {1, 2}}.
Power Set
Subset – Set of Sets
Class Activity
▪
P(A) = {∅,{∅}}
P(∅) = {∅}
Cardinality of
set
Set – Programming
Representation
► Programming Format
► Primitive datatype (set)
► User-define datatype (sequence)
► In Java,
► In Javascript,
► Set<Obj> set = new HashSet<Obj> ();
► Const A = new Set([ “apple“,“orange“,
► hash_Set.add(“apple"); “pear“, “banana“]);
► hash_Set.add(“orange"); ► In Python,
► hash_Set.add(“pear"); ► thisset =
► hash_Set.add(“banana"); {"apple", “orange", “pear", “banana"}
► In C++, ► In Golang,
► Set is a data structure ► Set is a data structure implemented using
maps
Textbook:
▪ Main Text:
▪ K. Rosen: Discrete Structures and its Applications
▪ Weekly Readings:
▪ L. Lovasz: Discrete Mathematics, Elementary and Beyond
▪ Reference:
▪ R. J. Wilson: Graph Theory