# 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:
• đĨ &lt; đĻ for integer numbers
• A ⊂ đĩ for subsets of integers
(Binary) Relations
• Model a relation between two families of objects
• Formally:
• U universe set
• Relation: đ ⊆ đ &times; đ
• For đĨ, đĻ ∈ đ we write: đĨđđĻ as a shorthand for &quot;(đĨ, đĻ) ∈ đ“
• Example 1: x&lt;y, formally…
• U=N
• “đĨ &lt; đĻ” represents the relation đ =
đĨ, đĻ : đĨ, đĻ ∈ đ, đĨ &lt; đĻ
• Example 1: x&lt;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&gt;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&lt;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&lt;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&lt;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
```