Discrete Mathematics for Computer Science

(Romina) #1
Basic Definitions 223

There is an obvious function:

NextDay: DayOfWeek -> DayOfWeek
Monday Tuesday
Tuesday Wednesday
Wednesday Thursday
Thursday Friday
Friday Saturday
Saturday Sunday
Sunday Monday

The binary relation defined by this function consists of the following ordered pairs:


{(Monday, Tuesday), (Tuesday, Wednesday), (Wednesday, Thursday),
(Thursday, Friday), (Friday, Saturday), (Saturday, Sunday),
(Sunday, Monday))

Example 9. The factorial function Fact from Example 5(b) is the set


{(0, 1), (1, 1), (2, 2), (3, 6), (4, 24), (5, 120). (n, n!)....

We now introduce a common vocabulary for functions.

Definition 2. Let F : X --* Y be a function, and let (x, y) E F. Then, y is the image of

x under F, denoted by y = F(x). We also say that x is mapped to y by F. The range of

F is the set

range(F) = {F(x) : x E X}

For y E Y, the preimage of y under F, denoted as F-^1 (y), is the set

F-l(y) = {x E X : F(x) = y}

For Y' C Y, the preimage of Y' under F, denoted as F^1 (Y'), is the set

F-'(Y') = {x e X : F(x) E Y'}

We refer to X as domain(F) and Y as codomain(F).


Example 10. For the function F : {1, 2, 3, 4, 5} --* {a, b, c, d, e} defined as F(l) =

a, F(2) = b, F(3) = b, F(4) = d, and F(5) = c, identify domain(F), codomain(F),


range(F), F-1(a), F-^1 ({a, b, c}), and F-^1 (e).

Solution. domain(F) = {1, 2, 3,4, 5}; codomain(F) = (a, b, c, d, ej; range(F) =


{a, b, c, dj; F-1(a) =- {1}; F-^1 ({a, b, c)) = {1, 2, 3, 5}; F-1(e) = 0. U

You may find the range of a function referred to as the image of the function. In
Example 4.1 a, the range of function SeatOf is the set of all chairs in the room that have
someone sitting on them. For another example, the addition function + on Z maps the


ordered pair (3, 5) to 8. The domain of + is Z x Z, and the codomain is Z. If F : X2 --* y;

then F is called a binary function from X^2 to Y. Addition as well as the other familiar
arithmetic operations defined on the integers are binary functions from Z2 to Z.

Free download pdf