0% found this document useful (0 votes)
90 views27 pages

Discrete Structures For Computing: Huynh Tuong Nguyen, Tran Tuan Anh, Nguyen Ngoc Le

The document discusses sets and some basic set concepts. It defines what a set is, using students in a class and subjects as examples. It introduces set notations, equal sets, Venn diagrams, special sets like the empty set and singleton sets, subsets, cardinality which represents the number of elements in a set, and power sets which are the set of all subsets of a given set.

Uploaded by

Lê Văn Hoàng
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
90 views27 pages

Discrete Structures For Computing: Huynh Tuong Nguyen, Tran Tuan Anh, Nguyen Ngoc Le

The document discusses sets and some basic set concepts. It defines what a set is, using students in a class and subjects as examples. It introduces set notations, equal sets, Venn diagrams, special sets like the empty set and singleton sets, subsets, cardinality which represents the number of elements in a set, and power sets which are the set of all subsets of a given set.

Uploaded by

Lê Văn Hoàng
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

Sets

Huynh Tuong Nguyen,


Tran Tuan Anh, Nguyen

Chapter 4
Ngoc Le

Sets
Discrete Structures for Computing
Contents

Sets

Set Operation

Huynh Tuong Nguyen, Tran Tuan Anh, Nguyen Ngoc Le


Faculty of Computer Science and Engineering
University of Technology - VNUHCM
{htnguyen;trtanh}@hcmut.edu.vn
4.1
Sets
Contents
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le

Contents
1 Sets Sets

Set Operation

2 Set Operation

4.2
Sets
Course outcomes
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le

Course learning outcomes

L.O.1 Understanding of logic and discrete structures


L.O.1.1 – Describe definition of propositional and predicate logic
L.O.1.2 – Define basic discrete structures: set, mapping, graphs
Contents
L.O.2 Represent and model practical problems with discrete structures Sets
L.O.2.1 – Logically describe some problems arising in Computing Set Operation
L.O.2.2 – Use proving methods: direct, contrapositive, induction
L.O.2.3 – Explain problem modeling using discrete structures

L.O.3 Understanding of basic probability and random variables


L.O.3.1 – Define basic probability theory
L.O.3.2 – Explain discrete random variables

L.O.4 Compute quantities of discrete structures and probabilities


L.O.4.1 – Operate (compute/ optimize) on discrete structures
L.O.4.2 – Compute probabilities of various events, conditional
ones, Bayes theorem

4.3
Sets
Set Definition
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le
• Set is a fundamental discrete structure on which all discrete
structures are built
• Sets are used to group objects, which often have the same
properties
Contents
Example
Sets

• Set of all the students who are currently taking Discrete Set Operation

Mathematics 1 course.
• Set of all the subjects that K2011 students have to take in
the first semester.
• Set of natural numbers N

Definition
A set is an unordered collection of objects.
The objects in a set are called the elements (phần tử ) of the set.
A set is said to contain (chứa) its elements.

4.4
Sets
Notations
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le

Definition
• a ∈ A: a is an element of the set A
• a∈/ A: a is not an element of the set A Contents

Sets

Set Operation
Definition (Set Description)

• The set V of all vowels in English alphabet, V = {a, e, i, o, u}


• Set of all real numbers greater than 1???
{x | x ∈ R, x > 1}
{x | x > 1}
{x : x > 1}

4.5
Sets
Equal Sets
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le

Definition
Two sets are equal iff they have the same elements. Contents

Sets

• (A = B) ↔ ∀x(x ∈ A ↔ x ∈ B) Set Operation

Example

• {1, 3, 5} = {3, 5, 1}
• {1, 3, 5} = {1, 3, 3, 3, 5, 5, 5, 5}

4.6
Sets
Venn Diagram
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le

• John Venn in 1881


• Universal set (tập vũ trụ) is Contents

Sets
represented by a rectangle
Set Operation
• Circles and other
geometrical figures are used
to represent sets
• Points are used to represent
particular elements in set

4.7
Sets
Special Sets
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le

Contents
• Empty set (tập rỗng ) has no elements, denoted by ∅, or {}
Sets
• A set with one element is called a singleton set Set Operation

• What is {∅}?
• Answer: singleton

4.8
Sets
Subset
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le

Definition
The set A is called a subset (tập con) of B iff every element of A
is also an element of B, denoted by A ⊆ B.
Contents

If A 6= B, we write A ⊂ B and say A is a proper subset (tập con Sets

thực sự) of B. Set Operation

• ∀x(x ∈ A → x ∈ B)
• For every set S,
(i) ∅ ⊆ S, (ii) S ⊆ S.

4.9
Sets
Cardinality
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le
Definition
If S has exactly n distinct elements where n is non-negative
integers, S is finite set (tập hữu hạn), and n is cardinality (bản
số ) of S, denoted by |S|.
Contents
Example Sets

• A is the set of odd positive integers less than 10. |A| = 5. Set Operation

• S is the letters in Vietnamese alphabet, |S| = 29.


• Null set |∅| = 0.

Definition
A set that is infinite if it is not finite.

Example

• Set of positive integers is infinite

4.10
Sets
Power Set
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le

Definition
Given a set S, the power set (tập lũy thừa) of S is the set of all
subsets of the set S, denoted by P (S).
Contents

Sets
Example
Set Operation

What is the power set of {0, 1, 2}?


P ({0, 1, 2}) = {∅, {0}, {1}, {2}, {0, 1}, {0, 2}, {1, 2}, {0, 1, 2}}

Example

• What is the power set of the empty set?


• What is the power set of the set {∅}

4.11
Sets
Power Set
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le

Contents
Theorem Sets

If a set has n elements, then its power set has 2n elements. Set Operation

Prove using induction!

4.12
Sets
Ordered n-tuples
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le

Definition
The ordered n-tuple (dãy sắp thứ tự) (a1 , a2 , . . . , an ) is the
ordered collection that has a1 as its first element, a2 as its second
Contents
element, . . ., and an as its nth element. Sets

Set Operation
Definition
Two ordered n-tuples (a1 , a2 , . . . , an ) = (b1 , b2 , . . . , bn ) iff ai = bi ,
for i = 1, 2, . . . , n.

Example
2-tuples, or ordered pairs (cặp), (a, b) and (c, d) are equal iff
a = c and b = d

4.13
Sets
Cartesian Product
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le

• René Descartes (1596–1650)

Definition
Let A and B be sets. The Cartesian product (tích Đề-các) of A
and B, denoted by A × B, is the set of ordered pairs (a, b), where Contents

a ∈ A and b ∈ B. Hence, Sets

Set Operation

A × B = {(a, b) | a ∈ A ∧ b ∈ B}

Example
Cartesian product of A = {1, 2} and B = {a, b, c}. Then

A × B = {(1, a), (1, b), (1, c), (2, a), (2, b), (2, c)}

Show that A × B 6= B × A

4.14
Sets
Cartesian Product
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le

Definition

A1 ×A2 ×· · ·×An = {(a1 , a2 , . . . , an ) | ai ∈ Ai for i = 1, 2, . . . , n} Contents

Sets

Set Operation

Example
A = {0, 1}, B = {1, 2}, C = {0, 1, 2}. What is A × B × C?

A×B×C = {(0, 1, 0), (0, 1, 1), (0, 1, 2), (0, 2, 0), (0, 2, 1),
(0, 2, 2), (1, 1, 0), (1, 1, 1), (1, 1, 2), (1, 2, 0),
(1, 2, 1), (1, 2, 2)}

4.15
Sets
Union
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le

Definition
The union (hợp) of A and B

A ∪ B = {x | x ∈ A ∨ x ∈ B}
Contents

Sets

A∪B Set Operation

A B

• Example:
• {1,2,3} ∪ {2,4} = {1,2,3,4}
• {1,2,3} ∪ ∅ = {1,2,3}

4.16
Sets
Intersection
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le

Definition
The intersection (giao) of A and B

A ∩ B = {x | x ∈ A ∧ x ∈ B}
Contents

Sets

A∩B Set Operation

A B

Example:
• {1,2,3} ∩ {2,4} = {2}
• {1,2,3} ∩ N = {1,2,3}

4.17
Sets
Union/Intersection
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le

Contents
n
Sets
[
Ai = A1 ∪ A2 ∪ ... ∪ An = {x | x ∈ A1 ∨ x ∈ A2 ∨ ... ∨ x ∈ An } Set Operation
i=1

n
\
Ai = A1 ∩ A2 ∩ ... ∩ An = {x | x ∈ A1 ∧ x ∈ A2 ∧ ... ∧ x ∈ An }
i=1

4.18
Sets
Difference
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le

Definition
The difference (hiệu) of A and B

A − B = {x | x ∈ A ∧ x ∈
/ B}
Contents

Sets

A−B Set Operation

A B

Example:
• {1,2,3} - {2,4} = {1,3}
• {1,2,3} - N = ∅

4.19
Sets
Complement
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le

Definition
The complement (phần bù) of A

A = {x | x ∈A}
/
Contents

Sets

Set Operation
Example:
• A = {1,2,3} then A = ???
• Note that A - B = A ∩ B

4.20
Sets
Set Identities
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le

A∪∅ = A Identity laws


A∩U = A Luật đồng nhất Contents

A∪U = U Domination laws Sets

A∩∅ = ∅ Luật nuốt Set Operation

A∪A = A Idempotent laws


A∩A = A Luật lũy đẳng
(Ā) = A Complementation law
Luật bù

4.21
Sets
Set Identities
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le

A∪B = B∪A Commutative laws


A∩B = B∩A Luật giao hoán Contents

A ∪ (B ∪ C) = (A ∪ B) ∪ C Associative laws Sets

A ∩ (B ∩ C) = (A ∩ B) ∩ C Luật kết hợp Set Operation

A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C) Distributive laws
A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C) Luật phân phối
A∪B = A∩B De Morgan’s laws
A∩B = A∪B Luật De Morgan

4.22
Sets
Method of Proofs of Set Equations
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le

To prove A = B, we could use Contents

• Venn diagrams Sets

Set Operation
• Prove that A ⊆ B and B ⊆ A
• Use membership table
• Use set builder notation and logical equivalences

4.23
Sets
Example (1)
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le

Contents

Sets

Set Operation

Example
Verify the distributive rule P ∪ (Q ∩ R) = (P ∪ Q) ∩ (P ∪ R)

4.24
Sets
Example (2)
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le

Example
Prove: A ∩ B = A ∪ B
Contents
(1) Show that A ∩ B ⊆ A ∪ B Sets

Suppose that x ∈ A ∩ B Set Operation

By the definition of complement, x ∈


/ A∩B
So, x ∈
/ A or x ∈/B
Hence, x ∈ Ā or x ∈ B̄
We conclude, x ∈ A ∪ B
Or, A ∩ B ⊆ A ∪ B
(2) Show that A ∪ B ⊆ A ∩ B

4.25
Sets
Example (3)
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le

Prove: A ∩ B = A ∪ B
Contents

A B A∩B A∩B Ā ∪ B̄ Sets

Set Operation
1 1 1 0 0
1 0 0 1 1
0 1 0 1 1
0 0 0 1 1

4.26
Sets
Example (4)
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le

Prove: A ∩ B = A ∪ B
A∩B = {x|x 6∈ A ∩ B} Contents

= {x|¬(x ∈ A ∩ B)} Sets

= {x|¬(x ∈ A ∧ x ∈ B)} Set Operation

= {x|¬(x ∈ A) ∨ ¬(x ∈ B)}


= {x|x 6∈ A ∨ x 6∈ B}
= {x|x ∈ A ∨ x ∈ B}
= {x|x ∈ A ∪ B}

4.27

You might also like