Relations

advertisement
Relations
A relation from A to B is just a subset of A × B. Write as (a, b) ∈ R, or aRb.
e.g., A = {students}, B = {courses}, and R is the class registration.
Number of relations from A to B: 2|A||B| .
Special relations: ∅, A × B, functions, 1-1 functions, onto functions.
Relations from A to A are called relations on A.
Properties of relations:
1. Reflexive: ∀a((a, a) ∈ R)
2. Symmetric: for all a, b, (a, b) ∈ R → (b, a) ∈ R.
3. antisymmetric: for all a, b, (a, b) ∈ R ∧ (b, a) ∈ R → a = b.
4. transitive: for all a, b, c, (a, b) ∈ R ∧ (b, c) ∈ R → (a, c) ∈ R.
Examples with the properties:
∅: symm, anti-symm, and transitive
A × A: ref, symm, transitive
A = N, aRb iff a ≤ b: ref, anti-sym, trans
A = P, aRb iff a|b: ref, anti-sym, trans
A = Z, aRA iff |a| = |b|: ref, symm, trans.
A = P (N), aRb iff a ⊆ b: ref, anti-sym, trans
A = P (N), aRb iff card(a) = card(b): ref, sym, trans.
1.
2.
3.
4.
Identity Relation I = {(a, a) : a ∈ A}.
Inverse relation R−1 = {(b, a) : (a, b) ∈ R}.
One can define ∪, ∩, complement of a relation.
R ◦ S = {(a, b) : ∃cs.t.(a, c) ∈ R, (c, b) ∈ S}.
Therefore:
Reflexive: I ⊆ R
Symmetric: R = R−1 .
Anti-symmetric: R ∩ R−1 ⊆ I.
Transitive: R2 ⊆ R.
By induction one can show that
Theorem 1. R is transitive iff Rn ⊆ R for all n ≥ 1.
How to represent a relation:
Method 1. By 01-matrices. aij = 1 iff (ai , bi ∈ R). Then relations on A are in one-to-one
correspondence with 01 n × n matrices.
Reflexive: all 1’s in diagonal
symmetric: M = M T
anti-symmetric: among any pair, not both entries are 1.
transitive: M 2 ≤ M . Note that the matrix of R2 is exactly M 2 , (any non-zero entry is reduced
to 1).
Method 2 By a digraph. It is easy to view.
How to make a property if R doesn’t have it? – Closure
Reflexive closure: union with I.
Symmetric closure: R ∪ R−1 .
1
S
transitive closure: n≥1 Rn .
Counting: Let A be a set of n elements.
2
Number of relations on A: 2n .
2
Reflexive relations: 2n −n
2
Symmetric relations: 2(n +n)/2
2
anti-symmetric: 2n 3(n −n)/2
2
ref and symmetric: 2(n −n)/2
2
ref and anti-symmetric: 3(n −n)/2
symm and antisymm: 2n .
ref, symm and antisym: 1.
Two definitions
Equivalence relation: reflexive, symmetric, and transitive.
Partial order: relation that is reflexive, anti-symmetric, and transitive.
Examples:
1. N, (a, b) ∈ R iff a − b is a multiple of 5.
2. R, (a, b) ∈ R iff a − b ∈ Z
3. P. (a, b) ∈ R iff f (a) = f (b) where f (n) is the number of positive divisors of n.
4. N, (a, b) ∈ R iff a ≤ b.
5. P (A), (a, b) ∈ R iff a ⊆ b.
A property of equivalence relations: The equivalence classes form a partition of the base set A.
(can be useful in classification.)
Do the classification for the above examples of ERs.
2
Download