


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
In my class of Applied Discrete Mathematics, I take lecture note from these slides, hope these lecture slides help other student.The key point in these slides are:Properties of Relations, Counting Relations, Combining Relations, Antisymmetric Relation, Reflexive Relation, Transitive Relation, Set Operations, Cases of Relations, N-Ary Relations, Databases and Relations
Typology: Slides
1 / 4
This page cannot be seen from the preview
Don't miss anything!



April 11, 2013 Applied Discrete Mathematics Week 11: Relations 1
We will now look at some useful ways to classify relations. Definition: A relation R on a set A is called reflexive if (a, a)∈R for every element a∈A. Are the following relations on {1, 2, 3, 4} reflexive?
R = {(1, 1), (1, 2), (2, 3), (3, 3), (4, 4)} No. R = {(1, 1), (2, 2), (2, 3), (3, 3), (4, 4)} Yes. R = {(1, 1), (2, 2), (3, 3)} No.
Definition: A relation on a set A is called irreflexive if (a, a)∉R for every element a∈A.
April 11, 2013 Applied Discrete Mathematics Week 11: Relations 2
Definitions:
A relation R on a set A is called symmetric if (b, a)∈R whenever (a, b)∈R for all a, b∈A.
A relation R on a set A is called antisymmetric if a = b whenever (a, b)∈R and (b, a)∈R. A relation R on a set A is called asymmetric if (a, b)∈R implies that (b, a)∉R for all a, b∈A.
April 11, 2013 Applied Discrete Mathematics Week 11: Relations 3
Definition: A relation R on a set A is called transitive if whenever (a, b)∈R and (b, c)∈R, then (a, c)∈R for a, b, c∈A. Are the following relations on {1, 2, 3, 4} transitive?
R = {(1, 1), (1, 2), (2, 2), (2, 1), (3, 3)} Yes.
R = {(1, 3), (3, 2), (2, 1)} No.
R = {(2, 4), (4, 3), (2, 3), (4, 1)} No.
April 11, 2013 Applied Discrete Mathematics Week 11: Relations 4
Example: How many different reflexive relations can be defined on a set A containing n elements? Solution: Relations on R are subsets of A×A, which contains n^2 elements. Therefore, different relations on A can be generated by choosing different subsets out of these n^2 elements, so there are 2n^2 relations. A reflexive relation, however, must contain the n elements (a, a) for every a∈A. Consequently, we can only choose among n^2 – n = n(n – 1) elements to generate reflexive relations, so there are 2n(n – 1)^ of them.
April 11, 2013 Applied Discrete Mathematics Week 11: Relations 5
Relations are sets, and therefore, we can apply the usual set operations to them.
If we have two relations R 1 and R 2 , and both of them are from a set A to a set B, then we can combine them to R 1 ∪ R 2 , R 1 ∩ R 2 , or R 1 – R 2.
In each case, the result will be another relation from A to B.
April 11, 2013 Applied Discrete Mathematics Week 11: Relations 6
4 and there is another important way to combine relations. Definition: Let R be a relation from a set A to a set B and S a relation from B to a set C. The composite of R and S is the relation consisting of ordered pairs (a, c), where a∈A, c∈C, and for which there exists an element b∈B such that (a, b)∈R and (b, c)∈S. We denote the composite of R and S by S °°°° R.
In other words, if relation R contains a pair (a, b) and relation S contains a pair (b, c), then S°°°°R contains a pair (a, c).
April 11, 2013 Applied Discrete Mathematics Week 11: Relations 7
Example: Let D and S be relations on A = {1, 2, 3, 4}. D = {(a, b) | b = 5 - a} “b equals (5 – a)” S = {(a, b) | a < b} “a is smaller than b”
D = {(1, 4), (2, 3), (3, 2), (4, 1)} S = {(1, 2), (1, 3), (1, 4), (2, 3), (2, 4), (3, 4)} S°°°°D = { (2, 4), (3, 3), (3, 4), (4, 2), (4, 3),
D maps an element a to the element (5 – a), and afterwards S maps (5 – a) to all elements larger than (5 – a), resulting in S °°°° D = {(a,b) | b > 5 – a} or S °°°° D = {(a,b) | a + b > 5}.
April 11, 2013 Applied Discrete Mathematics Week 11: Relations 8
Another Example: Let X and Y be relations on A = {1, 2, 3, 4}. X = {(a, b) | b = a + 1} “b equals a plus 1” Y = {(a, b) | b = 3a} “b equals 3 times a”
X = {(1, 2), (2, 3), (3, 4), (4, 5), 4} Y = {(1, 3), (2, 6), (3, 9), (4, 12), 4} X°°°°Y = { (1, 4), (2, 7), (3, 10), (4, 13), 4} Y maps an element a to the element 3a, and afterwards X maps 3a to 3a + 1. X °°°° Y = {(a,b) | b = 3a + 1}
April 11, 2013 Applied Discrete Mathematics Week 11: Relations 9
April 11, 2013 Applied Discrete Mathematics Week 11: Relations 10
Definition: Let R be a relation on the set A. The powers Rn, n = 1, 2, 3, 4, are defined inductively by R^1 = R Rn+1^ = Rn°°°°R
In other words: Rn^ = R°°°°R°°°° , °°°°R (n times the letter R)
April 11, 2013 Applied Discrete Mathematics Week 11: Relations 11
Theorem: The relation R on a set A is transitive if and only if Rn^ ⊆ R for all positive integers n. Remember the definition of transitivity: Definition: A relation R on a set A is called transitive if whenever (a, b)∈R and (b, c)∈R, then (a, c)∈R for a, b, c∈A. The composite of R with itself contains exactly these pairs (a, c). Therefore, for a transitive relation R, R°°°°R does not contain any pairs that are not in R, so R°°°°R ⊆ R. Since R°°°°R does not introduce any pairs that are not already in R, it must also be true that (R°°°°R)°°°°R ⊆ R, and so on, so that Rn^ ⊆ R. April 11, 2013 Applied Discrete Mathematics Week 11: Relations 12
In order to study an interesting application of relations, namely databases , we first need to generalize the concept of binary relations to n-ary relations.
Definition: Let A 1 , A 2 , 4, An be sets. An n-ary relation on these sets is a subset of A 1 ×A 2 × 4 ×An. The sets A 1 , A 2 , 4, An are called the domains of the relation, and n is called its degree.
April 11, 2013 Applied Discrete Mathematics Week 11: Relations 19
In some cases, applying a projection to an entire table may not only result in fewer columns, but also in fewer rows.
Why is that?
Some records may only have differed in those fields that were deleted, so they become identical , and there is no need to list identical records more than once.
April 11, 2013 Applied Discrete Mathematics Week 11: Relations 20
We can use the join operation to combine two tables into one if they share some identical fields.
Definition: Let R be a relation of degree m and S a relation of degree n. The join Jp(R, S), where p ≤ m and p ≤ n, is a relation of degree m + n – p that consists of all (m + n – p)-tuples (a 1 , a 2 , 4, am-p, c 1 , c 2 , 4, cp, b 1 , b 2 , 4, bn-p), where the m-tuple (a 1 , a 2 , 4, am-p, c 1 , c 2 , 4, cp) belongs to R and the n-tuple (c 1 , c 2 , 4, cp, b 1 , b 2 , 4, bn-p) belongs to S.
April 11, 2013 Applied Discrete Mathematics Week 11: Relations 21
In other words, to generate Jp(R, S), we have to find all the elements in R whose p last components match the p first components of an element in S.
The new relation contains exactly these matches, which are combined to tuples that contain each matching field only once.
April 11, 2013 Applied Discrete Mathematics Week 11: Relations 22
Example: What is J 1 (Y, R), where Y contains the fields Student Name and Year of Birth , Y = {(1978, Ackermann), (1972, Adams), (1917, Chou), (1984, Goodfriend), (1982, Rao), (1970, Stevens)}, and R contains the student records as defined before?
April 11, 2013 Applied Discrete Mathematics Week 11: Relations 23
Solution: The resulting relation is:
{(1978, Ackermann, 00231455, CS, 3.88), (1972, Adams, 00888323, Physics, 3.45), (1917, Chou, 00102147, CS, 3.79), (1984, Goodfriend, 00453876, Math, 3.45), (1982, Rao, 00678543, Math, 3.90), (1970, Stevens, 00786576, Psych, 2.99)}
Since Y has two fields and R has four, the relation J 1 (Y, R) has 2 + 4 – 1 = 5 fields.