0% found this document useful (0 votes)
5 views

Lecture 01a - Set and Operations

Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Lecture 01a - Set and Operations

Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 33

Lecture – 02

Set and its Operations

Discrete Structures (CSAL-1213)


Course Instructor: Hina Alam
Recap
Types of Sets
Types of Sets
• Finite Set: A set with a limited number of elements.
• Example:
• Set of all rainbow colors; A = {Red, Orange, Yellow, Green, Blue, Indigo, Violet}
• Set of vowels in the English alphabet; D = {a, e, i, o, u}
• Set of all days in a week; B = {Sunday, Monday, Tuesday, Wednesday, Thursday,
Friday, Saturday}

• Infinite Set: A set with an unlimited number of elements.


Example:
• Set of natural numbers; ℕ = {1, 2, 3, …}
• Set of whole numbers; W = {0, 1, 2, …}
• Set of integers; ℤ = {…, -2, -1, 0, 1, 2, …}

• Empty Set: A set with no elements, denoted by ∅(phi) or A{}.


= {x | x is a person taller than 10 feet} = ∅

Example: ( Because there does not exist any human being which is taller than 10 feet )

• The set of dogs with six legs.


• The set of squares with 5 sides. B = {x | x^2 = 4, x is odd} = ∅
• The set of cars with 200 doors. (Because we know that there does not exist any odd number whose square is 4)
Empty/Null Set
=
▪ It is a set with Zero elements (contains no elements)

Example:
▪ ∅ ≠ {∅} , where ∅ means zero elements and {∅} means 1 elements

▪ If replace ∅ with {} then : {} ≠ { { } }

▪ The cardinality (number of elements) of the empty set is 0.

▪ It can be an element of other sets:


▪ A= {∅, 1, 2, 3,x}
Activity

∅ 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

Suppose you're talking about colors.

● The universal set U could be all the colors of the rainbow:

U={red, orange, yellow, green, blue, indigo, violet}

● If you have a set A={red, blue},


● This set A is a subset of the universal set U, because all the colors in A are part of U
Activity
Universal Set?
Types of Sets
Singleton Set / Unit Set:
A set that contains exactly one element is called a singleton set.

• 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

1. When A ⊆ B, then B is called a superset of A.

2. When A is not subset of B (A⊈B), then there exist at least one x ∈


A such that x ∉ B.
Let A={1,2,3} , B={2,3,4}
In this case, 1∈A but 1∉B
Since there is at least one element (which is 1) in A that is not in B,
So, we can conclude that A⊈B .
EXAMPLE:
Let A = {1, 3, 5} B = {1, 2, 3, 4, 5} C = {1, 2, 3, 4} D = {3, 1, 5}
Then
A ⊆ B ( Because every element of A is in B )
C ⊆ B ( Because every element of C is also an element of B )
A ⊆ D ( Because every element of A is also an element of D and
also note that every element of D is in A so D ⊆ A )
A is not subset of C . ( Because there is an element 5 of A which is
not in C )
A tree listing of subset

List all the subsets of the set C={a,e,i,o,u}

List all the subsets of the set C={ {}, {1}, {5,a} }
True/False?

Every set is a subset of itself?


Answer - True!!!!!!

▪ Improper Subset ( Less or equal members***)


• Every set is a subset of itself, and this is called an improper subset.
• It is denoted by A ⊆ A.
• Example:
▪ If A = {1, 2, 3}, then A ⊆ A is true because every element of A is in A.

● If we take any set A, all the elements of A are included in A itself.


● Therefore, the condition for being a subset is satisfied: every element in A is
also in A

Example
● If A={1,2,3}, then:
● A IS A subset A⊆A
True/False?

Empty set is a subset of any set?


Answer - True!!!!!!

● 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***)

A set A is a proper subset of set B denoted by A ⊂ B if:


● Every element in A is in B, and
● A is not equal to B (A ≠ B) (meaning B has at least one element that is not in A).

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.

Let C={a,b} and D={1,2}

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

Subsets are individual sets.


The power set is the set that contains all subsets of a set.
Class Activity

P(A) = {∅,{∅}}

P(A) = {∅, {r} ,{{Q,N}}, {r,{Q,N}}}

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

You might also like