0% found this document useful (0 votes)
2 views31 pages

Week 4 Sets Operations and Functions (2.2 - 2.3)

Module #3 covers sets, functions, and matrices, detailing set operations such as union, intersection, and set difference, along with the inclusion-exclusion principle. It also introduces functions, including definitions of injective, surjective, and bijective functions, as well as the concept of inverse functions and function composition. Examples throughout the module illustrate these concepts in practice.

Uploaded by

daniahafez20
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views31 pages

Week 4 Sets Operations and Functions (2.2 - 2.3)

Module #3 covers sets, functions, and matrices, detailing set operations such as union, intersection, and set difference, along with the inclusion-exclusion principle. It also introduces functions, including definitions of injective, surjective, and bijective functions, as well as the concept of inverse functions and function composition. Examples throughout the module illustrate these concepts in practice.

Uploaded by

daniahafez20
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 31

Module #3 - Sets

2. Sets, Functions and


Matrices

02/16/25 1
Module #3 - Sets

2.2 Set Operations


The Union Operator 
• For any two sets A and B, AB is the set containing all
elements that are either in A, or in B or in both.
• Formally:
AB = {x | x A  x  B}.

{2, 3, 5}{3, 5, 7} = {2, 3, 5, 3, 5, 7} = {2, 3, 5, 7}

02/16/25 2
Module #3 - Sets

The Intersection Operator 


• For any two sets A and B, their intersection AB is the set
containing all elements that are in both A and in B.
• Formally:
AB = {x | x  A  x  B}.
• {a, b, c}  {2, 3} =  disjoint
• {2, 4, 6}  {3, 4, 5} = {4}

3
Module #3 - Sets

Inclusion-Exclusion Principle

• How many elements are in AB?


|AB| = |A|  |B|  |AB|
Example:
{1, 2, 3}  {2, 3, 4, 5} = {1, 2, 3, 4, 5}
{1, 2, 3}  {2, 3, 4, 5} = {2, 3}
|{1, 2, 3, 4, 5}| = 3 + 4 – 2 = 5

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

e.g. {1, 2, 3, 4, 5, 6}  {2, 3, 5, 7, 9, 11} = {1, 4, 6, 7, 9, 11}


02/16/25 6
Module #3 - Sets

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 AB = {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

A = {1, 2, 7}, B = {1, 2, 3, 4},


E = {1, 2, 3, 4, 5, 7, 9}
02/16/25 8
Module #3 - Sets

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}.

• AB = {1, 2, 3, 4, 5, 6, 7, 8}
• AB = {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}
• AB = {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

• 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.
x x  A  y[ y  B  ( x, y )  f ]
and
x, y1, y2 [( x, y1 )  f  ( x, y2 )  f ]  y1  y2 

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

Functions may be specified in different ways:


– An explicit statement of the assignment
Students and grades example
– A formula.
f (x) = x + 1
– A computer program
A Java program that when given an integer n,
produces the nth Fibonacci Number.

02/16/25 14
Module #3 - Sets

Functions and Sets

02/16/25 15
Module #3 - Sets

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
e.g. The function f (x) = x  1 from Z v
b
to Z is one-to-one since y
c
f (a) = f (b) z
d
a1=b1
w
a=b

02/16/25 16
Module #3 - Sets

Surjections

Definition: A function f from A to B is called onto, or


surjective, if and only if for every element b  B there is
an element a  A with f (a) = b. A function f is called a
surjection if it is onto. A B
a x

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

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 B
a x

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

© 2019 McGraw-Hill Education


Module #3 - Sets

Showing that f is one-to-one or onto

02/16/25 20
Module #3 - Sets

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?
Solution: Yes, f is onto since all three elements of the codomain
are images of elements in the domain. If the codomain were
changed to {1, 2, 3, 4}, f would not be onto.

Example 2: Is the function f (x) = x2 from the set of integers to


the set of integers onto?
Solution: No, f is not onto because, for example, there is no
integer x with x2 = −1.
02/16/25 21
Module #3 - Sets

Inverse Functions

Definition: Let f be a bijection from A to B. Then the


inverse of f, denoted f 1, is the function from B to A
defined as

No inverse exists unless f is a bijection. Why?

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

Example 2: Let f : Z  Z be such that f (x) = x + 1. Is f


(3) = b.

invertible, and if so, what is its inverse?


Solution: The function f is invertible because it is a one-to-one
correspondence (f (a) = f (b)  a + 1 = b + 1  a = b). The

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.

Example 2: If f (x) = x2 and g(x) = 2x + 1, then

02/16/25 27
Module #3 - Sets

Composition

Example 3: Let f and g be functions from the set of integers to the


set of integers defined by f (x) = 2x + 3 and g(x) = 3x + 2. What
is the composition of f and g and also the composition of g and
f?
Solution:
f ∘ g (x) = f (g(x)) = f (3x + 2) = 2(3x + 2) + 3 = 6x + 7
g ∘ f (x) = g(f (x)) = g(2x + 3) = 3(2x + 3) + 2 = 6x + 11

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}.

Graph of f (n) = 2n + 1 from N to Graph of f (x) = x2 from Z to Z


N

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.

Graphs of floor and ceiling from R to Z

02/16/25 30
Module #3 - Sets
Partial Functions (optional)

31

You might also like