One of the requirements that any function must fulfill (in order to be a function) is that any argument produces at most one value (in fact, exactly one value). Al-though advanced-level mathematics textbooks sometimes speak of “multiple-valued functions,” such terminology is restricted to highly specialized purposes, and may be ignored here. For our purposes (and for practically all of mathematics), no function can produce two different values for the same argument. If it does, it simply is not a function.
This requirement should not be confused with the possibility of different argu-ments producing the same value. This can, and does, happen quite often. That is to say, for a functionf: A → B, it may happen that two different arguments a1, a2both produce the same value, i.e.,f (a1)= f (a2).
For example, the functionf: R → R defined by f (x) = x2is a well-defined func-tion. In particular, for every real number argument there is exactly one value. But different arguments can lead to the same value: for instance,f (1) = f (−1) = 1.
If a functionf: A → B is such that it never happens that different arguments lead to the same value, we say thatf is one-one, or injective (or that f is an injection).
Thus,f is one-one if distinct inputs produce distinct outputs. In symbols:
f: A → B is one-one iff
(∀a, b ∈ A)[a = b → f (a) = f (b)]
Alternatively, we may express this condition using the contrapositive:
f: A → B is one-one iff
(∀a, b ∈ A)[f (a) = f (b) → a = b]
Notice that whether or not a function is one-one can depend critically on the do-main of that function (and not just on the rule). The functionf: R → R defined by f (x)= x2is not one-one (as observed above), but the functiong: R+→ R defined byg(x) = x2is one-one: any two distinct non-negative real arguments do produce distinct values. The rule used to definef and g is the same, but they differ in their domains.
Now let’s turn our attention to the codomain, the setB of “possible” values (or outputs) for a functionf: A → B. I enclosed the word “possible” in quotation marks just now for the following reason. The codomain is an integral part of the specifica-tion of a funcspecifica-tion (the output tray is an integral part of our black-box apparatus). But it is possible that not every element ofB is actually produced by the function (some of the space in the output trayB is not needed, the black box will never be able to fillB). If every member of B is in fact the value of the function at some argument (that is, if it is possible to fill trayB), we say f is onto, or surjective (or that f is a surjection).
In symbols, a functionf: A → B is onto iff
(∀b ∈ B)(∃a ∈ A)[f (a) = b]
Note the order of the quantifiers in the above condition. For everyb in B it must be possible to find ana in A such that f (a)= b.
For example, the functionf: R → R defined by f (x) = x2is not onto, since no negative real is the value of the function at any argument: the function only produces non-negative values. On the other hand, the functiong: R → R+ defined by the same formulag(x) = x2is onto, since every non-negative real is the value of the function at some argument. (What argument?)
A pre-image of an elementb∈ B for a function f : A → B is any a element of A for whichf (a)= b. For example, if f : R → R is defined by f (x) = x2+ 3, then 1 and−1 are both pre-images of 4.
Clearly, a functionf: A → B is one-one if each element of B has at most one pre-image underf . And f is onto if every element of B has a pre-image under f .
We illustrate the above notions by means of our original example of the rule de-termined by the equation
y= x2+ x + 1
This determines a functionf: R → R defined by f (x) = x2+ x + 1.
0.5
0 1
2
1 3
x y
Figure 4.3: Graph of the functiony= x2+ x + 1 for x ≥ 0.
Isf one-one? That is, can we find distinct reals x1andx2such thatf (x1)= f (x2) (in which case it will not be one-one), or is it the case that
(∀x1, x2∈ R)[x1 = x2→ f (x1) = f (x2)]
(in which case it will be one-one). A quick glance at Figure 4.1 shows us that f (−1) = f (0) = 1
Hencef: R → R is not one-one.
Isf onto? That is, does every element ofR occur as a value of f for some argu-ment? Again, Figure 4.1 provides the answer. The number 0 is never a value off . Indeed, no number less than 0.75 is a value off . Hence f: R → R is not onto.
The same equationy= x2+x+1 does however determine a function g : R+→ R.
The only difference between this function and the previous one is that our new func-tion has a different domain, namely the non-negative reals. (We are no longer allowed to input negative numbers into our “black box.”) The graph of this function is illus-trated in Figure 4.3.
The functiong: R+→ R so defined is clearly one-one. It is indeed increasing: if x1< x2, theng(x1) < g(x2). But it is still not onto, for 0 is not a value, and neither is any real number less than 1.
Finally, consider the functionh: R+→ A defined by the same formula h(x) = x2+ x + 1, but with the codomain
A= {x ∈ R | x ≥ 1}
This function is (clearly) both one-one and onto.
A function that is one-one and onto is sometimes called a bijection.
Let us now briefly review our definitions. A function from a non-empty setA to a setB is (determined by) a rule that associates with each element a of A a unique elementf (a) of B, called the value of f at a. We write f: A → B to indicate that f is a function fromA to B. The set A is the domain of f ; the set B is the codomain.
The elements ofA are called arguments of the function. In specifying a function, it is not enough to give the rule: the domain and codomain must also be given.
The functionf: A → B is one-one (or injective) if distinct arguments in A give rise to distinct values inB. And f is onto (or surjective) if every element of B is a value off for some argument. A function which is both one-one and onto is called a bijection.
Functions are also called mappings, maps, or transformations (although each of these words tends to be reserved for special kinds of functions).
Letf: A → B. If X ⊆ A, we call the set {f (x) | x ∈ X}
the range off on X. Thus the range of f on a subset X of the domain is the set of all values off for arguments taken from the set X. An alternative way to express this definition is as the set
{b ∈ B | (∃x ∈ X)(f (x) = b)}
The range off on X is denoted by
f[X]
We refer to the setf[A] simply as the range of f .
Clearly, an alternative definition of an onto function is one for which the range and the codomain coincide.
Exercises 4.4
(1) LetA= {1, 2}, B = {1, 2, 3}. List all the functions from A to B.
(2) Identify those functions in question (1) which are (a) one-one
(b) onto (c) bijective
In each case, identify the range of the function.
(3) For each of the functions listed in Section 4.2, say whether the function is one-one, onto, or both, and identify the range. Justify your answers.
(4) Letf: R → R be defined by f (x) = x2− 1.
(a) What is the value off at−10?
(b) What isf (−10)?
(c) What argument off is associated with value 80?
(d) What isf (80)?
(e) What is the image of 4 underf ? (f) What is a pre-image of 15?
(g) List all pre-images of 12.
(h) List all pre-images of−9.
(5) Definef: R → R by
f (x)=1
2(x+ |x|)
Evaluate f (0), f (1), f (2). Is f one-one? Is f onto? Justify your answers.
What is the range off on (a)R; (b) R+? (6) Which of the following functions are one-one?
(a) f: R → R, f (x) = 5x + 6 (b) f: R → R, f (x) = x3 (c) f: R → R × R, f (x) = (x, x) (d) f: R → R, f (x) =√
x
(e) f: Z × Z → Z, f (m, n) = m − n Which of these functions is onto?
(7) Definef: R → R by
f (x)=
x2+ 1 if x ≥ 0 x− 1 ifx < 0
Prove thatf is one-one. Is f onto? What is the range of f on (a)R; (b) R+?
(8) Definef: N → N by
f (n)=
2n ifn is even n ifn is odd Show thatf is one-one. Is f onto?
(9) LetA = {1, 3, 5, 7, . . .}, the set of odd natural numbers, and B = {2, 4, 6, 8, . . .}, the set of even natural numbers. Give examples of functions from A to B which are:
(a) One-one but not onto.
(b) Onto but not one-one.
(c) Neither one-one nor onto.
(d) One-one and onto.
(10) For each of your examples in the previous question, identify the range of the function on (a){1, 3, 5, 7} ; (b) A.
(11) Definef: N → N by f (n)=
2 ifn is not prime n ifn is prime
LetP be the set of all primes, K the set of all non-primes (inN ). Identify the setsf[N ], f [P ], f [K].
(12) Letf: A → B. Show that f is not one-one iff there are elements x, y ∈ A such thatx = y and f [{x, y}] has only one element.
(13) Definef: R → R by f (x) = x2+ x + 1. What is f [R]? What is f [R+]?
(14) Letf: N → N . Show that there is a set A ⊆ N such that h : A → N is one-one, where we define
h(n)= f (n) (∀n ∈ A)
Show further that there is a setB ⊆ N such that g : A → B is a bijection, where we define
g(n)= h(n) (∀n ∈ A)