Documente Academic
Documente Profesional
Documente Cultură
EXAMPLES:
- Vowels in English alphabet
V = {a, e, i, o, u}
- First five prime numbers
P = {2, 3, 5, 7, 11}
5∈P
‘5 is an element of P’ or ‘5 is in P’
20 ∉ P
‘20 is NOT an element of P’ or ‘ 20 is NOT in P’
REPRESENTING SETS
1) Listing the members.
2) Definition by property, using set builder notation.
{x | x has property P}
EXAMPLES:
- Seasons of the year.
S = {spring, summer, autumn, winter}
S = {x | x is a season of the year}
‘S is the set of all x such that x is a season of the year’.
Integers
Z = {…, -2,-1,0,1,2, …}
Positive integers
Z+ = {1,2, 3.…}
Rational numbers
Q = {p/q | p ∈ Z, q ∈ Z, q ≠ 0}
Real numbers
R
CARDINALITY
Definition: Let S be a set. If there are exactly n distinct elements
in S, where n is a nonnegative integer, we say S is a finite set and
that n is the cardinality of S. The cardinality of S is denoted by |S|.
EXAMPLES:
• V={1, 2, 3, 4, 5}
|V| = 5
• A={1,2,3,4, …, 20}
|A| = 20
•|Ø|=0
EQUIVALENT SETS
Definition: Two sets are EQUIVALENT if
they have the same number of elements.
EXAMPLE:
A = {a, b, c, d}
B = {1, 2, 3, 4}
|A| = |B| = 4, so A ≡ B
EQUAL SETS
Definition: Two sets are EQUAL if and only if they
have EXACTLY the same elements.
EXAMPLE:
A = {1, 2, 3} , B = {3, 1, 2}
OR
A = {1, 3, 2} , B = {2, 1, 2, 3, 3}
so A = B
VENN DIAGRAM
A set can be visualized using Venn Diagrams:
V = { A, B, C }
TYPES OF SETS
SPECIAL SETS:
- Universal Set
- Empty (Null) Set
Infinite & Finite Set
Power Set
UNIVERSAL SET
Definition: The set of all elements under consideration
in a given discussion. It is denoted as U.
EXAMPLE:
U = {a, b, c, d, e, f, g, h, i, j}
A = {a, b, c}
B = {c, d, e}
C = {f, g, h}
SUBSET
Definition: A set of A is said to be a subset of B if and
only if every element of A is also an element of B. We
use A ⊆ B to indicate A is a subset of B.
Example 2
X={1,2,3}
Y={1,2,3}
Here set Y is a subset (Not a proper subset) of set X as all the elements
of set Y is in set X.
EXAMPLE:
A = {x | x is a month containing 32 days}
So, A = ∅ , | ∅ | = 0
Theorem: ∅ ⊆ S
Empty set is a subset of any set.
Proof:
Recall the definition of a subset: all elements of a set A must be also
elements of B: ∀x (x ∈ A → x ∈ B).
We must show the following implication holds for any S
∀x (x ∈ ∅ → x ∈ S)
Since the empty set does not contain any element, x ∈ ∅ is
always False.
Then the implication is always True.
End of proof
SUBSET PROPERTIES
Theorem: S ⊆ S
Any set S is a subset of itself
Proof:
The definition of a subset says: all elements of a set A
must be also elements of B: ∀x (x ∈ A → x ∈ B).
Applying this to S we get:
∀x (x ∈ S → x ∈ S) which is trivially True
End of proof
Note on equivalence:
Two sets are equal if each is a subset of the other set.
A PROPER SUBSET
Definition: “subset of but not equal to”.
A set A is a proper subset of set B (written as A ⊂ B) if every element
of A is an element of set B and | A | < | B |.
EXAMPLE:
X={1,2,3,4,5,6}
Y={1,2}
Here set Y ⊂ X since all elements in Y are contained in X too and X has
at least one element is more than set Y.
INFINITE & FINITE SET
Definition: A set is infinite if it is not
finite.
EXAMPLES:
The set of natural numbers is an infinite
set.
N = {0, 1, 2, 3, ... }
The set of reals is an infinite set.
The set of days in a week is a finite set.
POWER SET
Definition: Given a set S, the power set of S
is the set of all subsets of S. The power set is
denoted by P(S).
EXAMPLES:
Assume an empty set ∅.
What is the power set of ∅ ?
P(∅) = { ∅ }
What is the cardinality of P(∅) ?
| P(∅) | = 1
POWER SET
Assume set {1}
• P( {1} ) = { ∅, {1} }
• |P({1})| = 2
Assume {1,2}
• P( {1,2} ) = { ∅, {1}, {2}, {1,2} }
• |P({1,2} )| = 4
Assume {1,2,3}
• P({1,2,3}) = {∅, {1}, {2}, {3}, {1,2}, {1,3}, {2,3}, {1,2,3} }
• |P({1,2,3} | = 8
EXAMPLE:
Coordinates of a point in the 2-D plane (12, 16).
CARTESIAN PRODUCT
Definition: Let S and T be sets. The Cartesian product
of S and T, denoted by S x T, is the set of all ordered
pairs (s, t), where s ∈ S and t ∈ T.
Hence, S x T = { (s,t) | s ∈ S ∧ t ∈ T}.
EXAMPLES:
S = {1,2} and T = {a,b,c}
S x T = { (1,a), (1,b), (1,c), (2,a), (2,b), (2,c) }
T x S = { (a,1), (a, 2), (b,1), (b,2), (c,1), (c,2) }
Note: S x T ≠ T x S !!!!
CARDINALITY OF CARTESIAN
PRODUCT
|S x T| = |S| * |T|.
EXAMPLE:
A= {John, Peter, Mike}
B ={Jane, Ann, Laura}
A x B = {(John, Jane), (John, Ann) , (John, Laura),
(Peter, Jane), (Peter, Ann) , (Peter, Laura) , (Mike, Jane)
, (Mike, Ann) , (Mike, Laura)}
|A x B| = 9
|A|=3, |B|=3 Æ |A| |B|= 9
EXAMPLE:
A = {1,2,3,6}
B = { 2,4,6,9}
A ∪ B = {1,2,3,4,6,9}
SET INTERSECTION
Definition: The intersection of sets A and B
(denoted by A∩B) is the set of elements which
are in both A and B.
Hence, A∩B={x|x∈A AND x∈B}.
EXAMPLE:
A = {1,2,3,6}
B = { 2,4,6,9}
A ∩ B = {2,6}
DISJOINT SETS
Definition:
Two sets are called disjoint if their intersection is empty.
A and B are disjoint if and only if A ∩ B = ∅.
EXAMPLE:
A={1,2,3,6}
B={4,7,8}
A∩B=∅
CARDINALITY OF SET UNION
Formula: |A ∪ B| = |A| + |B| - |A ∩ B|
EXAMPLE:
A={10,11,12,13}
B={13,14,15}
(A−B)={10,11,12}
(B−A)={14,15}
EXAMPLE:
U={1,2,3,4,5,6,7,8}
A ={1,3,5,7}
A’ = {2,4,6,8}
SET IDENTITIES
analogous to logical equivalences
Identity
A ∪ ∅ =A
A ∩ U =A
Domination
A∪U=U
A∩∅=∅
Idempotent
A ∪A =A
A ∩A =A
SET IDENTITIES
Double complement
A =A
Commutative
A ∪ B = B ∪A
A ∩ B = B ∩A
Associative
A ∪ (B ∪ C) = (A ∪B) ∪C
A ∩ (B ∩ C) = (A ∩ B) ∩C
Distributive
A ∪ (B ∩C) = (A∪ B) ∩(A ∪ C)
A ∩ (B ∪ C) = (A ∩B) ∪(A ∩C)
SET IDENTITIES
DeMorgan’s
(A ∩ B) = A ∪ B
(A ∪ B) = A ∩ B
Absorption
A ∪ (A ∩ B) = A
A ∩ (A ∪ B) = A
Complement
A ∪A = U
A ∩A = ∅
Difference
A – B =A ∩ B
SET IDENTITIES
Set identities can be proved using membership tables.
List each combination of sets that an element can belong to.
Then show that for each such a combination the element either
belongs or does not belong to both sets in the identity.
EXAMPLE:
Prove: (A ∩ B) = A ∪ B
COMPUTER REPRESENTATION
OF SETS
COMPUTER REPRESENTATION
OF SETS
SETS
RELATIONS
CSC510 – Discrete Structures
EXAMPLE:
R1 = {(a,b) | a ≤ b},
R2 = {(a,b) | a > b},
R3 = {(a,b) | a = b or a = -b},
R4 = {(a,b) | a = b},
R5 = {(a,b) | a = b + 1},
R6 = {(a,b) | a + b ≤ 3}.
Which of these relations contain each of the pairs (1,1), (1,2), (2,1), (1,-1),
and (2,2) ?
(1,1) -> R1 , R3 , R4 , R6
(1,2) -> R1 , R6
(2,1) -> R2 , R5 , R6
(1,-1) -> R2 , R3 , R6
(2,2) -> R1 , R3 , R4
NUMBER OF BINARY RELATIONS
PROPERTIES OF RELATIONS
Reflexive Relations
Irreflexive Relations
Symmetric Relations
Antisymmetric Relations
Transitive Relations
REFLEXIVE RELATIONS
Definition: A relation R on a set A is called reflexive if (a,a) ∈ R for
every element a ∈ A.
EXAMPLE:
Consider the following relations on {1,2,3,4}:
R1 = {(1,1), (1,2), (2,1), (2,2), (3,4), (4,1), (4,4)},
R2 = {(1,1), (1,2), (2,1)},
R3 = {(1,1), (1,2), (1,4), (2,1), (2,2), (3,3), (4,1), (4,4)},
R4 = {(2,1), (3,1), (3,2), (4,1), (4,2), (4,3)},
R5 = {(1,1), (1,2), (1,3), (1,4), (2,2), (2,3), (2,4), (3,3), (3,4), (4,4)},
R6 = {(3,4)}.
Which relations are REFLEXIVE?
R3 and R5 - contains (1,1), (2,2), (3,3) and (4,4)
IRREFLEXIVE RELATIONS
Definition: A relation R on a set A is called irreflexive if (a,a) ∉ R for every
element a ∈ A.
EXAMPLE:
Consider the following relations on {1,2,3,4}:
R1 = {(1,1), (1,2), (2,1), (2,2), (3,4), (4,1), (4,4)},
R2 = {(1,1), (1,2), (2,1)},
R3 = {(1,1), (1,2), (1,4), (2,1), (2,2), (3,3), (4,1), (4,4)},
R4 = {(2,1), (3,1), (3,2), (4,1), (4,2), (4,3)},
R5 = {(1,1), (1,2), (1,3), (1,4), (2,2), (2,3), (2,4), (3,3), (3,4), (4,4)},
R6 = {(3,4)}.
Which relations are IRREFLEXIVE?
R1 , R2 , R4 , and R6 – does not contains (1,1), (2,2), (3,3) and (4,4)
IRREFLEXIVE RELATIONS (cont.)
SYMMETRIC RELATIONS
Definition: A relation R on a set A is called
symmetric if
∀ a, b ∈ A (a,b) ∈ R → (b,a) ∈ R
EXAMPLE:
Consider the following relations on {1,2,3,4}:
R = {(1,2), (1,3), (1,4), (2,1), (2,3), (2,4), (3,1),
(3,2), (3,4), (4,1), (4,2), (4,3)}
Is R SYMMETRIC?
YES - (a,b) ∈ R → (b,a) ∈ R
ANTISYMMETRIC RELATIONS
Definition: A relation on a set A is called antisymmetric if
[(a,b) ∈ R and (b,a) ∈ R] → a = b where a, b ∈ A
EXAMPLE:
Relation R on A = {1,2,3,4} defined as:
R = {(1,2),(2,2),(3,3)}
Is R ANTISYMMETRIC?
YES
TRANSITIVE RELATIONS
Definition: A relation R on a set A is called transitive if
[(a,b) ∈ R and (b,c) ∈ R] → (a,c) ∈ R for all a, b, c ∈ A.
EXAMPLE 1:
Consider the following relations on {1,2,3,4}:
R1 = {(1,1), (1,2), (2,1), (2,2), (3,4), (4,1), (4,4)},
R2 = {(1,1), (1,2), (2,1)},
R3 = {(1,1), (1,2), (1,4), (2,1), (2,2), (3,3), (4,1), (4,4)},
R4 = {(2,1), (3,1), (3,2), (4,1), (4,2), (4,3)},
R5 = {(1,1), (1,2), (1,3), (1,4), (2,2), (2,3), (2,4), (3,3), (3,4), (4,4)},
R6 = {(3,4)}.
Which relations are TRANSITIVE?
R4 , R5 , R6
TRANSITIVE RELATIONS (cont.)
EXAMPLE 2
EXAMPLE 3
EQUIVALENCE RELATION
◦ Reflexive, Symmetric and Transitive
EXAMPLE 1:
Let A = {1,2,3} and B = {a,b,c}
Assume f is defined as:
•1c
•2a
•3c
Is f a function ?
Yes - since f(1)=c, f(2)=a, f(3)=c. each element of A is assigned
an element from B.
REPRESENTING FUNCTIONS
(cont.)
EXAMPLE 2:
Let A = {1,2,3} and B = {a,b,c}
Assume g is defined as:
•1c
•1b
•2a
•3c
Is g a function ?
No - g(1) = is assigned both c and b.
IMPORTANT SETS
IMPORTANT SETS (cont.)
EXAMPLE:
Let A = {1,2,3} and B = {a,b,c}
• Assume f is defined as:
1c
2a
3c
What is the image of 1?
1 c, c is the image of 1.
What is the pre-image of a?
2 a, 2 is a pre-image of a.
Domain of f ?
{1,2,3}
Codomain of f ?
{a,b,c}
Range of f ?
{a,c}
IMAGE OF A SUBSET
EXAMPLE1:
IMAGE OF A SUBSET (cont.)
IMAGE OF A SUBSET (cont.)
EXAMPLE 2:
TYPES OF FUNCTIONS
Injective Function
Surjective Function
Bijective Function
Identity Function
Inverse Function
INJECTIVE FUNCTION
INJECTIVE FUNCTION (cont.)
EXAMPLE 1:
Let A = {1,2,3} and B = {a,b,c}
Define f as:
1→c
2→a
3→c
Is f one to one?
No, it is not one-to-one since f(1) = f(3) =
c, and1 ≠ 3.
INJECTIVE FUNCTION (cont.)
EXAMPLE 2:
Let g : Z → Z, where g(x) = 2x - 1.
Is g is one-to-one ?
Yes.
Suppose g(a) = g(b),
i.e.,
2a - 1 = 2b - 1
=> 2a = 2b
=> a = b.
SURJECTIVE FUNCTION
SURJECTIVE FUNCTION (cont.)
EXAMPLE 1:
Let A = {1,2,3} and B = {a,b,c}
Define f as:
•1c
•2a
•3c
Is f an onto?
No. f is NOT onto, since b ∈ B has no pre-
image
SURJECTIVE FUNCTION (cont.)
EXAMPLE 2:
Let A = {0,1,2,3,4,5,6,7,8,9}, and B = {0,1,2}
Is h an onto function?
Yes. h is onto since a pre-image of 0 is 6, a pre-
image of 1 is 4, a pre-image of 2 is 8.
BIJECTIVE FUNCTIONS
BIJECTIVE FUNCTION (cont.)
EXAMPLE 1:
Let A = {1,2,3} and B = {a,b,c}
Define f as:
•1c
•2a
•3b
Is f is a bijection?
Yes. It is both one-to-one and onto.
IDENTITY FUNCTION
INVERSE FUNCTION
INVERSE FUNCTION (cont.)
INVERSE FUNCTION (cont.)
INVERSE FUNCTION (cont.)
INVERSE FUNCTION (cont.)
COMPOSITION OF FUNCTION
COMPOSITION OF FUNCTION
(cont.)
COMPOSITION OF FUNCTION
(cont.)
COMPOSITION OF FUNCTION
(cont.)