Unit8 Set Function
Unit8 Set Function
Example:
Let
C = {ECE students, CE students, IE students, CS students, Mech
students, Building students}.
A is the set whose elements, x, are elements of C, x ∈ C, such that x is
completely EE Dept students.
A = {x | x ∈ C, is completely EE Dept students}
A = {ECE, CE, IE}
Basic Set Theory 1-5
Identity
❑ Two sets are identical iff (if and only if) they
have exactly the same members.
❑ Example:
{0,2,4} = {x | x is an even natural number less than 5}
❑ Example:
C = {10¢, 20¢, 50¢, $1, $2, $5, $10}
|C| = 7.
1. x ∈ 𝐴 ⋆ 𝐵 if x ∈ 𝐴 or x ∈ 𝐵, what is “⋆”?
∪ Union Operator
2. x ∈ 𝐴 ⋄ 𝐵 if x ∈ 𝐴 and x ∈ 𝐵, what is “⋄”?
∩ Intersection Operator
3. A = {@, $, %, ^, *, **, 3, 5, 99, M, N, K, ☺, , ☺ #, ☺}
𝐴 ∪ 𝐵 = 𝐴ҧ ∩ 𝐵ത
Equivalent just the same as 2 ways iff
prove 𝐴 ∪ 𝐵 ⊆ 𝐴ҧ ∩ 𝐵,ത and 𝐴ҧ ∩ 𝐵ത ⊆ 𝐴 ∪ 𝐵
x ∉ 𝐴 𝑎𝑛𝑑 x ∉ 𝐵 x ∉ 𝐴 𝑎𝑛𝑑 x ∉ 𝐵
Therefore 𝐴 ∪ 𝐵 = 𝐴ҧ ∩ 𝐵ത
QED
❑ Find A ∪ 𝐶 ∩ 𝐵. A B
U C
𝐴 𝐵
Strawberry Mango Banana
Grape
Apple
Tomato Orange
Watermelon
𝐶
A×B≠B×A
y y
X = x
x
𝑋 × 𝑌 = { 𝑥, 𝑦 | 𝑥∈𝑋 & 𝑦 ∈ 𝑌}
❑ Set difference:
𝐴 − 𝐵 is defined as the set of all elements that are in
𝐴 but not in 𝐵.
𝐴 − 𝐵 = 𝐴 ∩ 𝐵𝑐 (Difference Law)
❑ Set difference:
𝐴 − 𝐵 is defined as the set of all elements that are in
𝐴 but not in 𝐵.
𝐴 − 𝐵 = 𝐴 ∩ 𝐵𝑐 (Difference Law)
A B
𝐴−𝐵
associative laws:
• 𝐴 ∪ 𝐵 ∪ 𝐶 = 𝐴 ∪ (𝐵 ∪ 𝐶)
• 𝐴 ∩ 𝐵 ∩ 𝐶 = 𝐴 ∩ (𝐵 ∩ 𝐶)
distributive laws:
• 𝐴∪ 𝐵∩𝐶 = 𝐴∪𝐵 ∩ 𝐴∪𝐶
• 𝐴 ∩ 𝐵 ∪ 𝐶 = 𝐴 ∩ 𝐵 ∪ (𝐴 ∩ 𝐶)
o difference law:
• 𝐴 − 𝐵 = 𝐴 ∩ 𝐵𝑐
Basic Set Theory 1-21
The Algebra of Sets: Fundamental
Laws (cont.)
❑ For any subset 𝐴 of universal set 𝑈:
identity laws:
• 𝐴∪∅=𝐴
• 𝐴∩𝑈 =𝐴
complement laws:
• 𝐴 ∪ 𝐴𝑐 = 𝑈
• 𝐴 ∩ 𝐴𝑐 = ∅
absorption law:
• 𝐴∪ 𝐴∩𝐵 = 𝐴
• 𝐴∩ 𝐴∪𝐵 = 𝐴
Basic Set Theory 1-23
The Algebra of Sets: Additional
Laws (cont.)
❑ For complements.
❑ For any subsets 𝐴 and 𝐵 of a universal set 𝑈:
De Morgan's law:
• 𝐴∪𝐵 𝑐 = 𝐴𝑐 ∩ 𝐵𝑐
• 𝐴∩𝐵 𝑐 = 𝐴𝑐 ∪ 𝐵𝑐
double complement law:
• (𝐴𝑐 )𝑐 = 𝐴
complements of 𝑈 and ∅:
• 𝑈𝑐 = ∅
• ∅𝑐 = 𝑈
(𝐴 ∪ 𝐵 ∩ 𝐶 )𝑐 = (𝐶 𝑐 ∪ 𝐵𝑐 ) ∩ 𝐴𝑐
Proof:
Always start from the LHS and it is important to write each step with one move
(𝐴 ∪ 𝐵 ∩ 𝐶 )𝑐 = 𝐴𝑐 ∩ 𝐵 ∩ 𝐶 𝑐 De Morgan Law
= 𝐴𝑐 ∩ 𝐵𝑐 ∪ 𝐶 𝑐 De Morgan Law
= 𝐵𝑐 ∪ 𝐶 𝑐 ∩ 𝐴𝑐 Commutative Law
= 𝐶 𝑐 ∪ 𝐵𝑐 ∩ 𝐴𝑐 Commutative Law
QED
Basic Set Theory 1-25
The Algebra of Sets: Example 2
= 𝐴 ∩ 𝐴𝑐 ∪ (𝐴 ∩ 𝐵𝑐 ) by distributive law
= ∅ ∪ (𝐴 ∩ 𝐵𝑐 ) by complement law
= 𝐴 ∩ 𝐵𝑐 by identity law
=𝐴−𝐵 by set difference
𝐴𝐶 ∩ 𝐵𝐶 − 𝐶 𝐶 ∪ 𝐶 ∩ 𝐴 ∪ 𝐶 ∩ 𝐵 = C.
𝐴𝐶 ∩ (𝐵𝐶 −𝐶 𝐶 ) ∪ 𝐶 ∩ 𝐴 ∪ 𝐶 ∩ 𝐵
= 𝐴𝐶 ∩ 𝐵𝐶 ∩ 𝐶 ∪ 𝐶 ∩ 𝐴 ∪ 𝐶 ∩ 𝐵 by the Set Difference law
= 𝐴𝐶 ∩ 𝐵𝐶 ∩ 𝐶 ∪ 𝐴 ∩ 𝐶 ∪ 𝐵 ∩ 𝐶 by the Commutative law of ∩
= 𝐴𝐶 ∩ 𝐵𝐶 ∪ 𝐴 ∪ 𝐵 ∩ 𝐶 by the Distributive law
= 𝐴∪𝐵 𝐶
∪𝐴∪𝐵 ∩𝐶 by the De Morgan’s law
Input output
function
Pair B Pair A Pair A Pair B
x= Kim Wu x= 2 y= 4 y= 2791
x= CW Chan x=3 y= 9 y= 2811
Function Set 2
Set 1
Set 2:
Set 1: City
EE1001
U EE
students
students
Basic Set Theory 4-31
Relations and functions
ALL functions are Relations, but NOT ALL Relations are Functions
Given ordered pairs
Pair A: Pair B:
Domain: {3, 8, -2. 10} Domain: {7, -2. 10}
permeant citizens.
❑ And whose codomain is the set of
possible HK ID numbers.
❑ The range consists of those HK ID
numbers that are in actual use.
Some ID numbers may not be in use by HK
permeant citizens because of many different
reasons, such as passed away persons, and
temporary HK residents.
Basic Set Theory 4-38
To introduce 3 fundamental mathematical
functions:
• surjective, injective and bijective.
f f
Not injective,
4, 3 map to
the same “A”
4
X Y X Y
1 A 1 A
2 B 2 B
3 C 3 C
4 D 4 D
5 5 E
surjective Not surjective (element E
Basic Set Theory 4-46
left out)
Bijective
❑ Bijective means both Injective and Surjective together,
∀𝑦 ∈ 𝑌, ∃! 𝑥 ∈ 𝑋 such that 𝑦 = f(x).
❑ A function that is both “one-on-one” and “onto” is called a
bijection or a one-on-one correspondence.
❑ If every “x” goes to a unique “y” and every “y” has a mapping
from ‘x” then we can go back and forwards without confused.
❑ Every bijective function, f, has an inverse function, 𝑓 −1 .
f
Note:
∃! is read there exists only one
Not
surjective 𝑥 𝑥
0 0
Surjective
0 𝑥 0 𝑥
Bijective
Solution. Since the codomain of 𝑓 and the domain of 𝑔 are both equal to
ℝ, and the codomain of 𝑔 and the domain of 𝑓 are also equal to 𝑅, both
composites are defined and are functions 𝑅 → 𝑅 ( from 𝑅 𝑡𝑜 𝑅).
Now
𝑔∘𝑓 𝑥 =𝑔 𝑓 𝑥 = 𝑔 𝑥 2 = 4𝑥 2 − 5
While
𝑓∘𝑔 𝑥 =𝑓 𝑔 𝑥 = 𝑓 4𝑥 − 5 = (4𝑥 − 5)2 = 16𝑥 2 − 40𝑥 + 25
Note: in general 𝑔 ∘ 𝑓 ≠ 𝑓 ∘ 𝑔.
The operation of composition is not commutative.
3/28/2024
4-53
Is Composition always Possible?
Not ALL functions can be composed.
Let 𝑓: 𝑅 → 𝑅 and g: 𝑅 → 𝑅
3/28/2024
4-54
END