Week 9 - Sets
Week 9 - Sets
DISCRETE
MATHEMATICS
MODULE 3:
SETS
CHAPTER SUMMARY
• Sets
• The Language of Sets
• Set Operations
• Set Identities
• Functions
• Types of Functions
• Operations on Functions
• Computability
S = {a,b,c,d} = {b,c,a,d}
• Order not important
S = {a,b,c,d} = {a,b,c,b,c,d}
once does not change the set.
V = {a,e,i,o,u}
• Set of all vowels in the English alphabet:
S = {x | P(x)}
• A predicate may be used:
• Example: S = {x | Prime(x)}
[a,b] = {x | a ≤ x ≤ b}
[a,b) = {x | a ≤ x < b}
(a,b] = {x | a < x ≤ b}
(a,b) = {x | a < x < b}
{{1,2,3},a, {b,c}}
• Sets can be elements of sets.
{N,Z,Q,R}
• The empty set is different from a set containing the empty set.
∅ ≠{∅}
SET EQUALITY
Definition: Two sets are equal if and only if they have the same
elements.
• Therefore if A and B are sets, then A and B are equal if and only if
.
{1,3,5} = {3, 5, 1}
• We write A = B if A and B are equal sets.
{1,5,5,5,3,3,1} = {1,3,5}
SUBSETS
Definition: The set A is a subset of B, if and only if every
1. The set of all computer science majors at your school is a subset of all
Examples:
• This is equivalent to
A⊆B and B⊆A
PROPER SUBSETS
Definition: If A ⊆ B, but A ≠B, then we say A is a proper subset of
B, denoted by A ⊂ B. If A ⊂ B, then
is true.
U
Venn Diagram B
A
SET CARDINALITY
Definition: If there are exactly n distinct elements in S where n is a
nonnegative integer, we say that S is finite. Otherwise it is infinite.
Definition: The cardinality of a finite set A, denoted by
|A|, is the number of (distinct) elements of A.
Examples:
1. |ø| = 0
2. Let S be the letters of the English alphabet. Then |S| = 26
3. |{1,2,3}| = 3
4. |{ø}| = 1
5. The set of integers is infinite.
POWER SETS
Definition: The set of all subsets of a set A, denoted P(A), is
called the power set of A.
Example: If A = {a,b} then
P(A) = {ø, {a},{b},{a,b}}
this.)
TUPLES
• The ordered n-tuple (a1,a2,…..,an) is the ordered collection that
has a1 as its first element and a2 as its second element and so
on until an as its last element.
• Two n-tuples are equal if and only if their corresponding
elements are equal.
• The ordered pairs (a,b) and (c,d) are equal if and only if a = c and
• 2-tuples are called ordered pairs.
b = d.
Descartes
René
(1596-1650)
CARTESIAN PRODUCT
Definition: The Cartesian Product of two sets
A and B, denoted by A × B is the set of
ordered pairs (a,b) where a ∈ A and b ∈ B .
Example:
A = {a,b} B = {1,2,3}
A × B = {(a,1),(a,2),(a,3), (b,1),(b,2),(b,3)}
Chapter 9. )
set B. (Relations will be covered in depth in
CARTESIAN PRODUCT
Definition: The cartesian products of the sets A1,A2,……,An,
denoted by A1 × A2 × …… × An , is the set of ordered
(a1,a2,……,an) where ai belongs to Ai for i = 1, … n.
n-tuples
Solution: ∅
COMPLEMENT
Ā = {x ∈ U | x ∉ A}
(The complement of A is sometimes denoted by Ac .)
Ā = {x ∈ U | x ∉ A}
(The complement of A is sometimes denoted by Ac .)
Solution: {x | x ≤ 70}
Venn Diagram for
Complement U
Ā
A
DIFFERENCE
• Definition: Let A and B be sets. The difference of A and B,
denoted by A – B, is the set containing the elements of A that are
not in B. The difference of A and B is also called the complement
of B with respect to A.
A – B = {x | x ∈ A x ∉ B} = A ∩ Bc
2. A ∩ B
3. Ā
4.
5. A – B
6. B – A
REVIEW QUESTIONS
Example: U = {0,1,2,3,4,5,6,7,8,9,10} A = {1,2,3,4,5}, B ={4,5,6,7,8}
1. A ∪ B
2. A ∩ B
Solution: {1,2,3,4,5,6,7,8}
Solution: {4,5}
3. Ā
4.
Solution: {0,6,7,8,9,10}
5. A – B
Solution: {0,1,2,3,9,10}
6. B – A
Solution: {1,2,3}
Solution: {6,7,8}
SET IDENTITIES
• Identity laws
• Domination laws
• Idempotent laws
• Complementation law
• Associative laws
• Distributive laws
• Absorption laws
• Complement laws
PROVING SET IDENTITIES
• Prove that each set (side of the identity) is a subset of the
other.
• Use definitions and propositional logic
PROOF OF SECOND DE
MORGAN LAW
Example: Prove that
Solution: We prove this identity by showing that:
1) and
2)
Sandeep Patel C
Jalen Williams D
F
Kathy Scott
FUNCTIONS
• A function f: A → B can also be defined as a subset of A×B (a
relation). This subset is restricted to be a relation where no two
elements of the relation have the same first element.
• Specifically, a function f from A to B contains one, and only one
ordered pair (a, b) for every element a∈ A.
and
FUNCTIONS
Given a function f: A → B:
• We say f maps A to B or
f is a mapping from A to B.
• A is called the domain of f.
• B is called the codomain of f.
• If f(a) = b,
f(x) = x + 1
• A formula.
• A computer program.
z
is ? d
The preimage of y
isf(A)
?
= ? preimage(s) of z is (are)
The
QUESTIONS
f(a) = ? z A B
a
The image of d z x
is ? b
The domain of f isA y
?
The codomain of f isB
c
z
?
The preimage of y b
d
is ?
f(A) = ? {y,
z} preimage(s) of z is (are)
The {a,c,d}
QUESTION ON FUNCTIONS
AND SETS
• If and S is a subset of A, then
A B
f {a,b,c,} a
x
is ? b
f {c,d} is ? y
c
d z
QUESTION ON FUNCTIONS
AND SETS
• If and S is a subset of A, then
A B
f {a,b,c,} {y,z} a
x
is ? b
f {c,d} is ? {z y
} c
d z
INJECTIONS
Definition: A function f is said to be one-to-one , or injective, if
and only if f(a) = f(b) implies that a = b for all a and b in the
domain of f. A function is said to be an injection if it is one-to-
one.
A B
a x
v
b
y
c
z
d
w
SURJECTIONS
Definition: A function f from A to B is called onto or surjective, if
and only if for every element there is an element
with . A function f is called a surjection if it is onto.
A B
a x
b
y
c
z
d
BIJECTIONS
Definition: A function f is a one-to-one correspondence, or a
bijection, if it is both one-to-one and onto (surjective and
injective).
A
a
B
x
b
y
c
d z
w
SHOWING THAT F IS ONE-TO-
ONE OR ONTO
SHOWING THAT F IS ONE-TO-
ONE OR ONTO
Example 1: Let f be the function from {a,b,c,d} to {1,2,3}
defined by f(a) = 3, f(b) = 2, f(c) = 1, and f(d) = 3. Is f an onto
function?
b b
W W
c c
d X X
d
Y Y
QUESTIONS
Example 1: Let f be the function from {a,b,c} to {1,2,3} such
that f(a) = 2, f(b) = 3, and f(c) = 1. Is f invertible and if so what is
its inverse?
QUESTIONS
Example 1: Let f be the function from {a,b,c} to {1,2,3} such
that f(a) = 2, f(b) = 3, and f(c) = 1. Is f invertible and if so what is
its inverse?
= y – 1.
function f-1 reverses the correspondence so f-1 (y)
QUESTIONS
Example 3: Let f: R → R be such that . Is f invertible,
and if so, what is its inverse?
QUESTIONS
Example 3: Let f: R → R be such that . Is f invertible,
and if so, what is its inverse?
and
COMPOSITION QUESTIONS
Example 2: Let g be the function from the set {a,b,c} to itself
f(a) = 3, f(b) =
such that g(a) = b, g(b) = c, and g(c) = a. Let f be the function
2, and f(c) = 1.
from the set {a,b,c} to the set {1,2,3} such that
f(a) = 3, f(b) =
such that g(a) = b, g(b) = c, and g(c) = a. Let f be the function
2, and f(c) = 1.
from the set {a,b,c} to the set {1,2,3} such that
Example:
FLOOR AND CEILING
FUNCTIONS
⌊2x⌋= ⌊x⌋ + ⌊x + ½⌋
Example: Prove that x is a real number, then
PROVING PROPERTIES OF
FUNCTIONS
⌊2x⌋= ⌊x⌋ + ⌊x + 1/2⌋
Example: Prove that x is a real number, then
Examples:
f(1) = 1! = 1
f(2) = 2! = 1 ∙ 2 = 2
f(6) = 6! = 1 ∙ 2 ∙ 3∙ 4∙ 5 ∙ 6 = 720
Stirling’s Formula:
f(20) = 2,432,902,008,176,640,000.
PARTIAL FUNCTIONS
Definition: A partial function f from a set A to a set B is an
assignment to each element a in a subset of A, called the domain
of definition of f, of a unique element b in B.
• The sets A and B are called the domain and codomain of f, respectively.
• We day that f is undefined for elements in A that are not in the domain of
definition of f.
• When the domain of definition of f equals A, we say that f is a total
function.
• AÇB=A
• A is a subset of B
• If the result is neither A nor B, then A and B are not equal and not a subset
A È B, A È (B - A).
(A È B) = (A È (B - A))
= (A È (B Ç Ac)) 2nd form of difference
= (A È B) Ç (A È Ac) Distributive law
= (A È B) Ç U Complement laws
= (A È B) Identity laws
Therefore: equal
A È (B Ç C), (A È B) Ç C
A È (B Ç C) = (A È B) Ç C
= (A Ç C) È (B Ç C) Distributive law
Not equal
A È (B Ç C), (A È B) Ç C
Test if one set is a subset of the another set
A È (B Ç C) È (A È B) Ç C
A È (B Ç C) È (A Ç C) È (B Ç C) Distributive law
[A È (A Ç C) ]È [(B Ç C) È (B Ç C)] Idempotent, Commutative and Associative law
A È (B Ç C) Idempotent Law
Therefore
(A È B) Ç C Í A È (B Ç C)
(A - B) È (A - C), A - (B Ç C).
• (A - B) È (A - C) = A - (B Ç C)
• (A Ç Bc) È (A Ç Cc) 2ND Form of Difference
• A Ç (Bc È Cc) Distributive Law
• A Ç (B Ç C) c De Morgan’s Law
• A - (B Ç C) 1st form of Differnce
• Therefore, equal
THE END