CMPUT 272 (Stewart)
Lecture 16
Reading:
Epp Chapter 7
Examples of functions
from last time:
1.
f
:
X
7→
Y
where
X
=
{
a, b, c, d
}
,
Y
=
{
0
,
1
,
2
,
3
,
4
}
, and:
f
(
a
) = 1
f
(
b
) = 2
f
(
c
) = 3
f
(
d
) = 2
or
x
f
(
x
)
a
1
b
2
c
3
d
2
or
X
a
b
c
d
Y
0
1
2
3
4
or
f
=
{
(
a,
1)
,
(
b,
2)
,
(
c,
3)
,
(
d,
2)
}
2. The function computed by the Division Algorithm is:
D
:
N
×
Z
+
7→
N
2
where each ordered pair (
a, d
)
∈
N
×
Z
+
maps to the
ordered pair (
q, r
)
∈
N
2
such that
a
=
dq
+
r
and 0
≤
r < d
.
3.
mod
:
Z
×
Z
+
7→
Z
where for each integer
n
and positive integer
d
,
mod
(
n, d
) =
n
mod
d
=
r
where
n
=
dq
+
r, q
and
r
are integers, and 0
≤
r < d.
4.
gcd
:
Z
2
 {
(0
,
0)
} 7→
Z
+
where, for all
a, b
∈
Z
that are not both zero,
gcd
(
a, b
) = the largest integer that divides both
a
and
b.
5. A sequence is a function:
1
1
2
,
1
2
2
,
1
3
2
,
1
4
2
, . . .
f
:
Z
+
7→
Q
f
(
n
) =
1
n
2
6.
I
X
:
X
7→
X
I
X
(
x
) =
x
for all
x
∈
X
The identity function on
X
7.
C
:
P
(
{
r, g, b
}
)
7→
N
where
C
(
X
) =

X

8.
B
:
{
0
,
1
}
4
7→ {
0
,
1
}
where
B
(
x
1
, x
2
, x
3
, x
4
) = (
x
1
∨
x
2
)
∧ ∼
(
x
3
∧
x
4
)
1