Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums, and Matrices
Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums, and Matrices
3 2.3 Functions
2.1 Sets
3/43
Some important sets in discrete mathematics:
N = {0, 1, 2, 3, . . .}, the set of natural numbers
Z = {. . . , −2, −1, 0, 1, 2, . . .}, the set of integers
Z+ = {1, 2, 3, . . .}, the set of positive integers
Q = {p/q | p ∈ Z, q ∈ Z, and q 6= 0}, the set of rational
numbers
R, the set of real numbers
Equal Sets
Two sets A and B are called equal, written A = B, if they
have the same elements.
A = B if and only if ∀x(x ∈ A ↔ x ∈ B).
A × B = {(a, b) | a ∈ A, b ∈ B}
Example 2.
Let A = {a, b, c} and B = {1, 2}. Find A × B and B × A.
the Cartesian Product of more than Two Sets
The Cartesian product of the sets A1 , A2 , . . . , An , denoted by
A1 × A2 × . . . × An , is the set
A1 × A2 × . . . × An = {(a1 , a2 , . . . , an ) | ai ∈ Ai , ∀i = 1, 2, . . . , n}
Example 3.
Let A = {a, b, c}, B = {x, y }, and C = {0, 1}. Find A × B × C .
2.1 Sets
2.2 Set operations
2.3 Functions
2.4 Sequences and Summations
2.5 Cardinality of Sets
A ∪ B = {x | x ∈ A ∨ x ∈ B}
A − B = {x | x ∈ A ∧ x ∈
/ B}
A = U − A = {x | x ∈
/ A}
n
[
Ai = A1 ∪ A2 ∪ . . . ∪ An
i=1
= {x | (x ∈ A1 ) ∨ (x ∈ A2 ) ∨ . . . ∨ (x ∈ An )}
n
\
Ai = A1 ∩ A2 ∩ . . . ∩ An
i=1
= {x | x ∈ Ai , ∀i = 1, 2, . . . , n}
Example 4.
n
[ n
\
For i = 1, 2, . . ., let Ai = {i, i + 1, i + 2, . . .}. Find Ai , Ai .
i=1 i=1
Computer Representation of Sets
Assume that the universal set U is finite.
First, specify an arbitrary ordering of the elements of U, for
instance a1 , a2 , . . . , an .
Represent a subset A of U with the bit string of length n,
where the ith bit in this string is 1 if ai belongs to A and is 0
if ai does not belong to A.
Example 5.
Suppose that the universal set is U = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}.
a) Express each of the following sets with bit strings
2.3 Functions
18/43
Figure: The function f maps A to B.
(a) Function (b) Not a function
Functions as sets of ordered pairs
A function can be represented by a set of ordered pairs in which no
two different ordered pairs have the same first coordinate.
Example 6.
a) The set {(−2, 2), (−1, 1), (0, 0), (1, 1), (2, 2)} represents a
function.
the domain is {−2, −1, 0, 1, 2}
the range is {2, 1, 0}
b) The set {(10, 6), (23, –1), (38, 6), (10, 4), (59, 4)} does not
represent a function.
Example 7. Determine whether f is a function if
a) f : Z → R, f (x) = x 2 + 2
1
b) f : Z → R, f (x) = + 5x
(x − 1)2
(2x + 5)2
c) f : R → R, f (x) =
7 − 2x
(2x + 5)2
d) f : Z → R, f (x) =
7 − 2x
Some Important Functions
Floor function
f : R → Z, f (x) = bxc = the largest integer that is less than
or equal to x.
Ceiling function
f : R → Z, f (x) = dxe = the smallest integer that is greater
than or equal to x.
Example 8. Compute b 32 − d3 + 54 ec
One-to-One Functions
A function f is said to be one-to-one (injective) if and only if
f (a) = f (b) implies that a = b for all a and b in the domain of f .
Example 10.
Determine whether the function f : Z × Z → Z is onto if
a) f (m, n) = m + n
b) f (m, n) = |n|
Bijective Functions
The function f is a one-to-one correspondence, or a bijection, if it
is both one-to-one and onto. We also say that such a function is
bijective.
Inverse Functions
Let f : A → B be a bijection. The inverse function of f , denoted
by f −1 , is the function that assigns to an element b ∈ B the
unique element a ∈ A such that f (a) = b.
(f ◦ g )(a) = f (g (a)), ∀a ∈ A
Example 12. Let f (x) = 5x + 4, g (x) = 4x + 3. Suppose that
f ◦ g (x) = ax + b. Find a + b.
2.1 Sets
2.2 Set operations
2.3 Functions
2.4 Sequences and Summations
2.5 Cardinality of Sets
Sequences
A sequence is a function from a subset of Z (usually either the
set {0, 1, 2, . . .} or the set {1, 2, . . .}) to a set S.
We use the notation an to denote the image of the integer n.
an is called a term of the sequence.
We use the notation {an } to describe the sequence.
32/43
Geometric Progression
A geometric progression is a sequence of the form
a, ar , ar 2 , . . . , ar n , . . .
where the initial term a and the common ratio r are real numbers.
a, a + d, a + 2d, . . . , a + nd, . . .
where the initial term a and the common difference d are real
numbers.
n
X
Pn P
am + am+1 + . . . + an = i=m ai = m≤i≤n ai = ai
i=m
i: the index of summation
m: lower limit
n: upper limit
8
X
Example 14. What is the value of (−1)k ?
k=4
The sum of terms of a geometric progression
If a and r are real numbers and r 6= 0, then
n ar n+1 − a
X
j
ar = if r 6= 1
r −
(n + 1)a1
j=0 if r = 1
Some Useful Summation Formulae
Example 15. Compute
P100 2
a) k=50 k
10
X
b) (2i+1 − 2i )
i=0
2.1 Sets
2.2 Set operations
2.3 Functions
2.4 Sequences and Summations
2.5 Cardinality of Sets
The sets A and B have the same cardinality (|A| = |B|) if and
only if there is a one-to-one correspondence from A to B.
A set that is either finite or has the same cardinality as the set
of positive integers is called countable.
A set that is not countable is called uncountable.
When an infinite set S is countable, we denote the cardinality
of S by ℵ0 .
42/43
Exercises