Relations and Functions
Kind of relations
⚫There are three kinds of relations
Equivalence relations,
Order relations,
Functions.
Ordered pair
⚫ An ordinary pair {a, b} is a set with two elements.
In a set the order of the elements is irrelevant,
so {a, b} = {b, a}.
⚫ If the order of the elements is relevant, then we
use a different object called an ordered pair,
represented (a, b).
⚫ Now (a, b) ≠ (b, a) (unless a = b). In general, (a,
b) ≠ (a`, b`) iff a = a` and b = b`.
Ordered pairs and sets
⚫Let A be a given set.
⚫An ordered pair (a, b) of elements in A is
defined to be the set {a, {a, b}}. The
element a is called the first component.
Examples
d.
b
and
c
a
Thus,
sets.
of
equality
of
definition
by the
d}
{c,
b}
{a,
and
c
a
to
equivalent
is
this
and
d}}
{c,
{c,
b}
{a,
{a,
if
only
and
if
d)
(c,
b)
(a,
b.
a).
(b,
b)
(a,
is,
That
b}}.
{a,
{b,
b}}
{a,
{a,
then
b
a
If
a.
Soln.
d.
b
and
c
a
if
only
and
if
d)
(c,
b)
(a,
that
Show
b.
a).
(b,
b)
(a,
then
b
a
if
that
Show
a.
1
Example
=
=
=
=
=
=



=
=
=


Examples
1
y
and
2
1
x
n,
eliminatio
of
method
by the
Solving
0
y
-
x
1
y
x
system
the
have
We
Solution.
y).
-
x
(1,
0)
y,
(x
such that
y
and
x
Find
2
Example
=
=



=
=
+
=
+
Cartesian product
⚫ Given two sets A, B, their Cartesian product A×B
is the set of all ordered pairs (a, b) such that a ∈
A and b ∈ B:
⚫ A × B = {(a, b) | (a ∈ A) ∧ (b ∈ B)} .
⚫ An example of a Cartesian product is the real
plane i.e the cartesian plane, where is the
set of real numbers ( is sometimes called the
real line).
Examples
⚫ Example 1
⚫ a. Show that if A is a set with m elements and B is a set of n
elements then A x B is a set of mn elements.
⚫ b. Show that if A x B = Ø then A = Ø or B = Ø.
⚫ Soln.
⚫ a. Consider an ordered pair (a, b). There are m possibilities for
a. For each fixed a, there are n possibilities for b. Thus, there
are m x n ordered pairs (a, b). That is, |A x B| = mn.
⚫ b. We use the proof by contrapositive. Suppose that A ≠ Ø and
B ≠ Ø. Then there is at least an a ∈ A and an element b ∈ B.
That is, (a, b) ∈ A x B and this shows that A x B ≠ Ø. A
negation of the assumption that A x B = Ø.
Binary Relation
R.
of
range
the
called
is
A}
a
some
for
R
b)
(a,
|
B
{b
Range(R)
set
The
R.
of
domain
the
called
is
B}
b
some
for
R
b)
(a,
|
A
{a
Dom(R)
set
The
A.
on
relation
binary
a
R
call
we
B
A
case
In
b.
to
related
is
a
say that
we
and
aRb
write
we
R
b)
(a,
If
B.
A
of
subset
a
is
B
set
a
A to
set
a
from
R
relation
binary
A



=



=
=


Examples
Example 1
Let A = {2, 3, 4} and B = {3, 4, 5, 6, 7}.
Define the relation R by aRb if and only if
a divides b. Find, R,Dom(R),Range(R).
Solution.
R = {(2, 4), (2, 6), (3, 3), (3, 6), (4,
4)},Dom(R) = {2, 3, 4}, and Range(R) = {3,
4, 6}.
Examples
Example 2
Let A = {1, 2, 3, 4}. Define the relation R by aRb
if and only if a b. Find, R, Dom (R), Range(R).
Soln.
R = {(1, 1), (1, 2), (1, 3), (1, 4), (2, 2), (2, 3), (2,
4), (3, 3), (3, 4), (4, 4)},Dom(R) = A,
Range (R) = A.

Digraph (Directed Graph)
loop.
a
simply
is
edge
directed
then the
R
a)
(a,
if
Finally,
b.
to
a
from
edge
directed
a)
(called
arrow
an
draw
we
R
b)
(a,
if
Next,
A.
of
elements
the
represent
to
s
or vertice
dots
draw
first
we
A,
set
a
on
relation
a
of
digraph
a
draw
To
digraph.
its
draw
to
is
set
a
on
relation
a
picture
way to
e
informativ
An


Example
⚫ Let A = {1, 2, 3, 4}. Define the relation R by aRb if
and only if a b. Draw the directed graph of the
relation 
The Inverse of a Relation ( )
1
−
R
R}.
b)
(a,
:
A
B
a)
{(b,
R
such that
Dom(R)
to
Range(R)
from
R
relation
the
is
R
of
inverse
The
B.
set
a
A to
set
a
from
relation
a
be
R
Let
1
-
1
-



=
The intersection and Union of Two
Relations
B}.
b)
(a,
and
A
b)
(a,
|
B
A
b)
{(a,
S
R
and
S},
b)
(a,
or
R
b)
(a,
|
B
A
b)
{(a,
S
R
by
S
R
and
S
R
relations
the
define
Then we
B.
set
a
A to
set
a
from
relations
two
be
S
and
R
Let




=





=



Example
S
S
R
R
S
R
8)}
(4,
6),
{(2,
S
8)}
(4,
10),
(2,
8),
(2,
6),
(2,
2),
(2,
10),
(1,
8),
(1,
6),
(1,
2),
{(1,
R
Solution.
S.
R
and
S,
R
S,
R,
of
elements
List the
a.
4
-
b
if
only
and
if
aSb
b.
|
a
if
only
and
if
aRb
:
10}
8,
6,
{2,
B
to
4}
2,
{1,
A
from
relations
two
following
Given the
=

=

=
=


=
=
=
Composition Relation
B}.
b
some
for
S
c)
(b,
and
R
b)
(a,
|
c)
{(a,
R
S
by
defined
C
A to
from
relation
the
be
to
relation,
n
compositio
the
called
R,
S
relation
the
define
can
we
C
to
B
from
S
relation
a
and
B
A to
from
R
relation
a
have
we
If



=


Example
u)}
(3,
t),
(3,
s),
(3,
t),
(2,
s),
(2,
t),
(1,
u),
{(1,
R
S
Solution.
R.
S
Find
u)}
(8,
t),
(6,
t),
(4,
s),
(4,
u),
{(2,
S
8)}
(3,
6),
(3,
4),
(3,
4),
(2,
6),
(1,
2),
{(1,
R
Let
=
=
=


Types of Binary Relations
⚫Four types
Reflexive
Symmetric
Transitive
Equivalence
Reflexive
reflexive.
not
is
b
a
if
only
and
if
aRb
by
defined
IR
on
relation
that the
Show
b.
reflexive.
is
4}
3,
2,
{1,
A
set
on the
b
a
relation
that the
Show
a.
Example
x.
each verte
at
loop
a
has
R
of
digraph
the
case,
In this
A.
a
all
for
R
a)
(a,
if
reflexive
called
is
A
set
a
on
R
relation
A

=



Soln
⚫ a) Since each vertex has a loop the relation is
reflexive.
⚫ b) A relation R on a set is reflexive if every
element is related to itself. For the relation
defined by aRb if a<b, it is not reflexive because
no element a in R can satisfy the condition a<a.
i.e. a number cannot be less than itself: it is
equal to itself.
Symmetric Relation
a.
to
b
from
edge
directed
a
also
is
there
b,
to
a
from
edge
directed
a
is
here
whenever t
hat
property t
the
has
relation
symmetric
a
of
digraph
The
R.
a)
(b,
have
must
then we
R
b)
(a,
whenever
if
symmetric
called
is
A
on
R
relation
A


Example
2.
not
4
but
4
2
b.
symmetric.
is
R
so
cRb
and
bRc
a.
Solution.
symmetric.
not
is
R
that
Show
b.
a
if
only
and
if
aRb
relation
the
be
R
and
numbers
real
of
set
the
be
IR
Let
b.
symmetric.
is
R
that
Show
d)}.
(d,
b),
(c,
c),
(b,
a),
{(a,
R
and
d}
c,
b,
{a,
A
Let
a.



=
=
Explanation for solution (a)
Given the set A={a,b,c,d} and the relation
R={(a,a),(b,c),(c,b),(d,d)}, to prove that R is symmetric, we
must check that for every ordered pair (x,y) in R, the
reverse ordered pair (y,x) also exists in R.
From R, we can see:
⚫ The pair (a,a) is symmetric to itself since a=a.
⚫ The pair (b,c) has its reverse (c,b) in R.
⚫ The pair (c,b) has its reverse (b,c) in R.
⚫ The pair (d,d) is symmetric to itself since d=d.
Because each element paired with another in R has a
corresponding pair that flips the two, the relation R is
symmetric.
Antisymmetric
edge.
directed
one
most
at
is
there
vertices
any two
between
hat
property t
the
has
relation
ric
antisymmet
an
of
digraph
The
R.
a)
(b,
then
b
a
and
R
b)
(a,
whenever
if
ric
antisymmet
called
is
A
set
a
on
R
relation
A



Examples
ric.
antisymmet
not
is
R
that
Show
d)}.
(d,
b),
(c,
c),
(b,
a),
{(a,
R
and
d}
c,
b,
{a,
A
Let
b.
ric.
antisymmet
is
R
that
Show
b.
divides
a
if
only
and
if
aRb
relation
the
R
and
integers
e
nonnegativ
of
set
the
be
IN
Let
a.
=
=
Soln
c.
b
with
cRb
and
bRc
b.
b.
a
Hence,
1.
k
k
have
must
then we
integers
positive
are
k
and
k
Since
1.
k
k
hence
and
a
k
k
a
that
implis
This
b.
k
a
and
a
k
b
such that
k
and
k
integers
positive
exist
there
division,
of
definition
By the
b.
a
that
show
must
We
a.
|
b
and
b
|
a
that
Suppose
a.
2
1
2
1
2
1
1
2
2
1
2
1

=
=
=
=
=
=
=
=
Transitive Relation
c.
to
a
from
edge
directed
a
also
is
e
then ther
c
to
b
from
and
b
to
a
from
edges
directed
are
er there
hat whenev
property t
the
has
relation
e
transitiv
a
of
digraph
The
R.
c)
(a,
then
R
c)
(b,
and
R
b)
(a,
whenever
if
e
transitiv
called
is
A
set
a
on
R
relation
A



Examples
e.
transitiv
is
R
that
Show
b.
divides
a
if
aRb
relation
the
R
and
integers
of
set
the
be
Let Z
ii)
tive.
not transi
is
R
that
Show
d)}.
(d,
b),
(c,
c),
(b,
a),
{(a,
R
and
d}
c,
b,
{a,
A
Let
i) =
=
Solns
c.
|
a
that
means
which
)a
k
(k
c
Thus,
b.
k
c
and
a
k
b
such that
k
and
k
integers
exist
Then there
c.
|
b
and
b
|
a
that
Suppose
ii)
R.
b)
(b,
but
R
b)
(c,
and
R
c)
(b,
i)
2
1
2
1
2
1
=
=
=



Equivalence Relation
IR.
on
relation
e
equivalenc
an
is
”
”
relation
the
example,
For
A.
on
relation
e
equivalenc
an
called
is
A
set
a
on
transitive
and
symmetric,
reflexive,
is
hat
relation t
A
=
Examples
on Z.
relation
e
equivalenc
an
is
R
that
Show
n.
by
divided
when
remainder
same
the
have
b
and
a
that
means
This
n.”
modulo
b
to
congruent
”a
read
n)
(mod
b
a
by
relation
this
denote
We
n.
of
multiple
a
is
b
-
a
if
aRb
by
defined
on Z
relation
the
be
R
Let
Z.
n
and
integers
of
set
the
be
Let Z


Soln
n).
(mod
a
b
is
That
n.
k
a
-
b
that
find
k we
-
k
letting
and
(-1)
by
equality
this
of
sides
both
Multiply
kn.
b
-
a
such that
k
integer
an
is
Then there
n).
(mod
b
a
such that
Z
b
a,
Let
:
symmetric
is
n).
(mod
a
a
is,
That
n.
·
0
a
-
a
Z,
a
all
For
:
reflexive
is


=
=

=




=


Soln
n).
(mod
c
a
that
shows
which
Z
k
k
k
kn where
c
-
a
find
we
together
equalities
these
Adding
n.
k
c
-
b
and
n
k
b
-
a
such that
k
and
k
integers
exist
Then there
n).
(mod
c
b
and
n)
(mod
b
a
such that
be
Z
c
b,
a,
Let
:
e
transitiv
is
2
1
2
1
2
1


+
=
=
=
=




Partial Order Relations
poset.
a
is
inequality
of
relation
with the
together
integers
of
set Z
that the
Show
1
Example
poset.
a
A
call
we
case
In this
e.
transitiv
and
ric,
antisymmet
reflexive,
is
if
order
partial
a
called
is
A
set
a
on
relation
A



Soln
z.
x
imply that
property
above
the
and
of
definition
the
then
z
y
and
y
x
if
Thus,
z.
then x
z
y
and
y
x
if
IR
in
of
property
ity
transitiv
By the
:
Transitive
y.
x
have
must
x then we
y
and
y
x
if
So
y.
or x
y,
x
y,
x
:
true
is
following
the
of
one
only
y
and
x
numbers
of
pair
given
a
for
numbers,
real
of
law
y
trichotom
By the
:
ric
Antisymmet
x.
x
since
x
x
have
we
Z
x
all
For
:
Reflexive








=



=

=


poset.
a
is
A
that
Show
B.
A
B
R
A
by
defined
relation
the
be
R
Let
subsets.
of
collection
a
be
A
Let
2
Example


Soln
Z.
X
then
Z
Y
and
Y
X
if
that
previously
seen
have
We
:
Transitive
A.
Y
X,
where
Y,
X
then
X
Y
and
Y
X
if
of
definition
By the
:
ric
Antisymmet
X.
X
A,
X
set
any
For
:
flexive
Re




=


=


Functions
f.
of
range
the
called
is
f
of
images
all
of
collection
The
codomain.
the
called
is
B
whereas
f
of
domain
the
called
is
A
set
The
f.
under
x
of
image
y the
call
We
f(x).
y
notation
the
use
we
f
y)
(x,
For
f.
y)
(x,
such that
B
y
unique
a
is
A there
every x
for
such that
B
A to
from
relation
a
is
B
set
a
A to
set
a
from
f
function
A
=




Examples
Example1
Show that the relation f = {(1, a), (2, b), (3, a)} defines a
function from A = {1, 2, 3} to B = {a, b, c}. Find its range.
Soln.
Since every element of A has a unique image, then f is a
function. Its range consists of the elements a and b.
Example2
Show that the relation f = {(1, a), (2, b), (3, c), (1, b)}
does not define a function from A = {1, 2, 3} to
B = {a, b, c}.
Soln.
⚫ Since 1 has two images in B then f is not a function.
Injective (one-one)
f(b).
f(a)
such that
A
of
b
and
a
elements
distinct
exist two
there
if
only
and
if
injective
not
is
f
that
see
n we
implicatio
l
conditiona
last
this
of
negation
the
Taking
f(y).
f(x)
then
y
x
if
A,
y
x,
all
for
if
only
and
if
injective
is
f
function
a
tive,
contraposi
of
concept
the
Using
y.
then x
f(y)
f(x)
if
A,
y
x,
all
for
if
only
and
if
one
-
to
-
one
or
injective
is
f
say that
We
function.
a
be
B
A
:
f
Let
=



=
=

→
Examples
injective.
not
is
f
1,
-
1
and
(-1)
1
Since
Soln.
injective.
not
is
n
f(n)
by
defined
Z
Z
:
f
fucntion
that the
Show
Example2
injective.
is
I
that
shows
This
.
I
of
definition
by the
y
then x
(y)
I
(x)
I
If
A.
y
Let x,
ln
injective.
is
A
set
a
on
I
function
identity
that the
Show
Example1
2
2
2
A
A
A
A
A

=
=
→
=
=

So
Surjective (onto)
A.
x
all
for
y
f(x)
such that
B
y
a
is
there
if
onto
not
is
f
that
see
we
this
of
negation
the
By taking
y.
f(x)
such that
A
an x
is
there
B
y
each
for
if
only
and
if
surjective
is
f
function
a
that
definition
this
from
follows
It
onto.
or
surjective
is
f
say that
then we
holds
equality
If
B.
Range(f)
have
we
B
A
:
f
function
a
Consider



=



→
Examples
onto.
is
f
Thus,
y.
f(x)
and
IR
3
5
y
x
find
for x we
solving
But
y.
5
-
3x
is,
That
y?
f(x)
such that
IR
an x
there
Is
IR.
y
Let
Soln.
.
surjective
is
5
-
3x
f(x)
by
defined
IR
IR
:
f
function
that the
Show
Example1
=

+
=
=
=


=
→
Examples
onto.
not
is
f
Hence,
integer.
an
not
is
which
3
8
n
find
n we
for
Solving
3.
5
-
3n
is,
That
3.
f(n)
such that
Z
n
an
be
should
e
then ther
onto
is
f
If
3.
m
Take
Soln
.
surjective
not
is
5
-
3n
f(n)
by
defined
Z
Z
:
f
function
that the
Show
Example2
=
=
=

=
=
→

Relations and Functions notes for presentation.pdf