MT131 Tutorial - 2 Sets Functions Sequences and Summation - 2023-2024
MT131 Tutorial - 2 Sets Functions Sequences and Summation - 2023-2024
MT131 Tutorial - 2 Sets Functions Sequences and Summation - 2023-2024
9/25/2023
Module #3 - Sets
Sets
• Sets are one of the basic building blocks for the types of
objects considered in discrete mathematics.
– Important for counting.
– Programming languages have set operations.
• Set theory is an important branch of mathematics.
– Many different systems of axioms have been used to
develop set theory.
– Here we are not concerned with a formal set of axioms
for set theory. Instead, we will use what is called naïve
set theory.
Sets
• A set is an unordered collection of objects.
– The students in this class.
– The chairs in this room.
• The objects in a set are called the elements, or members of the
set. A set is said to contain its elements.
• The notation a ∈ A denotes that a is an element of the set A.
• If a is not a member of A, write a ∉ A
• There must be an underlying Universal set U, either specifically
stated or understood.
• For example:
A = {1, 3, 5, 7}; 3 A , 2 A
C = {x | x = n2 + 1, n is an integer, 0 ≤ n ≤ 10}
9/25/2023 (c)2001-2003, Michael P. Frank
Arab Open University – Faculty of Computer Studies MT131 - Discrete Mathematics
Module #3 - Sets
• S = {a, b, c, d}
• Order not important
S = {a, b, c, d} = {b, c, a, d}
• Each distinct object is either a member or not; listing more
than once does not change the set.
S = {a, b, c, d} = {a, b, c, b, c, d}
• Ellipses (…) may be used to describe a set without listing
all of the members when the pattern is clear.
S = {a, b, c, d, …, z }
Roster Method
[a, b] = {x | a ≤ x ≤ b}
[a, b) = {x | a ≤ x < b}
(a, b] = {x | a < x ≤ b}
(a, b) = {x | a < x < b}
Examples
A = { x | x = n2 , n is positive integer}
B = { x | x is a letter of the word mohamed}
U : universal set
S
2 3
5 7
9/25/2023
Arab Open University – Faculty of Computer Studies MT131 - Discrete Mathematics
Module #3 - Sets
Subset Relation
Proper Subset
• S T (S is a proper subset of T ) means every element of
S is also an element of T, but S T.
S
T
e.g. {1, 2} {1, 2, 3}
9/25/2023 16
Arab Open University – Faculty of Computer Studies MT131 - Discrete Mathematics
Module #3 - Sets
Ordered n-tuples
Set Operations
The Union Operator
• For any two sets A and B, AB is the set containing all
elements that are either in A, or in B or in both.
• Formally:
AB = {x | x A x B}.
Inclusion-Exclusion Principle
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
9/25/2023 (c)2001-2003, Michael P. Frank
Arab Open University – Faculty of Computer Studies MT131 - Discrete Mathematics
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, ...}
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}
Set Identities
• Identity: A = A = AU
• Domination: AU = U , A =
• Idempotent: AA = A = AA
• Double complement: ( A ) A
• Commutative: AB = BA , AB = BA
• Associative: A(BC) = (AB)C
A(BC) = (AB)C
• Distribution: A(BC) = (AB)(AC)
A(BC) = (AB)(AC)
• De Morgan’s Law: A B A B
A B A B
9/25/2023 (c)2001-2003, Michael P. Frank
Arab Open University – Faculty of Computer Studies MT131 - Discrete Mathematics
Module #3 - Sets
Assume x AB
x AB by the definition of the complement
x AB by the definition of the negation
((x A) (x B)) by the definition of intersection
(x A) ( x B) by De Morgan’s law
x A x B by the definition of negation
x A x B by the definition of the complement
x A B by the definition of union
A B { x | x A B}
{ x | ( x A B )}
{ x | ( x A x B )}
{ x | x A x B )}
{ x | x A x B )}
{ x | x A x B )}
{ x | x A B )} A B
Show that A ( B C ) (C B) A
A ( B C ) A ( B C ) De Morgan' s law
A ( B C ) De Morgan' s law
( B C ) A Commutativ e law
(C B) A Commutativ e law
(B C) A (B C) A
( B A) (C A)
( B A) (C A).
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.
Grades
• Functions are sometimes Students
A
called mappings or Carlota Rodriguez
transformations. B
Sandeep Patel
C
Jalen Williams D
Kathy Scott F
9/25/2023 38
Arab Open University – Faculty of Computer Studies MT131 - Discrete Mathematics
Module #3 - Sets
Functions
9/25/2023 39
Arab Open University – Faculty of Computer Studies MT131 - Discrete Mathematics
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.
9/25/2023 40
Arab Open University – Faculty of Computer Studies MT131 - Discrete Mathematics
Module #3 - Sets
Representing Functions
9/25/2023 41
Arab Open University – Faculty of Computer Studies MT131 - Discrete Mathematics
Module #3 - Sets
Injections
9/25/2023 42
Arab Open University – Faculty of Computer Studies MT131 - Discrete Mathematics
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)
9/25/2023 43
Arab Open University – Faculty of Computer Studies MT131 - Discrete Mathematics
Module #3 - Sets
Bijections
b y
e.g. The function f (x) = x 1 from Z
c
to Z is one-to-one and onto, hence z
d
bijective w
9/25/2023 44
Arab Open University – Faculty of Computer Studies MT131 - Discrete Mathematics
Module #3 - Sets
Inverse Functions
9/25/2023 46
Arab Open University – Faculty of Computer Studies MT131 - Discrete Mathematics
Module #3 - Sets
Inverse Functions
f
A B A B
v a v
a
b b
w w
c c
d x d x
y y
9/25/2023 47
Arab Open University – Faculty of Computer Studies MT131 - Discrete Mathematics
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
(3) = b.
Example 2: Let f : Z Z be such that f (x) = x + 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 (f (a) = f (b) a + 1 = b + 1 a = b). The
inverse function f -1 reverses the correspondence so
f -1 (y) = y – 1.
9/25/2023 48
Arab Open University – Faculty of Computer Studies MT131 - Discrete Mathematics
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))
9/25/2023 49
Arab Open University – Faculty of Computer Studies MT131 - Discrete Mathematics
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.
9/25/2023 50
Arab Open University – Faculty of Computer Studies MT131 - Discrete Mathematics
Module #3 - Sets
Composition
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}.
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.
Sequences
Geometric Sequence
Arithmetic Sequence
Summations
Examples
Summation Formulas
Summation Manipulations
-
Example
100 2
Find 𝑘=50 𝑘 ?
100 49 100
𝑘2 = ( 𝑘2) + 𝑘2
𝑘=1 𝑘=1 𝑘=50
100 100 49
𝑘2 = ( 𝑘2) − 𝑘2
𝑘=50 𝑘=1 𝑘=1
100.101.201 49.50.99
= −
6 6
= 338,350 − 40,425
= 297,925
Arab Open University – Faculty of Computer Studies MT131 - Discrete Mathematics
Module #3 - Sets