Handout #17
CS103
April 16, 2010
Robert Plummer
Relations
Relations are a fundamental concept in discrete mathematics, used to define how sets of objects
relate to other sets of objects.
Not only do they provide a formal way of being able to talk about
such relationships, they also provide the most widespread model used in modern commercial
database systems.
Understanding relations from a mathematical perspective not only gives you an
important modeling tool, but also gives you the foundational theory used in a number of
applications including relational database management systems, task scheduling systems, and
methods to solve various optimization problems.
To explore what relations are, let’s begin by considering the following set
G
Greek deities:
G
= {Zeus, Apollo, Cronus, Poseidon}
As you may know, Zeus is the father of Apollo, Cronus is the father of Poseidon, and Cronus is also
the father of Zeus.
So some of the elements of
G
that satisfy the "is the father of" relation with
respect to others
Notice that in this case, the elements that are related are both from the same set,
G.
If we had another set, H, of female deities, then some members of G might bear the "is married
to" relation to members of H, and that relationship would also be true in the other direction.
We
will formalize all of these ideas, and more, starting with the following definition:
Definition
A
binary
relation
R
between two sets
A
and
B
(which may be the same) is a subset of the
Cartesian product
A
x
B
.
If element a
∈
A is related by
R
to element b
∈
B, we denote this
fact by writing
(a, b)
∈
R
, or alternately, by
a R b
.
A good way to think of a binary relation is that it is a way to designate that of all the ordered pairs
in the cross product of two sets, some are "interesting" because there is a certain relationship
between them.
We often name relations with capital letters, but some relations, such as "less-
than" have their own symbols, like "<".
What we defined above is a
binary relation
because it operates on ordered pairs.
We can also
define
unary relations,
which operate on single elements, or
ternary relations
, which operate
on ordered triples.
In general an
n
-ary relation
will operate on
n
-tuples.
Formally, we can
express this as:
Definition
An
n
-ary relation
on the sets
A
1
,
A
2
, …,
A
n
is a subset of
A
1
x
A
2
x … x
A
n
.
The sets
A
1
,
A
2
,
…,
A
n
are called the
domains
of the relation, and
n
is called its
degree
.