Discrete Mathematics Chapter 7 Relations 感謝 大葉大學 資訊工程系 黃鈴玲老師 提供.

Slides:



Advertisements
Similar presentations
Chapter 3 Determinants and Eigenvectors 大葉大學 資訊工程系 黃鈴玲 Linear Algebra.
Advertisements

Chap6 Relations Def 1: Let A and B be sets. A binary relation from A
Relations.
Graph Theory Chapter 9 Planar Graphs 大葉大學 資訊工程系 黃鈴玲.
Chapter 10 馬可夫鏈 緒言 如果讀者仔細觀察日常生活中所發生的 諸多事件,必然會發現有些事件的未來 發展或演變與該事件現階段的狀況全然 無關,這種事件稱為獨立試行過程 (process of independent trials) ;而另一些 事件則會受到該事件現階段的狀況影響。
1 Finding a shortest vector in a two-dimensional lattice modulo m Theoretical Computer Science, Vol 172, 1997 Gunter Rote 田錦燕95/06/01.
特徵值與多變量 1 Definition 1 If A is an n  n matrix, a real number λ is called an eigenvalue of A if If A is an n  n matrix, a real number λ is called an eigenvalue.
布林代數的應用--- 全及項(最小項)和全或項(最大項)展開式
1 集合論 Chapter 3. 2 Chapter 3 Set Theory 3.1 Sets and Subsets A well-defined collection of objects (the set of outstanding people, outstanding is very.
指導教授:陳淑媛 學生:李宗叡 李卿輔.  利用下列三種方法 (Edge Detection 、 Local Binary Pattern 、 Structured Local Edge Pattern) 來判斷是否為場景變換,以方便使用者來 找出所要的片段。
Relations — on a nonempty set. Relations Definition: A relation on a nonempty set A is a nonempty set R of ordered pairs (x, y), where x, y  A. If (a,
1.1 線性方程式系統簡介 1.2 高斯消去法與高斯-喬登消去法 1.3 線性方程式系統的應用(-Skip-)
Graph V(G 1 )={0, 1, 2, 3, 4, 5, 6, 7, 8, 9} E(G 1 )={(0, 2), (0, 3), (1, 4), (2, 3), (2, 5), (2, 6), (3, 6), (3, 7), (4, 7), (5, 6), (5,
5.1 Rn上之長度與點積 5.2 內積空間 5.3 單範正交基底:Gram-Schmidt過程 5.4 數學模型與最小平方分析
8.1 何謂高度平衡二元搜尋樹 8.2 高度平衡二元搜尋樹的加入 8.3 高度平衡二元搜尋樹的刪除
McGraw-Hill/Irwin © 2003 The McGraw-Hill Companies, Inc.,All Rights Reserved. 肆 資料分析與表達.
1 第四章 多變數函數的微分學 § 4.1 偏導數定義 定義 極限值 ■. 2 定理 極限值的基本定理 (1) 極限值的唯一性 : 若 存在,則 其值必為唯一。 (2) 若 且 ( 與 為常數 ) , 則 且 為常數且.
Network Connections ★★★☆☆ 題組: Contest Archive with Online Judge 題號: Network Connections 解題者:蔡宗翰 解題日期: 2008 年 10 月 20 日 題意:給你電腦之間互相連線的狀況後,題.
: The largest Clique ★★★★☆ 題組: Contest Archive with Online Judge 題號: 11324: The largest Clique 解題者:李重儀 解題日期: 2008 年 11 月 24 日 題意: 簡單來說,給你一個 directed.
第二章 供給與需求 中興大學會計學系 授課老師:簡立賢.
3.1 矩陣的行列式 3.2 使用基本運算求行列式 3.3 行列式的性質 3.4 特徵值介紹 3.5 行列式的應用
: Multisets and Sequences ★★★★☆ 題組: Problem Set Archive with Online Judge 題號: 11023: Multisets and Sequences 解題者:葉貫中 解題日期: 2007 年 4 月 24 日 題意:在這個題目中,我們要定義.
第 6 章 完全競爭市場 本章內容要點 四種市場結構 短期供給曲線 長期供給曲線 生產者剩餘 完全競爭的效率.
Section 4.2 Probability Models 機率模式. 由實驗看機率 實驗前先列出所有可能的實驗結果。 – 擲銅板:正面或反面。 – 擲骰子: 1~6 點。 – 擲骰子兩顆: (1,1),(1,2),(1,3),… 等 36 種。 決定每一個可能的實驗結果發生機率。 – 實驗後所有的實驗結果整理得到。
-Antidifferentiation- Chapter 6 朝陽科技大學 資訊管理系 李麗華 教授.
Structural Equation Modeling Chapter 6 CFA 根據每個因素有多重指標,以減少 測量誤差並可建立問卷的構念效度 驗證性因素分析.
Chapter 10 m-way 搜尋樹與B-Tree
第五章 內積空間 5.1 Rn上之長度與點積 5.2 內積空間 5.3 單範正交基底:Gram-Schmidt過程
2005/7 Linear system-1 The Linear Equation System and Eliminations.
連續隨機變數 連續變數:時間、分數、重量、……
: Finding Paths in Grid ★★★★☆ 題組: Contest Archive with Online Judge 題號: 11486: Finding Paths in Grid 解題者:李重儀 解題日期: 2008 年 10 月 14 日 題意:給一個 7 個 column.
1 Section 7.1 Relations and their properties. 2 Binary relation A binary relation is a set of ordered pairs that expresses a relationship between elements.
Relations Chapter 9.
Discrete Mathematics Chapter 4 Induction and Recursion 大葉大學 資訊工程系 黃鈴玲 (Lingling Huang)
Discrete Mathematics Chapter 1 The Foundations : Logic and Proofs 大葉大學 資訊工程系 黃鈴玲 (Lingling Huang)
Discrete Mathematics Chapter 4 Counting 感謝 大葉大學 資訊工程系 黃鈴玲老師 提供.
Discrete Mathematics Chapter 3 Mathematical Reasoning, Induction, and Recursion 感謝 大葉大學 資訊工程系 黃鈴玲老師 提供.
Chapter 9. Chapter Summary Relations and Their Properties Representing Relations Equivalence Relations Partial Orderings.
Chapter 9. Chapter Summary Relations and Their Properties n-ary Relations and Their Applications (not currently included in overheads) Representing Relations.
Graph Theory Chapter 7 Eulerian Graphs 大葉大學 (Da-Yeh Univ.) 資訊工程系 (Dept. CSIE) 黃鈴玲 (Lingling Huang)
Discrete Mathematics Chapter 7 Advanced Counting Techniques 大葉大學 資訊工程系 黃鈴玲.
Graph Theory Chapter 6 Matchings and Factorizations 大葉大學 (Da-Yeh Univ.) 資訊工程系 (Dept. CSIE) 黃鈴玲 (Lingling Huang)
Chapter 9. Section 9.1 Binary Relations Definition: A binary relation R from a set A to a set B is a subset R ⊆ A × B. Example: Let A = { 0, 1,2 } and.
Discrete Mathematics Chapter 2 Basic Structures : Sets, Functions, Sequences, and Sums 大葉大學 資訊工程系 黃鈴玲 (Lingling Huang)
Chapter 3 Trees and Forests 大葉大學 資訊工程系 黃鈴玲
§ 每周五交作业,作业成绩占总成绩的 10% ; § 平时不定期的进行小测验,占总成绩的 20% ; § 期中考试成绩占总成绩的 20% ;期终考 试成绩占总成绩的 50% § 每周五下午 1 ; 00—3 : 00 ,答疑 § 地点:软件楼 301.
Combinatorial Mathematics Chapter 8 Relations. Outline 8.1 Relations and their properties 8.3 Representing Relations 8.4 Closures of Relations 8.5 Equivalence.
Discrete Mathematics Section 3.7 Applications of Number Theory 大葉大學 資訊工程系 黃鈴玲.
Discrete Mathematics Chapter 5 Counting 大葉大學 資訊工程系 黃鈴玲.
1 Discrete and Combinatorial Mathematics R. P. Grimaldi, 5 th edition, 2004 Chapter 5 Relations and Functions.
Chapter 9. Chapter Summary Relations and Their Properties n-ary Relations and Their Applications (not currently included in overheads) Representing Relations.
Representing Relations Using Matrices A relation between finite sets can be represented using a zero-one matrix Suppose R is a relation from A = {a 1,
Discrete Mathematics Chapter 6 Advanced Counting Techniques.
Discrete Mathematics Chapter-8 Graphs 感謝 大葉大學 資訊工程系 黃鈴玲老師 提供.
Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A.
Graph Theory Chapter 8 Hamiltonian Graphs 大葉大學 (Da-Yeh Univ.) 資訊工程系 (Dept. CSIE) 黃鈴玲 (Lingling Huang)
大葉大學 資訊工程系 黃鈴玲  G. Agnarsson and R. Greenlaw, Graph Theory: Modeling, Applications, and Algorithms, Pearson,  G. Chartrand and O. R. Oellermann,
Section 9.3. Section Summary Representing Relations using Matrices Representing Relations using Digraphs.
Chapter8 Relations 8.1: Relations and their properties.
Relations Chapter 9 Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill.
Discrete Mathematical
Relations and Their Properties
Relations.
CSE15 Discrete Mathematics 05/03/17
Equivalence Relations
Relations Chapter 9.
Chapter 10 Independence, Dominance, and Matchings
Discrete Mathematics Chapter 7 Relations.
Relations and Digraphs
Chapter 8 (Part 2): Relations
Presentation transcript:

Discrete Mathematics Chapter 7 Relations 感謝 大葉大學 資訊工程系 黃鈴玲老師 提供

7.1 Relations and their properties. ※ The most direct way to express a relationship between elements of two sets is to use ordered pairs. For this reason, sets of ordered pairs are called binary relations. Example 1. A : the set of students in your school. B : the set of courses. R = { (a, b) : a  A, b  B, a is enrolled in course b } 7.1.1

Def 1. Let A and B be sets. A binary relation from A to B is a subset R of A  B. ( Note A  B = { (a,b) : a  A and b  B } ) Def 1’. We use the notation aRb to denote that (a, b)  R, and aRb to denote that (a,b)  R. Moreover, a is said to be related to b by R if aRb

Example 3. Let A={0, 1, 2} and B={a, b}, then {(0,a),(0,b),(1,a),(2,b)} is a relation R from A to B. This means, for instance, that 0Ra, but that 1Rb a b A B R R  A  B = { (0,a), (0,b), (1,a) (1,b), (2,a), (2,b)} RR RR 7.1.3

Example ( 上例 ) : A : 男生, B : 女生, R : 夫妻關系 A : 城市, B : 州, 省 R : 屬於 (Example 2) Note. Relations vs. Functions A relation can be used to express a 1-to-many relationship between the elements of the sets A and B. ( function 不可一對多,只可多對一 ) Def 2. A relation on the set A is a subset of A  A ( i.e., a relation from A to A )

Example 4. Let A be the set {1, 2, 3, 4}. Which ordered pairs are in the relation R = { (a, b)| a divides b }? Sol : R = { (1,1), (1,2), (1,3), (1,4), (2,2), (2,4), (3,3), (4,4) } 7.1.5

Example 5. Consider the following relations on Z. R 1 = { (a, b) | a  b } R 2 = { (a, b) | a > b } R 3 = { (a, b) | a = b or a =  b } R 4 = { (a, b) | a = b } R 5 = { (a, b) | a = b+1 } R 6 = { (a, b) | a + b  3 } Which of these relations contain each of the pairs (1,1), (1,2), (2,1), (1,  1), and (2,2)? Sol : (1,1)(1,2)(2,1) (1,  1) (2,2) R1R1 R2R2 R3R3 R4R4 R5R5 R6R6 ●●● ●● ●●● ● ● ● ● ● ●● 7.1.6

Def 3. A relation R on a set A is called reflexive if (a,a)  R for every a  A. Example 7. Consider the following relations on {1, 2, 3, 4} : R 2 = { (1,1), (1,2), (2,1) } R 3 = { (1,1), (1,2), (1,4), (2,1), (2,2), (3,3), (4,1), (4,4) } R 4 = { (2,1), (3,1), (3,2), (4,1), (4,2), (4,3) } which of them are reflexive ? 反身性 Sol : R

Example 8. Which of the relations from Example 5 are reflexive ? Sol : R 1, R 3 and R R 1 = { (a, b) | a  b } R 2 = { (a, b) | a > b } R 3 = { (a, b) | a = b or a =  b } R 4 = { (a, b) | a = b } R 5 = { (a, b) | a = b+1 } R 6 = { (a, b) | a + b  3 }

Def 4. (1) A relation R on a set A is called symmetric if for a, b  A, (a, b)  R  (b, a)  R. (2) A relation R on a set A is called antisymmetric ( 反對稱 ) if for a, b  A, (a, b)  R and (b, a)  R  a = b. 即若 a≠b 且 (a,b)  R  (b, a)  R 7.1.9

Example 10. Which of the relations from Example 7 are symmetric or antisymmetric ? R 2 = { (1,1), (1,2), (2,1) } R 3 = { (1,1), (1,2), (1,4), (2,1), (2,2), (3,3), (4,1), (4,4) } R 4 = { (2,1), (3,1), (3,2), (4,1), (4,2), (4,3) } Sol : R 2, R 3 are symmetric R 4 are antisymmetric

Def 5. A relation R on a set A is called transitive( 遞移 ) if for a, b, c  A, (a, b)  R and (b, c)  R  (a, c)  R

Example 13. Which of the relations in Example 7 are transitive ? R 2 = { (1,1), (1,2), (2,1) } R 3 = { (1,1), (1,2), (1,4), (2,1), (2,2), (3,3), (4,1), (4,4) } R 4 = { (2,1), (3,1), (3,2), (4,1), (4,2), (4,3) } Sol : R 2 is not transitive since (2,1)  R 2 and (1,2)  R 2 but (2,2)  R 2. R 3 is not transitive since (2,1)  R 3 and (1,4)  R 3 but (2,4)  R 3. R 4 is transitive

Example 17. Let A = {1, 2, 3} and B = {1, 2, 3, 4}. The relation R 1 = {(1,1), (2,2), (3,3)} and R 2 = {(1,1), (1,2), (1,3), (1,4)} can be combined to obtain R 1 ∪ R 2 R 1 ∩ R 2 = {(1,1)} R 1 - R 2 = {(2,2), (3,3)} R 2 - R 1 = {(1,2), (1,3), (1,4)} R 1  R 2 = {(2,2), (3,3), (1,2), (1,3), (1,4)} Exercise : 1, 7, symmetric difference, 即 (A  B) – (A  B)

補充 : antisymmetric 跟 symmetric 可並存  (a, b)  R, a≠b sym.  (b, a)  R antisym.  (b,a)  R 故若 R 中沒有 (a, b) with a≠b 即可同時滿足 eg. Let A = {1,2,3}, give a relation R on A s.t. R is both symmetric and antisymmetric, but not reflexive. Sol : R = { (1,1),(2,2) }

7.3 Representing Relations by matrices and digraphs Suppose that R is a relation from A={a 1, a 2, …, a m } to B = {b 1, b 2,…, b n }. The relation R can be represented by the matrix M R = [m ij ], where m ij = 1, if (a i,b j )  R 0, if (a i,b j )  R ※ Matrices

Example 1. Suppose that A = {1,2,3} and B = {1,2} Let R = {(a, b) | a > b, a  A, b  B}. What is M R ? Sol : A B

※ The relation R is symmetric iff (a i,a j )  R  (a j,a i )  R. This means m ij = m ji ( 即 M R 是對稱矩陣 ). ※ Let A={a 1, a 2, …,a n }. A relation R on A is reflexive iff ( a i, a i )  R,  i. i.e., a1a1 …a2a2 … a1a1 anan : anan : a2a2 對角線上全為

※ The relation R is antisymmetric iff (a i,a j )  R and i  j  (a j,a i )  R. This means that if m ij =1 with i≠j, then m ji =0. i.e., ※ transitive 性質不易從矩陣判斷出來

Example 3. Suppose that the relation R on a set is represented by the matrix Is R reflexive, symmetric, and / or antisymmetric ? Sol : reflexive, symmetric, not antisymmetric

eg. Suppose that S={0,1,2,3} Let R be a relation containing (a, b) if a  b, where a  S and b  S. Is R reflexive, symmetric, antisymmetric ? Sol : ∴ R is reflexive and antisymmetric, not symmetric

※ Representing Relations using Digraphs. (directed graphs) Example 8. Show the directed graph (digraph) of the relation R={(1,1),(1,3),(2,1),(2,3),(2,4), (3,1),(3,2),(4,1)} on the set {1,2,3,4}. Sol : vertex( 點 ) : 1, 2, 3, 4 edge( 邊 ) : 1  1, 1  3, 2  1 2  3, 2  4, 3  1 3  2, 4 

※ The relation R is reflexive iff for every vertex, ( 每個點上都有 loop ) ※ The relation R is symmetric iff 兩點間若有邊,必只有一條邊 ※ The relation R is antisymmetric iff xy  xy ( 兩點間若有邊,必為一對不同方向的邊 )

※ The relation R is transitive iff for a, b, c  A, (a, b)  R and (b, c)  R  (a, c)  R. This means: a b dc  a b dc ( 只要點 x 有路徑走到點 y , x 必定有邊直接連向 y ) 7.3.9

Example 10. Determine whether the relations R and S are reflexive, symmetric, antisymmetric, and / or transitive Sol : R : a bc Exercise : 1,13,26, 27,31 irreflexive( 非反身性 ) 的定義在 p.480 即 ( a, a )  R,  a  A a b cd S reflexive, not symmetric, not antisymmetric, not transitive ( a → b, b → c, a → c ) not reflexive, symmetric not antisymmetric not transitive ( b → a, a → c, b → c )

7.4 Closures of Relations The relation R={(1,1), (1,2), (2,1), (3,2)} on the set A={1, 2, 3} is not reflexive. Q: How to construct a smallest reflexive relation R r such that R  R r ? ※ Closures Sol: Let R r = R  {(2,2), (3,3)}. i. e., R r = R  {(a, a)| a  A}. R r is a reflexive relation containing R that is as small as possible. It is called the reflexive closure of R.

Example 1. What is the reflexive closure of the relation R={(a,b) | a < b} on the set of integers ? Sol : R r = R ∪ { (a, a) | a  Z } = { (a, b) | a  b, a, b  Z } Example : The relation R={ (1,1),(1,2),(2,2),(2,3),(3,1),(3,2) } on the set A={1,2,3} is not symmetric. Sol : Let R  1 ={ (a, b) | (a, b)  R } Let R s = R ∪ R  1 ={ (1,1),(1,2),(2,1),(2,2),(2,3), (3,1),(1,3),(3,2) } R s is the smallest symmetric relation containing R, called the symmetric closure of R

Def : 1.(reflexive closure of R on A ) R r =the smallest set containing R and is reflexive. R r = R ∪ { (a, a) | a  A, (a, a)  R} 2.(symmetric closure of R on A ) R s =the smallest set containing R and is symmetric R s =R ∪ { (b, a) | (a, b)  R & (b, a)  R} 3.(transitive closure of R on A ) R t =the smallest set containing R and is transitive. R t =R ∪ { (a, c) | (a, b)  R & (b, c)  R, but (a, c)  R} Note. 沒有 antisymmetric closure ,因若不是 antisymmetric , 表示有 a≠b, 且 (a, b) 及 (b, a) 都  R ,此時加任何 pair 都不可能變成 antisymmetric

Example 2. What is the symmetric closure of the relation R={(a, b) | a > b } on the set of positive integers ? Sol : R ∪ { (b, a) | a > b }={ (a,b) | a  b } { (a, b) | a < b } || 7.4.4

Example. Let R be a relation on a set A, where A={1,2,3,4,5}, R={(1,2),(2,3),(3,4),(4,5)}. What is the transitive closure R t of R ? Sol : ∴ R t = (1,2),(2,3),(3,4),(4,5) (1,3),(1,4),(1,5) (2,4),(2,5) (3,5) Exercise : 1,9( 改為找三種 closure) 7.4.5

7.5 Equivalence Relations ( 等價關係 ) Def 1. A relation R on a set A is called an equivalence relation if it is reflexive, symmetric, and transitive. Example 1. Let L(x) denote the length of the string x. Suppose that the relation R={(a,b) | L(a)=L(b), a,b are strings of English letters } Is R an equivalence relation ? Sol :  (a,a)  R  string a  reflexive  (a,b)  R  (b,a)  R  symmetric  (a,b)  R, (b,c)  R  (a,c)  R  transitive Yes

Example 4. (Congruence Modulo m ) Let m  Z and m > 1. Show that the relation R={ (a,b) | a≡b (mod m) } is an equivalence relation on the set of integers. Note that a≡b(mod m) iff m | (a  b). ∵  a≡a (mod m)  (a, a)  R  reflexive  If a≡b(mod m), then a  b=km, k  Z  b  a≡(  k)m  b≡a (mod m)  symmetric  If a≡b(mod m), b≡c(mod m) then a  b=km, b  c=lm  a  c=(k+l)m  a≡c(mod m)  transitive ∴ R is an equivalence relation. Sol : ( a is congruent to b modulo m )

Def 2. Let R be an equivalence relation on a set A. The equivalence class of the element a  A is [a] R = { s | (a, s)  R } For any b  [a] R, b is called a representative of this equivalence class. Note: If (a, b)  R, then [a] R =[b] R

Example 6. What are the equivalence class of 0 and 1 for congruence modulo 4 ? Sol : Let R={ (a,b) | a≡b (mod 4) } Then [0] R = { s | (0,s)  R } = { …,  8,  4, 0, 4, 8, … } [1] R = { t | (1,t)  R } = { …,  7,  3, 1, 5, 9,…} 7.5.4

Def. A partition ( 分割 ) of a set S is a collection of disjoint nonempty subsets A i of S that have S as their union. In other  words, we have A i ≠ ,  i, A i ∩ A j = , when i ≠j and ∪ A i = S

Example 7. Suppose that S={ 1,2,3,4,5,6 }. The collection of sets A 1 ={1,2,3}, A 2 ={ 4,5 }, and A 3 ={ 6 } form a partition of S. Thm 2. Let R be an equivalence relation on a set A. Then the equivalence classes of R form a partition of A

Example 9. The congruence modulo 4 form a partition of the integers. Sol : [0] 4 = { …,  8,  4, 0, 4, 8, … } [1] 4 = { …,  7,  3, 1, 5, 9, … } [2] 4 = { …,  6,  2, 2, 6, 10, … } [3] 4 = { …,  5,  1, 3, 7, 11, … } Exercise : 3,17,19,