« previous section | next section » |
If each element of the set X is associated with at most one element of the set Y, then we can say that the function from X to Y was defined. It can be noted shortly as: f : X → Y.
Mapping, transformation and correspondence are the terms that can be used interchangeably with the term function. If some function f associates the element x ∈ X with the element y ∈ Y, it can be noted as f(x) = y, where the element x is called the function's argument, and the element y is the function's value, or the image of the element x.
The set Dom(f) of those elements x to which the function f ascribes values is called the set of arguments or the function's domain. The set Im(f) of those y which are the values of the function is called the set of values or image or function's codomain.
Dom(f) = { x ∈ X : there is an y ∈Y such that f(x) = y}
Im(f) = { y ∈ Y : there is an x ∈ X such that f(x) = y}
Fig. 3.1.1 (a) The example of a function. (b) The graph of a relation which is not a function.
Example 3.1.1
f : A* → N
The function's f domain is A*, because the length is specified for every word (we assume length of empty word to be 0). The function's codomain is the set of natural numbers, since for every natural number n there is a word of this lenght in letters (elements of the set A).
Let us consider one more example of a well known function. Let suc denote mapping,
suc : N → N,
which assiociates a natural number with its immediate succesor suc(n) = n+1. Obviously, for each natural number there is a specified subsequent number suc(n): suc(0) = 1, suc(1) = 2, suc(2) = 3 etc. It seems, that similarly we could associate a given number with its predecessor, defining pred: N → N so that
pred(n) = n-1.
However, now the situation has changed slightly. The predecessor of 1 is 0, but what is the predecessor of 0 ? The mapping pred is not defined for the number 0. Such functions are called partial, as opposed to the total function like successor.
What we have said about functions so far leads to a conclusion that each function f : X → Y, determines a set of pairs (x, f(x)) such that no two pairs have the same predecessor. Such a view of the function leads to the following definition:
Definition 3.1.1
Let X and Y be some arbitrary sets. A binary relation f ⊆ X × Y we will be called a function transforming the set X into Y (denoted as f : X → Y) if, and only if for every x ∈ X there is at most one element y ∈ Y such that (x, y) ∈ f. If the pair (x,y) is in f, (x,y) ∈ f, then we note y = f(x).
If Dom(f) = X, then f is a total function. If Dom(f) ⊂ X, then f is a partial function.
Example 3.1.2
Fig. 3.1.2 The characteristic function of the interval [2,5].
Finite and infinite sequences are special cases of functions. Sequence is a function defined on a set of natural numbers N or its subset Nk (finite or not) of the form [k, k+1, k+2, k+3,..., k+i,...], where k is a fixed natural number and i ∈ N. If the domain of the sequence is an infinite set, then we call the sequence infinite, otherwise the sequence is finite.
If s : Nk → Y, then the value of the function s for the argument k+i is denoted by sk+i and we call it an i-th element (or the i-th term) of the sequence s. The number k+i its index. The sequence itself is usally presented in the form of a list (s k, s k+1, sk+2, s k+3,...) or shorter (sj) j ∈ Nk or, if the sequence is finite, in the form (sj) k ≤ j ≤ n .
Example 3.1.3
Fig. 3.1.3 Triangular numbers.
Similarly to relations, functions can be visualised as graphs, diagrams or tables. The picture 3.1.4(a) shows the diagram of the function f(x) = |x|,
f(x) = x dla x ≥ 0 and f(x) = -x dla x < 0,
defined in the set of real numbers and of the nonnegative values. Fig 3.1.4(b) pictures the function g mapping the set of real numbers into the set of real numbers, denoted as
g(x) = c wttw c is the samllest integer c ≥ x.
The domain of function g is a set of real numbers, and its codomain is a set of integer numbers. Function g is a so called step (staircase) function. Such a function is denoted with a symbol ⌈ x ⎤.
Fig 3.1.4(c),(d) shows the table of values, and the graph of the function h(x) = (x+2) mod 4 whose values are the remainders of division x+2 by 4.
Figure 3.1.4 (a) The diagram of the absolute value function |x|. (b) The diagram of the function entier ⌈ x ⎤. (c) The table of values for the function (x+2) mod 4, and (d) its diagram.
Question 3.1.1: Let f(x) = 2x be a function defined in the set {0, 1, 2, ...,10}. Determine the codomain of f.
Problem 3.1.1
Draw a diagram of the function f(x) = c where c is the greatest natural number not greater than |x| (the absolute value of x), for x ∈ R.
« previous section | next section » |