Suhail Q. Mir: University of Kashmir
Suhail Q. Mir: University of Kashmir
MSc. IT
Directorate of Information Technology & Support Systems
University of Kashmir
What is a SET
A SET is a collection of Objects.
Examples:
• A = Students in DM class
• V = {a, e, i, o, u}. The set V of all vowels in the English alphabet
• B = {2,4,6,8} , even numbers lesser than 10
-
• ℤ = -ve integers
• {a, 2, Fred, New Jersey} is the set containing the four
elements a, 2, Fred, and New Jersey.
Elements of a SET
The Individual Objects Inside the set are referred to as the elements of the SET
u∈V 2∈B
-3 ∈ ℤ
notation
The notation {a, b, c, d} represents the set with the 6∈ℤ
four elements a, b, c, and d. This way of describing a
set is known as the Roster Method.
Elements that do not belong to a SET
Not a SUBSET
A B Example 1 Example 2
B = {2,4,6,8} B = {ℤ}
A = {1,6} A = {⅜,∏,5,6,7}
A⊈B A⊈B
SUBSET EXAMPLES
Example 1 Example 2
B = {2,4,6,8} B = {ℤ}
A = {2,6} A = {⅜,∏,5,6,7}
A⊆B A⊈B
if x ∈ A then x ∈ B. if x ∈ A then x ∉ B.
X=6 X= ⅜
USING THE QUANTIFIERS
Example 1 Example 2
B = {2,4,6,8} B = {ℤ}
A = {2,6} A = {⅜,∏,5,6,7}
A⊆B A⊈B
if x ∈ A then x ∈ B If x ∈ A then x ∉ B.
∀x ∈ A , x ∈ B ∃x ∈ A , x ∉ B
(For ALL X in A, X is also in B) There EXISTS an X in A that does not belong to B
0R 0R
(For EVERY ELEMENT of X in A, X is also in B) there exists an element X in A that does
not belong to B
USING THE QUANTIFIERS
Example 1 Example 2
B = {2,4,6,8} A = {ℤ}
A = {2,6} B= {0,5,6,7}
B ⊇ A (superset notion) A ⊇ B (superset notion)
if x ∈ A then x ∈ B If x ∈ B then x ∈ A.
R = {...8, √-16,- π /2,- 1,3/4 , √2, e, π (pi),20,…}, the set of all real numbers.
R+ = {1, 3/4 , √2, e, π (pi),20,…} the set of all positive real numbers
{x ∣ P(x) }
TRUE
Example 1: the set of all even positive integers less than 20.
= {x ∣ x is an even positive integer less than 20}
= {x ∣ x is even and x < 20 and x ∈ ℤ+ }
= {x ∈ ℤ+ ∣ x is even and x < 20}
{x ∣ P(x) }
TRUE
S T S↔T
S=T↔ ∀x P(x) 1 1 TRUE
1 0 FALSE
0 1 FALSE
0 0 TRUE
P Q
THE EMPTY SET.
∅ (“null”, “the empty set”) is the unique set that contains no
elements whatsoever.
The empty set can also be denoted by {}
∅ = { }= {x | False},
singleton set (set with one element).
¬∃x: x∈∅.
{ } ≠ {∅} = { { } } {∅} it isn’t empty because it has ∅ as a member!
1 ≠ {1} ≠ { {1} }
CARDINALITY
|S| (read “the cardinality of S”) is a measure of how
many different elements S has.
Example:
Let A be the set of odd positive integers less than 10. Then |A| = 5.
|∅|=0, | {2, 5, 3} | = 3, | {a, b} | = 2,
then P(S) = { ∅, {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3} }
Note that for finite S, |P(S)| = 2|S|
P(∅) = {∅}
P({∅}) = {∅, {∅}}
every nonempty set S is guaranteed to have at least two
∅ ⊆ S, S ⊆ S subsets, theempty set and the set S itself, that is
THE POWER SET
Example:
Let S = {x | x ⊆ {a,b,c}} Note that for finite S, |P(S)| = 2|S|
Find its P(S) = { }
Example:
Let S = {x | x ⊆ {red, blue}}
Find its P(S) = { }
VENN DIAGRAMS.
Sets can be represented graphically using Venn diagrams.
In Venn diagrams the universal set U, which contains all the objects
under consideration, is represented by a rectangle. (Note that the
universal set varies depending on which objects are of interest.) Inside
this rectangle, circles or other geometrical figures are used to represent
sets. Sometimes points are used to represent the particular elements of
the set. Venn diagrams are often used to indicate the relationships
between sets.
VENN DIAGRAMS.
Examples 1:
Draw a Venn diagram that represents V, the set of vowels in the English
alphabet.
U = { English Alphabet }
V = {a,e,i,o,u}
V⊆U OR
VENN DIAGRAMS.
Example 2
ℤ = {set of integers}, A = {-1,-6,0,2,6,9}
A⊆ℤ
ℤ ℤ
. -1 . -6
A .2 A .0
.9 .6
Example 3
ORDERED ELEMENTS (N-TUPLES).
These are like sets, except that duplicates matter, and the order
makes a difference.
The ordered n-tuple (a1, a2,…, an) is the ordered collection that has a1 as
its first element, a2 as its second element,…, and an as its nth element.
We say that two ordered n-tuples are equal if and only if each
corresponding pair of their elements is equal. In other words, (a1, a2,…,
an) = (b1, b2,…, bn) if and only if ai = bi, for i = 1, 2,…, n. In particular,
ordered 2-tuples are called ordered pairs. The ordered pairs (a, b) and
(c, d) are equal if and only if a = c and b = d.
Note that (1, 2) ≠ (2, 1) ≠ (2, 1, 1).
CARTESIAN PRODUCT (SETS).
For sets A and B, their Cartesian product denoted by A × B, is the
set of all ordered pairs (a, b), where a∈A and b∈B.
Hence,
A × B = { (a, b) | a∈A ∧ b∈B }.
{a, b} × {1, 2}
= { (a, 1), (a, 2), (b, 1), (b, 2) }
B × A = {1, 2} × {a, b}
= { (1, a), (2, a), (1, b), (2, b) }
CARTESIAN PRODUCT (SETS).
The Cartesian product of the sets A , A ,…, A , denoted by A × A ×⋯× A , is the
1 2 n 1 2 n
Q1. What is the Cartesian product A × B × C, where A = {0, 1}, B = {1, 2},
and C = {0, 1, 2}?
Q2. Let A = {a, b, c}, B = {x, y}, and C = {0, 1}. Find
a) A × B × C. b) C × B × A.
c) C × A × B. d) B × B × B.
MORE EXERCISES
Q1. What is the cardinality and power sets of each of these
sets?
1. {∅, {∅}}, 2. {∅, {∅}, {∅, {∅}}}