6 Relations and Functions 6.1 Relations
6 Relations and Functions 6.1 Relations
6.1 Relations
Definition
Given two sets A and B (not necessarily different) a relation from A to B is
any subset R ⊆ A × B. If (a, b) ∈ R we write aRb and say that a is related
to b. If a is not related to b, i.e. (a, b) ∈
/ R, write aNRb.
If A = B, a relation on A is any subset R ⊆ A × A.
Example 66
Let A = {a, b, c, d} and B = {x, y, z}.
(a) R1 = {(a, x), (b, z), (d, y), (c, x)} is a relation from A to B.
(b) R2 = {(x, d), (y, c)} is a relation from B to A.
(c) R3 = {(x, x), (x, y), (x, z)} is a relation on B.
Example 67
R = {(x, x2 ) : x ∈ R} is a relation on R.
We can show this on a graph.
25
20
15
10
-4 -2 0 2 4
x
1
Example 68
If A = {1, 2, 3, 4} and R = {(1, 1), (3, 2), (2, 3), (4, 1), (3, 3)} this relation can
be drawn as
2
Example 69
Starting with the digraph
b e
c d
{(a, a), (a, b), (a, e), (b, d), (c, b), (d, d), (e, b)}.
Special Properties
A relation on a set A may satisfy any of the following properties:
R is reflexive: for all x ∈ A, (x, x) ∈ R, i.e.
∀x : (x, x) ∈ R.
R is symmetric: for all x, y ∈ A, if (x, y) ∈ R then (y, x) ∈ R, i.e.
2
For R to be reflexive means that in the digraph there is a loop on every
vertex.
For R to be symmetric means that, in the digraph, on every path between
different vertices there will be two arrows.
For R to be transitive you have to look at every example in the digraph
of a path linking three vertices using two line. Then you have to check that
there is one line linking the end points (i.e. you have to check that if you
can go the ‘long way round’ then you can go the ‘direct’ way. Note that in
the definition of transitive the vertices x, y and z need not be different.
Example 70
Let A = {1, 2, 3}.
(a) Let R1 = {(1, 2), (2, 1), (3, 3)}.
(b) Let R2 = {(1, 3), (3, 1), (2, 3), (3, 2), (1, 1), (2, 2), (3, 3)}.
1
3
3
(c) Let R3 = {(1, 2), (2, 1), (3, 1), (3, 2), (1, 1), (2, 2), (3, 3)}.
1
3
1
3
4
Example 71
Define R on N by aRb if, and only if, a < b.
Then R is transitive (e.g. 1 < 2 and 2 < 3 implies 1 < 3) but R is not
reflexive (e.g. 1NR1 since 1 ≮ 1) and R is not symmetric (e.g. 2R3 since
2 < 3 but 3N R2 since 3 ≮ 2).
Definition If m, n ∈ Z we say that m divides n if there exists a ∈ Z such
that n = ma, and write m|n.
So for example 3 divides 6 since 6 = 3 × 2, and 3 divides −6 since
−6 = 3 × (−2) , and also 3 divides 0 since 0 = 0 × 3. Of course all integers
divide 0 for the same reason: 0 = 0 × m for any m ∈ Z.
Example 72
Define R on Z by aRb if 3 divides a − b.
So, for example, 1R1 (since 3 divides 0), and similarly 1R4, 1R7, 1R10, ...,
while 1NR9.
We show that R satisfies all three properties.
Given x ∈ Z, then by above 3 divides x − x = 0 so xRx, i.e. R is
reflexive.
Given x, y ∈ Z, if xRy then 3 divides x − y so 3 divides −(x − y) i.e. 3
divides y − x, so yRx; i.e. R is symmetric.
Given x, y, z ∈ Z, if xRy and yRz then 3 divides x − y and y − z. By the
definition this means we can find a, b ∈ Z such that ,x−y = 3a and y−z = 3b.
Adding these two equations together we get (x − y)+(y − z) = 3a+3b, that
is x − z = 3(a + b). Thus 3 divide. x − z and so xRz, i.e. R is transitive.
Definition
A relation that satisfies all three properties (reflexive, symmetric and
transitive) is called an equivalence relation.
Example 73
1
3
is an equivalence relation.