Lecture Notes 06, Sets and Set Operations, Venn Diagrams
Lecture Notes 06, Sets and Set Operations, Venn Diagrams
Set Operations
Imran Shafi
Email: [email protected]
Set … The Definition
A set is an unordered collection of objects
1. Students in the class: {Ahmad, Sana, Ali, Shahbaz, Farah}
2. Cities in Punjab: {Lahore, Faisalabad, Gujranwala, Jehlam}
3. Non-related items: {3, a, Apple, Sun, Trout}
If an element ‘b’ does not belongs to a set X, we use the notation
aÏX
Cardinality of a Set (Set Size)
The number of distinct elements in a set is known as its set size.
For a set S, set size is denoted by |S|.
The size of a set is non-negative integer value
Set size is also called the cardinality of a set
Examples:
1. Size of empty set is 0.
2. Size of “Set of letters is English Alphabet” is 26.
3. Size of “Natural numbers not greater than 10” is 10.
Often Used Sets
Set of Natural Numbers: N = {1, 2, 3, 4, …}
Set of Negative Integers: Z = {-1, -2, -3, -4, …}
Set of Real Numbers: R = {1.5, 0.232, 4.2E-10, …}
Set of Rational Numbers: Q = {1/2, 2/3, 3/7, …}
The Universal Set … U
A set containing all elements (in a specific situation) from which
other sets are formed:
Examples:
U = {a, b, c, …, z} and A = {a, e, i, o, u}
U = Set of Natural Numbers and B = {3, 6, 9, 12, 15}
U = Set of all students in the class and X = Set of A graders in the class
The Empty Set … ∅
The empty set contain no element. It is called an empty set.
It is denoted by the Greek letter ∅ (phi) or { }.
i.e., ∅ = { }
Number of elements: 2N
Number of Subsets … Counting with Bit Strings
Say the set S = {a, b, c}. We can encode all the subsets of S using bit
strings as follows:
If an element x is present in a subset, it is encoded with 1. Otherwise, it
is encoded with 0.
Subset c is present b is present a is present Subset Code
{} No No No 000
{a} No No Yes 001
{b} No Yes No 010
{c} Yes No No 011 Exactly the
counting of the
{a, b} No Yes Yes 100
binary system.
{a, c} Yes No Yes 101
{b, c} Yes Yes No 110
{a, b, c} Yes Yes Yes 111
Number of Subsets … Counting with Bit Strings
Say a set A = {a, b, c, d, e, f, g, h, i, j}.
A B is shaded
1. A B = B A
2. A B A and A B B
3. If A B = , then A & B are called disjoint sets
Set Operations … Membership Table
A B AB
1 1 1
Remember Conjunction Table
1 0 0 P Q PÙQ
0 1 0 T T T
0 0 0 T F F
F T F
F F F
A-B is shaded
REMARK
1. A – B B – A that is Set difference is not commutative.
2. A – B A
3. A – B, A B and B – A are mutually disjoint sets.
Membership for Difference
A B A-B
1 1 0
Remember Implication Table
1 0 1 P Q PQ ¬(PQ)
0 1 0 T T T F
0 0 0 T F F T
F T T F
F F T F
AΔB is shaded
REMARK
1. A Δ B = (A ⊕ B)
Membership for Symmetric Difference
A B AΔB
1 1 0
Remember XOR Table
1 0 1 P Q (P⊕ Q)
0 1 1 T T F
0 0 0 T F T
F T T
F F F