You are on page 1of 117

Chapter 2: Basic Structures: Sets, Functions, Sequences,

Sums and Matrices

Trần Hòa Phú

Ngày 14 tháng 9 năm 2023


Sets
Definition
A set is an unordered collection of objects, called
elements or members of the set.
We write a ∈ A: a is an element of the set A.
The notation a ̸∈ A:a is not an element of the set A.
Example
The set V of all vowels in the English alphabet:
V = {a, e, i, o, u}. Elements of V are a, e, i, o, u.
We can write a ∈ V , b ̸∈ V , f ̸∈ V .

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Example
The set of positive integers less than 100 can be
denoted by A = {1, 2, 3, ..., 99}
or A = {x |x is an positive integer less than 100}

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Exercise
List the members of these sets
a) A = {2, a, b, c}
 

 

b) B = 

{2}, 1, 3

 

 

c) C = 

{1}, {{1}}

d) {x |x is a real number such that x 2 = 1}


e) {x |x is a positive integer less than 12}
f) {x |x is the square of an integer and x < 100}
Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Exercise
For each of the following sets, determine whether 2 is an
element of that set
a) {x ∈ R|x is an integer greater than 1}
b) {x ∈ R|x is the square of an integer}
 

 

c) {2, {2}} d) 

{2}, {{2}}

 

 

e) 

{2}, {2, {2}}

f) {{{2}}}
Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Equality of two sets
Definition
Two sets are equal if and only if they have the same
elements.
Therefore, A and B are equal if and only if
∀x (x ∈ A ←→ x ∈ B) is T
We write A = B to denote that A and B are equal.
Example
The sets {1, 3, 5}= {5, 3, 1}
The sets {1, 1, 3, 3, 5} = {1, 3, 5}
Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Empty set (Tập rỗng)
Definition
The empty set ∅ is a set has no elements.
Be careful: ∅ =
̸ {∅}!!!

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Subsets
Tập hợp con
Definition
The set A is a subset of B (A ⊆ B) if and only if every
element of A is also an element of B.
Therefore, A ⊆ B if and only if ∀x (x ∈ A −→ x ∈ B) is T.

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Example
{1, 3, 5} ⊆ {1, 3, 5, 6, 7}
Example
The set of all even integers is a subset of the set of all
integers.
The set of all boy students in a class is a subset of all
students in the class.

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Theorem
For every set S,
i) ∅ ⊆ S
ii) S ⊆ S
Proof
i) To show that ∅ ⊆ S, we must show that
∀x (x ∈ ∅ −→ x ∈ S) is T.
We have ”x ∈ ∅” is F because ∅ has no element. Thus
”x ∈ ∅ −→ x ∈ S” is T.
Therefore ∀x (x ∈ ∅ −→ x ∈ S) is True.

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Exercise
List all the subsets of {1, 2}
Solution
∅ ⊆ {1, 2}
{1} ⊆ {1, 2}
{2} ⊆ {1, 2}
{1, 2} ⊆ {1, 2}
All subsets of {1, 2} are: ∅, {1, 2}, {1}, {2}.

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Exercise
 

 

List all the subsets of B = ∅, {∅}
Solution    

 
 
 

All subsets of B are: ∅, ∅, {∅}, {∅}, {∅}.

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Exercise

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Exercise

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
The Size of a Set
Definition Let S be a set.
The cardinality of S, denoted by |S|, is the number of
distinct elements in S.
If the number of distinct elements is finite then S is
called a finite set.
Example
Let A = {1, 2, 3, 4, 5}.Then |A| = 5.
Example
Let B = {1, 1, 2, 2, 3}.
Then |B| = 3.
Example |∅| = 0
Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Exercise

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Definition
A set is said to be infinite (vô hạn) if the number of distinct
elements is infinite.
Example The set of positive integers is infinite.
Example The set of rational numbers is infinite.

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Power Sets
Definition
Given a set S, the power set of S is the set of all
subsets of the set S.
The power set of S is denoted by P(S).
Example
What is the power set of the set {1, 2}?
Solution  

 

P({1, 2}) = 

∅, {1, 2}, {1}, {2}

.

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Theorem
Số các tập hợp con của tập A bằng 2số phần tử của A
|P(A)| = 2|A|
Example Let A = {1, 2}
Then |P(A)| = 2|A| = 22 = 4
Example Let B = {a, b, c}
Then |P(B)| = 2|B| = 23 = 8
Example Let C = {1, 2, 2, a, a}
Then |P(C )| = 2|C | = 23 = 8.
Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Cartesian Products
Definition
Let A and B be sets. The Cartesian product of A and B,
denoted by A × B = {(a, b)|a ∈ A, b ∈ B}
Example
Let A = {1, 2} and B = {3, 4}.
Then A × B = {(1, 3), (1, 4), (2, 3), (2, 4)}

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Theorem
Số phần tử khác nhau của tập hợp A × B = số phần tử
khác nhau của tập A× số phần tử khác nhau của tập B
|A × B| = |A|.|B|
Example
A = {1, 2, 3} , B = {a, b, c, d}
|A × B| = |A| × |B| = 3.4 = 12
|P(A × B)| = 2|A×B| = 2|A|.|B| = 212

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Cartesian products
Definition
The Cartesian products of the sets A1 , A2 , ..., An is the set of
ordered n− tuples (a1 , a2 , ..., an ), where
a1 ∈ A1 , a2 ∈ A2 , ..., an ∈ An .
Example Given A = {0, 1}, B = {1, 2}, C = {2, 3}
A × B × C consists of all ordered triples (a, b, c) where
a ∈ A, b ∈ B, c ∈ C
A × B × C = {(0, 1, 2), (0, 1, 3), (0, 2, 2), (0, 2, 3)
(1, 1, 2), (1, 1, 3), (1, 2, 2), (1, 2, 3)}
Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Notation:
A2 = A × A
A3 = A × A × A
Example
A = {1, 2}
A2 = {(1, 1), (1, 2), (2, 2), (2, 1)}

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Disjoint (Rời nhau)
Definition
Two sets are called disjoint if their intersection is the empty set.

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Example Let A = {2, 4, 6} and B = {1, 3, 5}
A and B are disjoint?
Solution
Yes! A ∩ B = ∅

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Exercise
Let A = {1, 2, 3, 4, 5} and B = {0, 3, 6, {1, 2}}.
Find A ∩ B, B ∪ A, A − B, B − A, A ⊕ B.

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Set Identites

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Generalization Unions and Intersections

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Computer Representation of Sets
Example
Let U be the universal set. U = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
A = {2, 3, 5, 8}
The bit string that represents A is 0110100100
B = {1, 2, 3, 4, 5}
The bit string that represents B is 1111100000

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Exercise
Given a universal set U = {1, 2, 3, 4, 5, 6, 7, 8, 9} and
A = {1, 3, 5, 7, 9}
Find the bit strings which represent the set A and U − A.

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Exercise
Given a universal set U = {1, 2, 3, 4, 5, 6, 7, 8, 9}.
The bit string for A = {1, 3, 4, 5, 6, 9} is 101111001
The bit string for B = {2, 3, 6, 7, 8} is 011001110
Use bit strings to find the union and intersect of the set?

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Exercise
Suppose that the universal set is U = {a, b, c, d, e}.
Given the set represented by strings
A = ”1 1 1 0 0”
B = ”0 1 0 1 0”
List all elements in the set A − B.
A. {a, b, c}
B. {a, b, d}
C. {a, c}
D. {a, b}
Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Functions (Hàm số, Ánh xạ)
Definition
• Let A and B be nonempty sets.
A function f from A to B is an assignment such that each
element of A is assigned to exactly one element of B.

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Example

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Example

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Example

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Example

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Domain, Codomain, Range
Definition
If f is a function from A to B, we say that
• A is the domain of f
• B is the codomain of f .
• If f (a) = b, we say that b is the image of a, and a is the
preimage of b.
• The range, or image, of f is the set of all images of
elements of A.

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Example

Let f be the function.


The domain of f is {3, 11, −2, 9, 5}
The codomain of f is {10, −8, 2, −1, 4}
The images of f is {10, 2, −1, 4}
Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Using a formula to define a function
Example
Let f : Z → Z, f (x ) = x + 1. Is f a function?
Solution
∀x (x ∈ Z → f (x ) ∈ Z) is T ?
∀x (x ∈ Z → x + 1 ∈ Z) is T ?
f is a function.

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
x
Example Let f : Z → Z, f (x ) = . Is f a function?
2
Solution
∀x (x ∈ Z → f (x ) ∈ Z) is T ?
∀x (x ∈ Z → x /2 ∈ Z) is T ?
f is not a function.

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Example
1
Let f : R → R, f (x ) = . Is f a function?
x −1
Solution
• ∀x (x ∈ R → f (x ) ∈ R) is T?
 
1
• ∀x 
x ∈ R → ∈ R is T?
x −1
f is not a function

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Exercise
What are functions?
2x
f : R → R: f (x ) =
(x − 1)2
g : R → Z: g(x ) = 2x
1
h : Z → R: h(x ) = √ + 2x + 7
x− 2

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Exercise
Determine whether if f is a function from Z to R if
a) f (n) = −n

b) f (n) = n2 + 1
1
c) f (n) =
n2 − 4

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
One-To-One functions
(Hàm đơn ánh)
Definition
Let f be a function from A to B.
f is one-to-one from A to B if
 

∀a, b ∈ A
f (a) = f (b) → a = b  is T

or  

∀a, b ∈ A
a ̸= b → f (a) ̸= f (b) is T

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Example Is the following function is one-to-one?

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Example Is the following function is one-to-one?

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Example Is f (x ) : Z → Z, f (x ) = 2x + 5 one-to-one?
Solution  

f is one-to-one if ∀a, b ∈ Z
f (a) = f (b) → a = b  is T?

f is one-to-one if ∀a, b ∈ Z(2a + 5 = 2b + 5 → a = b) is


T?
f is one-to-one.

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Example Is f : Z → Z, f (x ) = x 2 is one-to-one?
Solution  

f is one-to-one if ∀a, b ∈ Zf (a) = f (b) → a = b  is T?


f is one-to-one if ∀a, b ∈ Z(a2 = b 2 → a = b) is T?
f is not one-to-one.

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Onto Functions
(Hàm toàn ánh)
Definition
A function f from A to B is called onto, or a surjection if
and only if for every element b ∈ B, there is an element
a ∈ A with f (a) = b .

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Example Is the following function onto?

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Example The function below is onto?

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Example Let f : Z → Z, f (x ) = x + 1. Is f onto?
Solution
f is onto
if for every b ∈ Z, there exists a ∈ Z such that f (a) = b (T ?).
if for every b ∈ Z, there exists a ∈ Z such that a + 1 = b (T ?).
if for every b ∈ Z, there exists a ∈ Z such that a = b − 1 (T ?).
f is onto.

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Example Let the function f : Z → Z, f (x ) = 3x + 2. Is f onto?
Solution
f is onto
if for every b ∈ Z, there exists a ∈ Z such that f (a) = b (T ?).
if for every b ∈ Z, there exists a ∈ Z such that 3a + 2 = b (T ?).
b−2
if for every b ∈ Z, there exists a ∈ Z such that a = (T ?).
3
f is not onto.

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Exercise
Determine whether each of these functions from
{a, b, c, d} to itself is one-to-one (onto)
a) f (a) = b, f (b) = a, f (c) = c, f (d) = d
b) f (a) = b, f (b) = b, f (c) = d, f (d) = c
c) f (a) = d, f (b) = b, f (c) = c, f (d) = d

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Bijective functions
(Hàm song ánh)
Definition
The function f is a bijection if it is both one-to-one and
onto. We also say that such a function is bijective.

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Example
The following function is bijective?

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Example The following function is bijective?

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Example Let f be a function from {a, b, c, d} to
{1, 2, 3, 4} with f (a) = 4, f (b) = 2, f (c) = 1 and
f (d) = 3. Is f a bijection?
Solution
• f is one-to-one because no two values in the domain are
assigned the same function value.
• f is onto because all four elements of the codomain are
images of elements in the domain.
Hence f is bijective.

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Inverse functions (Hàm số ngược)
Definition Let f be a bijective function from the set A to
the set B. The inverse function of f (f −1) is the function
that assigns to an element y ∈ B to the unique element
x ∈ A such that f (x ) = y .

Method to find f −1 : f(x) = y ⇔ f −1 (y) = x.


Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Example

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Example 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 it is, what is its inverse?
Solution
f is invertible because f is bijective.
f −1(1) = c, f −1(2) = a and f −1(3) = b.

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Example Let f : Z → Z be a function such that
f (x ) = x + 1. Is f invertible, and if it is, what is its inverse?
Solution
f is invertible because f is bijective (both one-to-one and
onto).
To find its inverse:
f (x ) = y ⇔ f −1(y ) = x
Solve x : f (x ) = y
⇔x +1=y
⇔ x = y − 1.
Thus f −1(y ) = y − 1.
Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Exercise
Find the inverse functions (if they exist) of the following
functions?
1) Let f : Z → Z such that f (x ) = 2x + 3.
2) Let g : R → R such that g(x ) = 2x + 3

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Example Let f be a function from R → R with
f (x ) = x 2. Is f invertible?
Solution
f is not one-to-one because f (−2) = f (2). Hence f is
not bijective. Thus f is not invertible.

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Composition
Definition
Let g be a function from the set A to the set B and let f
be a function from the set B to the set C . The composition
of the functions f and g, denoted for all x ∈ A by f ◦ g, is
denoted by
(f ◦ g)(x ) = f (g(x ))

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Example find f ◦ g?

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Example
Let f , g : Z → Z be functions defined by
f (x ) = 2x + 3, g(x ) = 3x + 2
What are f ◦ g, g ◦ f , f ◦ f , g ◦ g?
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
(f ◦ f )(x ) = f (f (x )) = f (2x + 3) = 2.(2x + 3) + 3 = 4x + 9
(g ◦g)(x ) = g(g(x )) = g(3x +2) = 3.(3x +2)+2 = 9x +8

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Exercise
Let f , g : R → R be functions defined by
f (x ) = sin x g(x ) = 2x + 1
Find f ◦ g, g ◦ f .

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Floor functions
(Hàm sàn)
Definition
The floor function assigns to the real numbers x the
largest integer that is less than or equal to x .
The value of the floor function at x is denoted by ⌊x ⌋
Example ⌊1/2⌋ = 0, ⌊−1/2⌋ = −1, ⌊2.5⌋ = 2.
Example How many positive integers less than 20 and
divisible by 3 ?

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Ceiling functions
(Hàm trần)
Definition
The ceiling function assigns to the real number x the
smallest integer that is greater than or equal to x .
The value of the ceiling function at x is denoted by ⌈x ⌉
Example
⌈1/2⌉ = 1, ⌈−1/2⌉ = 0, ⌈3.5⌉ = 4
Example A worker earns 700.000VND/day. How many
days he need to work to earn 5.000.000VND?
Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Exercise
Find these values
a) ⌈1.1⌉ b) ⌈−0.1⌉
c) ⌈4⌉ d) ⌊3.2⌋
 

 1 &
2 '

e) ⌊−5.2⌋ f) 
 + 

2 3

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Sequences (Dãy số)
Định nghĩa Dãy số thực là một ánh xạ
x :N → R
n → x (n) ≡ xn
Ta dùng các kí hiệu sau để chỉ dãy số thực x : {xn }n≥0 , {xn }n≥1
1
Ví dụ {xn } với xn = , n ∈ N là 1 dãy số thực. Dãy này có 3 số
n
hạng đầu
  là x 1 , x 2 , x 3 , nghĩa là 1, 1/2, 1/3
1 1 1
Ví dụ   là 1 dãy số thực. Dãy này có 3 số hạng đầu 1, , .
n n≥1 2 3
1 1 1
Ví dụ 1, , , ..., , ... là 1 dãy số thực.
2 3 n
Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Example Consider the sequence {an }, where
an = (n + 1)2 , n ∈ N
a1 = (1 + 1)2 = 4
a2 = (2 + 1)2 = 9
a10 = (10 + 1)2 = 121
a1000 = 10012

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Exercise
List the first five terms of the sequence {xn } với
xn = 2n + 1, n ∈ N

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Recurrence Relations
Example
Let {an } be a sequence such that
an = an−1 + 1 ∀n ≥ 1, a0 = 1 (1)
a1 = a0 + 1 = 1 + 1 = 2
a2 = a1 + 1 = 2 + 1 = 3
a3 = a2 + 1 = 3 + 1 = 4

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Example Let {an } be a sequence such that

an = an−1 + an−2 ∀n ≥ 2, a0 = 1, a1 = 1. (2)


a2 = a1 + a0 = 1 + 1 = 2
a3 = a2 + a1 = 2 + 1 = 3
a4 = a3 + a2 = 3 + 2 = 5

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Exercise
Find the first five terms of the sequence defined by each of
these recurrence relations and initial condition.
a) an = 6an−1 ∀n ≥ 1, a0 = 2
2
b) an = an−1 ∀n ≥ 1, a0 = 2
2
c) an = an−1 + 2an−2 ∀n ≥ 2, a0 = 1, a1 = 2

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Exercise
Given a sequence {an } satisfying the recurrence relation
a0 = −1, an = an−1 + 2n ∀n = 1, 2, ...
Find a6
a)123 b)125 c)127 d)121 e)None of them is correct

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Summation
Notation
n
aj = am + am+1 + ... + an
X

j=m

Example
100 1 1 1 1 1
= + + + ... + ,
X

j=1 j 1 2 3 100
5
i 2 = 12 + 22 + 32 + 42 + 52
X

i=1

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Exercise
What are the values of these sums?
5
A= (k + 1)
X

k=1
4
B= (−2)j
X

j=0
5
C= 3
X

i=1
3
D= (j − 2)2
X

j=0
Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Given S = {1, 3, 5, 7}
2j = 2.1 + 2.3 + 2.5 + 2.7 = 32
X

j∈S

j 2 = 12 + 32 + 52 + 72 = 84
X

j∈S
1
 
j +  =?
X

j∈S j

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Double Summations
4 X
3 4 4
ij = (i + 2i + 3i) = 6i = 6 + 12 + 18 + 24 = 60
X X X

i=1 j=1 i=1 i=1

Exercise Find the values of the following sums


3 X
2
(2i − 3j)
X

i=1 j=0
2 X
3
i 2j 3
X

i=0 j=0

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Theorem
If a and r are real numbers and r ̸= 0, 1. Then
n
X ar n+1 − a
j
ar =
j=0 r −1

Example
8 3.29 − 3
j
= 3.29 − 3
X
3.2 =
j=0 2−1

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Theorem
n
X n(n + 1)
k= n∈N
k=1 2
n n(n + 1)(2n + 1)
k2 =
X
n∈N
k=1 6
Example
50
X 50(50 + 1)
k= = 1275
k=1 2
30 30.31.61
k2 =
X
= 9455
k=1 6

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Exercise
Compute each of these (double) sums
8
(1 + (−1)j )
X

j=0
3 X
2
i
X

i=1 j=0
A. 20,9
B. 10,9
C. 0,3
D. None of these
Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Exercise

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Exercise
Determine whether f : Z × Z → Z is onto if
i) f (m, n) = m − 2n
ii) f (m, n) = |n|
A. onto, onto
B. not onto, onto
C. not onto, not onto
D. onto, not onto

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Exercise
List the first 3 termns of the sequence whose nth term is
the sum of the first n positive integers.
A. 1,3,5
B. 1,2,5
C. 1,2,3
D. 1,3,6

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Exercise
Suppose an = 1 + 3 + 5 + ... + (2n − 1), n = 1, 2, 3, ...
Find a1, a2, a3, a4.
A. 1, 3, 5, 7
B. 1, 4, 9, 13
C. None of the others
D. 1, 4, 9, 16

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Exercise
Suppose that the universal set is U = {1, 2, 3, 4, 5, 6, 7}
Express the set {1, 4, 5, 7} with bit strings where the i th
bit in the string is 1 if it is in the set and 0 otherwise
A. 1001101
B. None of the others
C. 1111000
D. 0001111
E. 10010010

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Exercise
Which one is true?
i) A ⊕ B = (A ∪ B) − (A ∩ B)
ii) A ⊕ B = (A − B) ∪ (B − A)
A. Both
B. Neither
C. Only i
D. Only ii

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Exercise
Determine whether each of these statements is true or
false
x ∈ {{x }}
{x } ⊆ {{x }}
{x } ∈ {{x }}
A. T,T,T
B. F,F,F
C. F,F,T
D. T,F,T
Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Exercise
List the first 4 terms of the sequence whose nth term is
the largest inter k such that 2k ≤ n
A. 0,1,2,2
B. 0,1,1,2
C. 0,1,1,1
D. None of these
E. 0,1,2,3

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Exercise
The successor of the set A is the set A ∪ {A}
Find the successor of {1, 2}
A. {1, 2}
B. {1, 2, {1}, {2}}
C. None of these
D. {{1, 2}}
E. {1, 2, {1, 2}}

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Exercise
What is the cardinality of each of these sets?
a) The power set of the set {a, b, ∅}
b) The Cartersian product {1, 0} × {0, 1, 2}
A. 3,6
B. 8,6
C. 8,3
D. 3,3

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Exercise
Consider the set defined by
An = {1, 2, 3, ..., n}, , n = 1, 2, ...
What is A7 − A4?
A. {3}
B. {4, 5, 6, 7}
C. {5, 6, 7}
D. {1, 2, 3}
E. None of the others
Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Exercise
Suppose that the universal set is
U = {1, 2, 3, 4, 5, 6, 7, 8}.
Find the set specified by the bit string 01100101
A. {2, 3, 6, 8}
B. {1, 2, 5, 7}
C. {3, 4, 6, 8}
D. {1, 4, 5}

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Exercise
Find f ◦ g where f (x ) = x 2 − 5, g(x ) = x + 2, where f
and g are functions from R to R.
A. None of these.
B. (f ◦ g)(x ) = (x 2 − 5)(x + 2)
C. (f ◦ g)(x ) = x 2 − 3
D. (f ◦ g)(x ) = x 2 + 4x − 1

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Exercise
Determine whether each of these functions is a bijection
from R to R
a) f (x ) = −5x + 3
b) f (x ) = −x 2 + 7
A. None of the others
B. Bijection, not a bijection
C. Not a bijection, not a bijection
D. Not a bijection, bijection
E. Bijection, bijection
Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Exercise
Which one is true?
i) {a} ∈ {b, {a, c}}
ii) ∅ ⊆ {a, b}
A. only ii
B. only i
C. Both
D. Neither

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Exercise
Which one is true?
i) a ∈ {b, {a, c}}
ii) ∅ ∈ {a, b}
A. only i
B. only ii
C. Both
D. Neither

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Exercise
Suppose that A is the set of freshman at your school and B
is the set of students in discrete mathematics at your
school.
Express the set of freshman at your school who are not
taking discrete mathematics in terms of A and B.
Which one is true?
i) A ∩ B
ii) A ∪ B
iii) A − B
iv) B − A
Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Exercise
Which rules are functions?
2
(
i) f : R → R where f (x ) = x if x ≤ 2
x − 1 if x ≥ 4
2 if x ≥ 0
(
ii) g : R → R where g(x ) = xx +
− 1 if x ≤ 4
A. only i B. only ii C. Both D. Neither

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Exercise
Let A, B be sets. Choose correct statement(s)
i) A × B = B × A
ii) |A × B| = |B × A|
A. only i B. only ii C. Both D. Neither

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Exercise
Let X and Y be sets such that
X ∩ Y = {3}, X − Y = {1, 2}, Y − X = {4, 5, 6}
How many elements does the set X × Y have?
A.12 B.6 C.9 D.8 D. None

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Exercise
Let A = {1, 2, a}. Find the power set of A
A. {{1}, {2}, {a}, {1, 2}, {1, a}, {2, a}, {1, 2, a}}
B. {{1, 2, a}}
C. {∅, {1}, {2}, {a}, {1, 2}, {1, a}, {2, a}, {1, 2, a}}
D. {∅, {1}, {2}, {a}}

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Exercise
Which of the following rules defines a function from the set
of real numbers to the set of integers?
1
f (x ) =
⌊x ⌋
g(x ) = ⌈x + π⌉

h(x ) = x 2 + 1
A.g B.h C.f,g,h D.f E. None

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Exercise
Let N = {0, 1, 2, ..}
Let f : N → N be the function defined by
f (x ) = x 2 − 2x + 1.
Choose correct statement.
A. f is a bijection
B. f is onto but not one-to-one
C. f is one-to-one but not onto
D. None of the other choices is correct.

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Exercise
Suppose S = {1, 2, 3, 4}. Find |P(S)|.
A.4 B.8 C.16 D.32

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Exercise
Find the terms a0, a1, a2, a3 and a4 of the sequence {an },
where
an = ⌊2n/3⌋ + ⌈2n/3⌉
A. 0, 1, 2, 4, 5
B. 0, 1, 3, 4, 5
C. 0, 2, 3, 4, 5
D. 0, 1, 2, 3, 4
E. None of the other choices is correct

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Exercise
Which set has the most number of elements?
i) {x |x is an even integer and |x | < 11}
ii) {x |x is an odd integer and |x | < 11}
iii) {x |x is a prime number and x < 30}
A.i B. ii C. iii

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices
Exercise
Which of the following is a function
1
a) f : Z → R, f (x ) = x +
x

b) f : Z → R, f (x ) = x

c) f : R → Z , f (x ) = ⌊ 4 x ⌋

d) f : R → Z , f (x ) = ⌊ 3 x ⌋

Trần Hòa Phú Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums and Matrices

You might also like