You are on page 1of 20

Discrete

Mathematics
(MAD101)
Lecture notes by PhuongVTM
(phuongvtm11@fe.edu.vn/
minhphuong1105.sphn@gmail.com
)
Chapter 2:
Basic Structures

• Sets
• Set operations
• Functions
• Sequences and Sums
1.1 Sets
❖ Definition: A set S is an unordered collection of objects.
❖ Notation:
- a ∈ S if a is an element/ a member of S
- a ∉ S if a is not an element/ a member of S.
❖ Example
- In this Venn diagram: A, B, D ∈ S and C ∉ S
we then write: S= {A, B, D}
1.1 Sets
❖ Represent a set:
1. “Roster method:” List all elements:
Example: A= {0,2,4,6,8,10}
ℕ= {0,1,2,3…} - the set of natural integers
ℕ* = {1,2,3,...} - the set of positive (natural) integers
ℤ= {...,-2,-1,0,1,2…}- the set of integers
2. “Set builder “ Characterize elements by properties/ conditions:
a) A = the set of all natural integers that is divisible by 3
B = {n∈ ℕ ⎟ n is divisible by 3} (given by conditions- cho điều kiện/phương trình)
C = {3k, k=0,1,2,....} ( given by formulas- cho công thức cụ thể)
b) [0, 1) = {x ∈ℝ⎟ 0 ≤ x <1 }
1.1 Sets
❖ Represent a set:

3. The truth set of a propositional function


One way to characterize elements of sets
Let P(x) be a propositional function with domain x∈ D
Definition: The truth set of P(x) is the subset of D where P(x) is true

{x∈ D | P(x)}
Example: a) Let P(x,y): “x+y =1” (x,y ∈ ℝ)
The truth set of P(x,y) is the set { (x,y) ∈ ℝ^2 | x+y=1}
(the points lying on the line of equation x+y=1)
b) P(n): “n is divisible by 3”. The truth set of P(n) is
{n ∈ ℕ | n is divisible by 3}= {0,3,6,9…}
1.1 Sets
❖ Some notions: Let A, B be sets.
- A ⊆ B: A is a subset (tập con) of B if each element of A is also an element of B:
∀x(x ∈ A → x ∈ B)
Example: A= {apple, orange, mango} ; B= {apple, mango}, then B⊆ A
- A= B: A is equal to B: ∀x(x ∈ A ↔ x ∈ B)
Example: - A= {1,1,2,2,3,3} ; B= {1,2,3 }, then A=B (repetition does not counted !)
so (A= B) ⇔ (A ⊆ B) ∧ (B ⊆ A)
- A ≠ B: A is not equal to B if there is an element of one set that is not an element of the other !
Example: A= {1,2,3,4} ; B= {1,3,5,0}: A ≠ B, since 2 ∈ A, but 2 ∉ B
- A⊊ B: A is a proper subset of B (tập con thực sự) if A is a subset of B and A is not equal to B:
A⊊ B ⇔ (A ⊆ B) ∧ (A ≠ B)
- ∅: the empty set, having no element.
- Fact: For any set A: ∅ ⊆ A and A⊆ A
1.1 Sets
❖ Some notions:
Example 1: True or False ?
a) ∅ ∈ {x} False, ( chữa lại cho đúng: ∅ ⊆ {x})
b) x ∈ {x} True
c) {x} ∈ {x} False (chữa lại: {x}⊆ {x})
d) {x} ⊆ {{x}} False (chữa lại: {x} ∈ {{x}}
Example 2: Determine whether X ⊆ Y, Y ⊆ X or X= Y (or neither) ?
e) X= {a, b, a, b} ; Y= {a,b} X=Y
f) X={a, {a,b}} ; Y= {a, b, {a, b}} X ⊆ Y: since a, {a,b} are elements of both X and Y
g) X={a, {b}} ; Y= {a, b} X ⊈ Y (sin {b}∈ X but {b}∉ Y) and Y⊈ X (b∈ Y but
b∉ X)
1.1 Sets
❖ Some notions:
❖ Power set
Let S be a set. The power set (tập luỹ thừa) of S is the set
𝒫(S)= the set of all subsets of S.
so, if A be a set, then A ∈ 𝒫(S) ⇔ A ⊆ S
Example: a) S= ∅, 𝒫(∅)= {∅} (the set that contains the empty set as unique element
b) S= {1,2,3}, 𝒫(S)= {∅, {1}, {2},{3}, {1,2}, {2,3}, {1,3}, {1,2,3}}
Fact For any set S, 𝒫(S) is non empty, since ∅, S ∈ 𝒫(S) !
1.1 Sets
❖ Cartesian product:
Let A, B be sets. The cartesian product (tích Đề-các) of A and B is the set of all ordered
pairs (a,b), with a ∈A and b∈B.
A x B = { (a,b), a ∈A, b∈B }
Example: - ℝ x ℝ = ℝ² is the plan Oxy
- ℤ x ℤ= the set of all points of integer coordinates in the plan Oxy
- A= {a,b,c} , B= {1,2}
A x B= { (a,1), (a,2), (b, 1), (b, 2), (c,1), (c,2) }
B x A= {(1,a), (1,b), (1,c), (2,a), (2,b), (2,c)}
So A x B ≠ B x A
1.1 Sets
❖ The size of the set- Cardinality
- When a set S has exactly n distinct elements, then S is called a finite set (tập hữu hạn),
and the number n is called the cardinality (lực lượng/ số phần tử) of S, denoted by ∣S∣
- A set is not finite, it is called infinite (vô hạn phần tử)
Examples:
a) A= {1,2,2,0,1,3,4}---> A is finite and ∣A∣= 5
b) B= {2n, n∈ ℕ} is an infinite set
c) C= {{2k+1, k ∈ ℕ}, {2k, k ∈ ℕ}} is finite with 2 elements: 1st element is the set of all
odd integer and the 2nd element is the set of all even integers !
d) The empty set is finite and ∣∅∣ =0
1.1 Sets
❖ The size of the set- Cardinality
Theorem:
a) If S is a finite set that has exactly n elements, then the power set 𝒫(S) of S is also finite
and ∣𝒫(S)∣= 2ⁿ.
b) If A, B are finite sets. Then the cartesian product A x B is also finite with
∣A x B∣ = ∣A ∣. ∣B∣
Example:

c) S= {1, 2} then 𝒫(S)= {∅, {1}, {2}, {1,2}} has exactly 4 elements
d) A= {0,1,2,3} then A x A= {(i,j), i, j= 0,1,2,3} has exactly 4.4= 16 elements.
1.1 Sets
❖ Set operations
Convention: From now on, we suppose that
- U is the universal set (tập phổ dụng)
- every set A is a subset of U (mọi tập A đều là tập con của U)
1. Complement (phần bù)
Definition: Let A be a set. The complement of A (in U) is the set that contains all elements that are
not in A :
1.1 Sets
❖ Set operations
2. Intersection (Giao)
Definition: A, B be sets. The intersection of A and B is the set that contains all common
elements of A and of B

Example: A= {n∈ ℕ | n is divisible by 3}


B= {n∈ ℕ | n is divisible by 2}
→ A ∩ B = {n∈ ℕ | n is divisible by 6}
1.1 Sets
❖ Set operations
3. Union (Hợp)
Definition: A, B be sets. The union of A and B is the set that contains elements that are
either in A or in B.

Example: The set of integers ℤ is the union


of the set {n∈ ℤ | n is even} of even integers
and the set {n∈ ℤ | n is odd}of odd integers.
1.1 Sets
❖ Set operations
4. Difference (Hiệu)
Definition: A, B be sets. The difference of A and B is the set that contains elements that are
in A and not in B.

Remark: If A, B are subsets of U, then we see that


(from the definition)
1.1 Sets
❖ Set operations
4. Symetric difference (Hiệu đối xứng)
Definition: A, B be sets. The symetric difference of A and B is the set that contains
elements that are either in A and not in B, or in B and not in A), so
A ⊕ B= (A- B) ∪ (B-A)
1.1 Sets
❖ Set operations
Remark: Set operations are related to logic operations: Think a set A as the truth set of the
propositional function “ x ∈ A”. Then
- A ⊕ B is the truth set of “x ∈ A” ⊕ “x ∈ B”
- A∩B is the truth set of “x ∈ A” ∧ “x ∈ B”
- A ∪ B is the truth set of “x ∈ A” ∨ “x ∈ B”
- is the truth set of “ x ∉ A” (negation of “x ∈ A”)
- ∅ is the truth set of the contradiction (F) “x ∈ ∅”
- U (universal set) is the truth set of the tautology (T) “x ∈ A”
1.1 Sets
❖ Set identities (U: universal set)
Set identities (A, B, C: sets) Name Logic identities
(P, Q, R: propositions)
Complement law ¬¬ P ≡ P

A ∩ U =A Identity laws P∧T≡P


A∪∅=A P∨F≡P
A∩∅=∅ Domination laws ?
A ∪ U =U
A∩ (B ∪ C) = (A ∩ B) ∪ (A∩ C) Distribution laws ?
A∪ (B∩ C) = (A ∪ B) ∩ (A∪ C)
?
De Morgan laws
1.1 Sets
❖ Set identities (U: universal set)
QUIZ
Q.1 True or False? (A, B be sets)

A. A - B = B - A
B. A ∩ (B - A) = ∅
C. (A- B) ∩ B = A

Q2. What is the complement of A- B (in U) ?

D. B
E. B- A
F. X
1.1 Sets
❖ Computer representation of sets
- U={x₁, x₂,..., xₙ} be a set of cardinality n (xₖ ≠ xₗ )
- A ⊆ U be a subset of U
- A is represented by a bit strings of length n : b₁b₂…bₙ ,where:
bₖ =0 if xₖ ∉ A
bₖ =1 if xₖ ∈ A
Example: Let U= {1,2,3,4,5,6,7} and A= {1,3,7}. Then
- the bit string that represents A is 1010001
- the bit string 0110011 represents the set B= {2,3,6,7}
- set operations is computed through bit string operations:
1010001 A A⊕ B= ?
0110011 B A - B = ? (hint:
1110011 A∪B so, compute the complement of B,
0010001 A∩B then its intersection with A)
0101110

You might also like