24
Relations
24.1
Introduction
•
consider sets
A
=
{
Mon, Ott, Tor, Van
}
,
B
=
{
BC, ON, QC
}
recall: the Cartesian product
A
×
B
=
{
(
a, b
)

a
∈
A, b
∈
B
}
=
{
(Mon, BC), (Mon, ON),
...
,
(Van, ON), (Van,QC)
}
.
suppose we are only interested in the ordered pairs (
a, b
) where city
a
is in province
b
.
then we have a subset of
A
×
B
R
=
{
(Mon, QC), (Ott, ON), (Tor, ON), (Van, BC)
}
R
is a
relation from
the cities
to
the provinces.
•
a
binary relation
R
from a set
A
to a set
B
is a subset of
A
×
B
.
if (
a, b
)
∈
R
, then we say
a
is related to
b
by
R
, denoted
aRb
.
if (
a, b
)
±∈
R
, then we say
a
is not related to
b
R
, denoted
a
±
Rb
.
•
in previous example,
R
=
{
(
a, b
)
∈
A
×
B

city
a
is in province
b
}
(Tor, ON)
∈
R
⇔
Tor
R
ON
Ott, BC)
±∈
R
⇔
Ott
±
R
BC
•
an
n
ary relation
on the sets
A
1
,A
2
,...,A
n
is a subset of
A
1
×
A
2
×···×
A
n
we will
not
be looking at these in our course
when we talk about relations, we will mean
binary
relations
24.2
Graphical representation of a relation
•
suppose
R
is a relation from
A
to
B
•
draw
A, B
as regions, elements of
A, B
as dots
•
if
, draw an arrow from
a
to
b
•
display cities, provinces relation using this
24.3
Functions and relations
•
a function
F
from
A
to
B
is a relation from
A
to
B
such that
∀
x
∈
A
∃
y
∈
B
(
xFy
)
∀
x
∈
A
∀
y
∈
B
∀
z
∈
B
(
xF y
)
∧
(
xFz
)
→
(
y
=
z
)
•
use arrow diagrams to display examples of functions and nonfunctions
24.4
Inverses of relations
•
given a relation
R
from
A
to
B
, the
inverse
relation
R

1
from
B
to
A
is:
R

1
=
{
(
x, y
)
∈
B
×
A

(
y,x
)
∈
R
}
=
{
(
)
∈
B
×
A

(
x, y
)
∈
R
}
•
draw arrow diagrams of a simple relation and its inverse
24.5
Relations on a set
•
a
relation on a set
A
is a binary relation from
A
to
A
.
•
e.g.
A
=
{
1
,
2
,
3
,
4
}
,
R
=
{
(1
,
1)
,
(2
,
1)
,
(2
,
2)
,
(3
,
1)
,
(3
,
3)
,
(4
,
1)
,
(4
,
2)
,
(4
,
4)
}
i.e.
xRy
⇔
x
is a multiple of
y
52