slides

advertisement
CSE 20
DISCRETE MATH
Prof. Shachar Lovett
http://cseweb.ucsd.edu/classes/wi15/cse20-a/
Clicker
frequency:
CA
Todays topics
• Relations
• Section 6.1 in Jenkyns, Stephenson
(Binary) Relations
• Model a relation between two families of objects
• Examples:
• đ‘Ĩ < đ‘Ļ for integer numbers
• A ⊂ đĩ for subsets of integers
(Binary) Relations
• Model a relation between two families of objects
• Formally:
• U universe set
• Relation: 𝑅 ⊆ 𝑈 × đ‘ˆ
• For đ‘Ĩ, đ‘Ļ ∈ 𝑈 we write: đ‘Ĩ𝑅đ‘Ļ as a shorthand for "(đ‘Ĩ, đ‘Ļ) ∈ 𝑅“
• Example 1: x<y, formally…
• U=N
• “đ‘Ĩ < đ‘Ļ” represents the relation 𝑅 =
đ‘Ĩ, đ‘Ļ : đ‘Ĩ, đ‘Ļ ∈ 𝑁, đ‘Ĩ < đ‘Ļ
• Example 1: x<y, formally…
• U = P(N)
• “đ‘Ĩ ⊂ đ‘Ļ” represents the relation 𝑅 = { đ‘Ĩ, đ‘Ļ : đ‘Ĩ, đ‘Ļ ∈ 𝑃(𝑁), đ‘Ĩ ⊂ đ‘Ļ}
Relations are graphs
• Think of relations as directed graphs
• U=nodes of graphs
• xRy means “there in an edge xīƒ y”
• Is
R
B.
R
C. Both
D. Neither
A.
?
?
Relations are graphs
• What does this relation captures?
xRy means
2
A. x>y
B. x=y
3
1
C. x divides y
D. x+y
E. None/more than one
4
6
5
Three important properties of relations
• There are several important properties of relations
• We will focus on the most important three
• A relation R is symmetric if ∀đ‘Ĩ, đ‘Ļ ∈ 𝑈, đ‘Ĩ𝑅đ‘Ļ ⇔ đ‘Ļ𝑅đ‘Ĩ
• A relation R is reflexive if ∀đ‘Ĩ ∈ 𝑈, đ‘Ĩ𝑅đ‘Ĩ
• A relation R is transitive if ∀đ‘Ĩ, đ‘Ļ, 𝑧 ∈ 𝑈, (đ‘Ĩ𝑅đ‘Ļ ∧ đ‘Ļ𝑅𝑧) → đ‘Ĩ𝑅𝑧
Symmetric relations
• A relation is symmetric if ∀đ‘Ĩ, đ‘Ļ ∈ 𝑈, đ‘Ĩ𝑅đ‘Ļ ⇔ đ‘Ļ𝑅đ‘Ĩ
• As a graph, it is undirected
• Which of the following is symmetric
A.
B.
C.
D.
E.
x<y
x divides y
x and y have the same sign
xī‚šy
None/more than one
Types of relations
• A relation is reflexive if ∀đ‘Ĩ ∈ 𝑈, đ‘Ĩ𝑅đ‘Ĩ
• As a graph, it has loops in all vertices
• Which of the following is reflexive
A. x<y
B. x divides y
C. x and y have the same sign
D. xī‚šy
E. None/more than one
Types of relations
• A relation is transitive if ∀đ‘Ĩ, đ‘Ļ, 𝑧 ∈ 𝑈, (đ‘Ĩ𝑅đ‘Ļ ∧ đ‘Ļ𝑅𝑧) → đ‘Ĩ𝑅𝑧
• This is less intuitive, when viewed as a graph…
• Which of the following is transitive
A. x<y
B. x divides y
C. x and y have the same sign
D. xī‚šy
E. None/more than one
Test your understanding
• Let U=P(N) (all subsets of integers)
•R=⊆
• Is R symmetric?
A. Yes
B. No
Test your understanding
• Let U=P(N) (all subsets of integers)
•R=⊆
• Is R reflexive?
A. Yes
B. No
Test your understanding
• Let U=P(N) (all subsets of integers)
•R=⊆
• Is R transitive?
A. Yes
B. No
Test your understanding
• Let U=P(N)
• R = ⊊ (ie xRy = “x is proper subset of y”)
• Is R symmetric / reflexive / transitive?
A. Yes,Yes,Yes
B. No,No,No
C. Yes,Yes,No
D. No,No,Yes
E. Other
Test your understanding
• Let U=P(N)
• R = ⊈ (ie xRy = “x is NOT a subset of y”)
• Is R symmetric / reflexive / transitive?
A. Yes,Yes,Yes
B. No,No,No
C. Yes,Yes,No
D. No,No,Yes
E. Other
Test your understanding
• Let U=“all Boolean formulas on n inputs”
• xRy = “x and y compute the same Boolean function”
• Is R symmetric / reflexive / transitive?
A. Yes,Yes,Yes
B. No,No,No
C. Yes,Yes,No
D. No,No,Yes
E. Other
Next class
• Equivalence relations
• Read section 6.2 in Jenkyns, Stephenson
Download