Week 4 Sets Operations and Functions (2.2 - 2.3)
Week 4 Sets Operations and Functions (2.2 - 2.3)
02/16/25 1
Module #3 - Sets
02/16/25 2
Module #3 - Sets
3
Module #3 - Sets
Inclusion-Exclusion Principle
02/16/25 4
Module #3 - Sets
Set Difference
• For any two sets A and B, the difference of A and B,
written A B, is the set of all elements that are in A but not
in B.
A B : x x A x B
x x A x B
A – B = A B is called the complement of B with respect
to A.
e.g. {1, 2, 3, 4, 5, 6} {2, 3, 5, 7, 9, 11} = {1, 4, 6 }
Set A B
Set A Set B
02/16/25 5
Module #3 - Sets
Symmetric Difference
• For any two sets A and B, the symmetric difference of A
and B, written , is the set of all elements that are in
A but not in B or in B but not in A.
: x (x A x B) (x B x A)
(A – B) (B – A) (A B) – (A B)
U
A B
Set Complements
• U : Universe of Discourse
A : For any set A U, the complement of A,
i.e. it is U A.
A {x | x A} A
A
e.g. If U = N,
U
{3, 5} {0,1, 2, 4, 6, 7, ...}
02/16/25 7
Module #3 - Sets
Example
Let A and B are two subsets of a set E such that AB = {1,
2}, |A|= 3, |B| = 4, A = {3, 4, 5, 9} and B = {5, 7, 9}. Find the
sets A, B and E.
A 7 1 3 B
E 2 4
5 9
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}.
• AB = {1, 2, 3, 4, 5, 6, 7, 8}
• AB = {4, 5}
• A = {0, 6, 7, 8, 9, 10}
• B = {0, 1, 2, 3, 9, 10}
• A B = {1, 2, 3}
• B A = {6, 7, 8}
• AB = {1, 2, 3, 6, 7, 8}
02/16/25 9
Module #3 - Sets
Module #3 - Sets
2.3 Functions
Definition: Let A and B be nonempty sets. A function f from
A to B, denoted f : A B is an assignment of each element
of A to exactly one element of B. We write f (a) = b if b is
the unique element of B assigned by the function f to the
element a of A.
• Functions are sometimes Grades
Students
A
called mappings or Carlota Rodriguez
transformations. B
Sandeep Patel
C
Jalen Williams D
Kathy Scott F
02/16/25 11
Module #3 - Sets
Functions
02/16/25 12
Module #3 - Sets
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,
– then b is called the image of a under f.
– a is called the preimage of b.
• The range of f is the set of all images of points in A under
f. We denote it by f (A).
• Two functions are equal when they have the same domain,
the same codomain and map each element of the domain to
the same element of the codomain.
02/16/25 13
Module #3 - Sets
Representing Functions
02/16/25 14
Module #3 - Sets
02/16/25 15
Module #3 - Sets
Injections
02/16/25 16
Module #3 - Sets
Surjections
b
e.g. The function f (x) = x 1 from Z y
c
to Z is onto since z
d
for all b Z, there is a Z
such that f (a) = b (a = b + 1)
02/16/25 17
Module #3 - Sets
Bijections
b
e.g. The function f (x) = x 1 from Z y
c
to Z is one-to-one and onto, hence z
d
bijective w
02/16/25 18
Injective, Surjective, Bijective functions
02/16/25 20
Module #3 - Sets
Inverse Functions
02/16/25 22
Module #3 - Sets
Inverse Functions
f
A B A B
v a v
a
b b
w w
c c
d x x
d
y y
02/16/25 23
Module #3 - Sets
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?
Solution: The function f is invertible because it is a one-to-one
correspondence. The inverse function f -1 reverses the
correspondence given by f, so f -1 (1) = c, f -1 (2) = a, and f -1
f -1 (y) = y – 1.
inverse function f -1 reverses the correspondence so
02/16/25 24
Module #3 - Sets
Composition
Definition: Let f : B → C, g: A → B. The composition of f with
g, denoted f ∘ g is the function from A to C defined by
f ∘ g (x) = f (g(x))
02/16/25 25
Module #3 - Sets
Composition
26
Module #3 - Sets
Composition
Example 1: Let g be the function from the set {a, b, c} to itself such that
g(a) = b, g(b) = c, and g(c) = a. Let f be the function from the set {a, b,
c} to the set {1, 2, 3} such that f (a) = 3, f (b) = 2, and f (c) = 1. What is
the composition of f and g, and what is the composition of g and f.
Solution: The composition f ∘ g is defined by
f ∘ g (a)= f (g(a)) = f (b) = 2.
f ∘ g (b)= f (g(b)) = f (c) = 1.
f ∘ g (c)= f (g(c)) = f (a) = 3.
Note that g ∘ f is not defined, because the range of f is not a subset
of the domain of g.
02/16/25 27
Module #3 - Sets
Composition
02/16/25 28
Module #3 - Sets
Graphs of Functions
Let f be a function from the set A to the set B. The graph of the
function f is the set of ordered pairs {(a, b) | a ∈ A and f (a) = b}.
02/16/25 29
Module #3 - Sets
Important Functions
(a) The floor function, denoted
is the largest integer less than or equal to x.
(b) The ceiling function, denoted
is the smallest integer greater than or equal to x.
02/16/25 30
Module #3 - Sets
Partial Functions (optional)
31