Set
- อาจจะมีการไปรวมกับ 02 Method of Proofs เช่น Proof By Contradiction พวก Show that ต่าง ๆ
Two Ways of Describing Sets
Extensional Description
- เขียนแบบแจกแจงสมาชิก ซึ่งเป็นการเขียนแสดงสมาชิกของเซตให้เห็นออกมาเลยว่ามีอะไรบ้าง
Intensional Description
- เขียนแบบบอกเงื่อนไข เป็นการบรรยาลักษณะ (เงื่อนไข) ของสมาชิกแล้วให้คนอ่านแปลเอาเอง ตัวอย่างเช่น เซต A ด้านบนอาจเขียนแบบบอกเงื่อนไขได้ดังนี้ ทั้งนี้ การเขียนเซตแบบบอกเงื่อนไข สามารถเขียนได้หลายแบบขึ้นอยู่กับเงื่อนไขของผู้เขียน
Empty Set
- เซตว่าง คือ เซตที่ไม่มีสมาชิก เขียนแทนด้วยสัญลักษณ์
- เช่น เซตของเลขคู่ที่หารด้วย 2 ไม่ลงตัว
Cardinality
- For any finite set , denote by the number of (distinct) elements of .
- ทำให้เป็น Set ที่ไม่มีตัวซ้ำกันก่อนนะ! อย่าลืม พลาดตลอดดดดด
Membership
- Write , if and only iff is a member of set
Equality
- Two set and are equal (), if and only if they have exactly the same elements.
- This is, , if and only if
- Every element of is an element of
- Every element of is an element of
Set Inclusion
- A set is a subset of a set , denoted by , if and only if every element of is an element of .
Proper Subset
- ก็คือ Subset ธรรมดานี่แหละ (แต่ไม่รวมตัวมันเอง!!) – ซับเซตแท้
- A เป็น สับเซตแท้ (Proper subset) ของ B เมื่อ แต่ (ไม่ใช่เซตตัวมันเอง)
- จำนวนของ Proper Subset เท่ากับ (หักตัวมันเองทิ้งไป)
Power Set
- The “power set” of x → The set of all subsets of x
- If , then
Union, Intersection, Difference
- Let be sets.
-
- เซตที่ได้จากการนำสมาชิกจาก A และ B มารวมเข้าด้วยกัน
-
- เซตของสมาชิกที่มีซ้ำกันทั้งใน A และ B
-
- เซตของสมาชิกอยู่ใน A แต่ไม่อยู่ใน B
-
- อันนี้ก็จินตนาการเป็น Venn diagram เอาก็ได้ ไม่น่ายากอะไร!

Disjoint Sets
- and are set to be disjoint, if and only if
- Clearly, if and are disjoint, then
Universal set (U)
- A universal set () is a superset of all the sets we are dealing with. If is not explicitly given, it must be inferred from the context.
- ในการกล่าวถึงเซตใด ๆ จะมีการอ้างอิงกับเซต ๆ หนึ่ง ซึ่งตกลงกันว่าจะไม่กล่าวถึงสมาชิกตัวอื่นที่อยู่นอกเหนือจากเซตนี้ เรียกว่า เอกภพสัมพัทธ์ (Universal Set) เขียนแทนด้วยสัญลักษณ์
- ในกรณีที่ไม่กำหนดเอกภพสัมพัทธ์มาให้ จะถือว่า คือ เซตของจำนวนจริง ()
Set Complement
- หรือว่า คือ เซตของสมาชิกที่ไม่ได้อยู่ใน A (อยู่ข้างนอก A) แต่ยังอยู่ใน Universe อยู่ ดังแผนภาพ
- หรือจะคิดว่าหมายถึง ก็ได้
Laws
- สามารถใช้ Venn Diagram พิสูจน์ Law เหล่านี้ได้!
Associative Laws (The Grouping is Not Important)
Commutative Laws
- Order in or operations makes no difference.
Distributive Laws
Identity Laws
Complement Laws
Idempotent Laws
Bound Laws
- ถ้าไป กับตัวที่ใหญ่กว่า ก็จะเป็นตัวที่ใหญ่กว่า
- แต่ถ้าไป กับตัวที่เล็กกว่า (อย่างเช่น ) ก็ได้เป็นตัวที่เล็กกว่าทันที
Absorption Laws
Involution Law
De Morgan’s Law for Sets
- อันนี้ก็คล้าย ๆ กับ Break the bar change the sign ( → )
Cartesian Product
- เป็นเซตของคู่อันดับทั้งหมดที่เป็นไปได้
- จะหาว่ามีกี่คู่อันดับที่เป็นไปได้ ก็ใช้ Probability ง่าย ๆ Choices หน้า Choices หลัง
- If and , then
- Tuple is a set of 3 elements
Relation
- A (binary) relation is a set of links that connects elements of two sets.
- Each link is represented as a pair
- Therefore, relation → set of a pair (จริง ๆ ก็คล้าย ๆ Cartesian Product นะ แต่ว่าไม่ได้เอาทุก Possible combination)
- อาจารย์พูดในห้องจริง ๆ ว่าจะ relate กับ Cartesian Product ยังไง
- is the subset of
Formal Definition
A (binary) relation () from a set to a set is a subset of the Cartesian product
- ถ้าเต็ม ๆ (Cartesian product) ก็ถือว่าเป็น Relation เหมือนกัน
Notation
If , we write
- The domain of is the set
- for some
- The range of is the set
- for some
A relation from to is simply called a relation on
- เวลาโจทย์ถามว่า How many relations from to are there? — คือมันถามประมาณว่า จะมีทั้งหมดกี่ Relation ซึ่ง Relation มันก็เป็น Subset ของ Cartesian product อีกที ดังนั้นก็ตอบจำนวน Subset ไปเลย
Digraph
- Let be the relation on defined by if . Then

- An informative way to picture a relation on a set is to draw its digraph.
- We’ll discussed in more detail in 07 Graphs
- For now, we mention digraphs only in connection with relations.)
- To draw the digraph of a relation on a set , we first draw dots or vertices to represent the elements of .
- Next, if the element is in the relation, we draw an arrow (called a directed edge) from to .
Basic Types of Relations
Reflexive
- is called reflexive, iff for each
- if , then
There’s must be a self-loop at every single element.
Symmetric
- is called symmetric, iff for all
- if , then
Whenever you see a link, you must see reverse of that link!
(Even empty maps is considered symmetric)
Antisymmetric
- is called antisymmetric, iff for all
- if , and , then
- ที่ต้องมี เพราะว่าจะได้ satisfy self-loop is okay
No loop containing two different elements (ทั้งไปและกลับ) → Self-loop is okay
(Even empty maps is considered antisymmetric)
Warning
Antisymmetric Not symmetric
ลองดู Empty maps เป็นตัวอย่าง
Transitive
- is called transitive, iff for all
- if , and , then
- มันเป็น If-then (Conditional statement) ถ้าไม่มี Link หรือว่าเป็น Empty (maps) relation ไม่ต้อง Check conclusion part แล้ว มันเป็น True เสมอ ถ้างงว่าทำไม Empty maps เป็น Transitive
If there’s a link (from a to b, b to c), there must be a link (from a to c)
(Even empty maps is considered transitive)
- ในข้อสอบอาจจะมีให้ Proof (เวลา True), Disprove (เวลา False)
Partial Order
RAT
- A relation on a set is called a partial order*
- If and only if is reflexive, antisymmetric, and transitive
- No cycle other than self-loop!
- Since a partial order is reflexive, there will be self loop at every element.
- If and either or , we say that and are comparable.
- สามารถตอบได้ว่า Element ไหนใหญ่กว่า ถ้ามีลูกศรโยงไป
- ท้าย ๆ จะใหญ่กว่า ด้านหน้า
- สามารถตอบได้ว่า Element ไหนใหญ่กว่า ถ้ามีลูกศรโยงไป
- If every pair of elements in is comparable, we call a total order.

Inverse
- Let be a relation from to . The inverse of R, denoted is the relation from to defined by
- (If divides )
- (Is divisible by)
Composition
- If we have a relation from to and a relation from to , we can form the composition of the relations by applying first relation and then relation .
- Composition of relations generalizes composition of functions. The formal definition follows.
- Let be a relation from to and be a relation from to . The composition of and , denoted , is the relation from to defined by
- อันนี้ก็คล้าย ๆ Composition ที่เคยเรียนใน Function นั่นแหละ แต่อันนี้มันอยู่ใน Terms ของ Sets เลยงงหน่อย
- โอเค เข้าใจแล้ว — ก็ถ้าสมมติเราทำ ให้มอง ก่อน เช่น
- ลองมอง ก่อน แล้ว Output คือ 2 มาดู Input ของ เจอ ดังนั้นได้ ทำไปเรื่อย ๆ
- โอเค เข้าใจแล้ว — ก็ถ้าสมมติเราทำ ให้มอง ก่อน เช่น
Pairwise Disjoint Collection of Sets
- Let be a collection of sets.
- is said to be pairwise disjoint, if and only for distinct sets in , and are disjoint.
Partition
- A partition of a set is a collection of subsets of such that
- is pairwise disjoint, and
Equivalence Relation
RST
- An equivalence relation on a set is a relation that is (เหมือนการเท่ากับ เช่น )
- Reflexive
- Symmetric
- Transitive
Equivalence Class
