chapter three functions - fredonia.edu three functions ... we study what is undoubtedly the most...

26
Chapter Three Functions 3.1 INTRODUCTION In this section, we study what is undoubtedly the most fundamental type of relation used in mathematics. Definition 3.1: Given sets X and Y ,a function from X to Y is a subset f of X × Y with the property that, for any x X, there exists a unique y Y such that (x, y) f . We denote the fact that f is a function from X to Y by writing f : X Y The set X is called the domain of the function f and is written dom f . The set Y is called the codomain of f . Also associated with f is a subset of Y called the image of f . This is denoted by im f and defined by im f = {y Y | there exists x X such that (x, y) f } If X = Y , then we call f a function on X. Example 3.1: Determine which of the following are functions and find the image of each function. (a) The subset f 0 of {1, 2, 3}×{1, 2, 3} given by f 0 = {(1, 2), (2, 3)}. (b) The subset f 1 of {1, 2, 3}×{1, 2, 3} given by f 1 = {(1, 2), (2, 1), (3, 2)}. (c) The subset f 2 of {1, 2, 3}×{1, 2, 3} given by f 2 = {(1, 1), (1, 3), (2, 3), (3, 1)}. (d) The subset f 3 of Z × Z defined by f 3 = {(m, n) | n is a multiple of m}. (e) The subset f 4 of Z × Z defined by f 4 = {(m, n) | n =2m +1}.

Upload: duongque

Post on 30-Mar-2018

213 views

Category:

Documents


0 download

TRANSCRIPT

Chapter Three

Functions

3.1 INTRODUCTION

In this section, we study what is undoubtedly the most fundamental type of relation used inmathematics.

Definition 3.1: Given sets X and Y , a function from X to Y is a subset f of X × Y with theproperty that, for any x ∈ X, there exists a unique y ∈ Y such that (x, y) ∈ f .

We denote the fact that f is a function from X to Y by writing

f : X → Y

The set X is called the domain of the function f and is written dom f . The set Y is called thecodomain of f . Also associated with f is a subset of Y called the image of f . This is denotedby im f and defined by

im f = {y ∈ Y | there exists x ∈ X such that (x, y) ∈ f}

If X = Y , then we call f a function on X.

Example 3.1: Determine which of the following are functions and find the image of each

function.

(a) The subset f0 of {1, 2, 3}× {1, 2, 3} given by f0 = {(1, 2), (2, 3)}.(b) The subset f1 of {1, 2, 3}× {1, 2, 3} given by f1 = {(1, 2), (2, 1), (3, 2)}.(c) The subset f2 of {1, 2, 3}× {1, 2, 3} given by f2 = {(1, 1), (1, 3), (2, 3), (3, 1)}.(d) The subset f3 of Z × Z defined by f3 = {(m, n) | n is a multiple of m}.(e) The subset f4 of Z × Z defined by f4 = {(m, n) | n = 2m + 1}.

138 Chapter 3 Functions

Solution:

(a) The subset f0 is not a function because there is no ordered pair in f0 of the form (3, y). Thisviolates the condition of the definition that, for each x ∈ {1, 2, 3}, there must exist a y ∈ {1, 2, 3}such that (x, y) ∈ f0.

(b) The subset f1 is a function on {1, 2, 3}; im f1 = {1, 2}.(c) The subset f2 is not a function on {1, 2, 3} because both (1, 1) ∈ f2 and (1, 3) ∈ f2. This

violates the condition of the definition that, for each x ∈ {1, 2, 3}, there should be a unique y ∈{1, 2, 3} for which (x, y) ∈ f2.

(d) The subset f3 is not a function on Z because, for instance, (2, 4) ∈ f3 and (2, 6) ∈ f3. Again,the definition says that, in order for f3 to be a function, there should be a unique y ∈ Z such that(2, y) ∈ f3, and we see that this is not the case.

(e) The subset f4 is a function on Z; im f4 is precisely the set of odd integers.

Suppose that f is a function from X to Y . Again, the condition of Definition 3.1 is the following:

For any x ∈ X, there exists a unique y ∈ Y such that (x, y) ∈ f.

We call y the image of x under f and write y = f(x). The notation f(x) is read “f of x.”Moreover, if y = f(x), then x is said to be a preimage of y under f . Thus, with this notation,we can restate the definition of the image of f as follows:

im f = {f(x) | x ∈ X}

It is also common to refer to y = f(x) as the value of f at x and to say that f maps x to y. (Afunction is sometimes called a mapping.)

One commonly defines a function by writing, “Define f : X → Y by y = f(x),” where y = f(x)is a formula that expresses y (uniquely) in terms of x. We call y = f(x) the defining formula ofthe function f . It can be viewed as a rule specifying how to compute the image of a given x ∈ X.

Example 3.2: Define f : Q+ → Q+ by f(x) = 1/x. This f is called the reciprocal function

(on Q+) since each positive rational number is mapped to its reciprocal. It is clear that f is afunction, since each positive rational number has a unique reciprocal. For example, f(2) = 1/2and f(2/3) = 1/(2/3) = 3/2. Also, each positive rational number is the reciprocal of its reciprocal,so that im f = Q+.

Example 3.3: Define g : R → Z by g(x) = bxc, where bxc denotes the largest integer that is less

than or equal to x. This g is called the greatest integer function or floor function . It isclear that g is a function since the process of “rounding down” a given real number x to the largestinteger m such that m ≤ x determines a unique m. For example, g(2) = 2, g(π) = 3, g(−2) = −2,and g(−π) = −4. Note that for each integer m, g(m) = m, so that im g = Z.

Example 3.4: Define l : R → Z by l(x) = dxe, where dxe denotes the smallest integer that is

greater than or equal to x. This l is called the least integer function or ceiling function . It

3.1 Introduction 139

is clear that l is a function since the process of “rounding up” a given real number x to thesmallest integer m such that x ≤ m determines a unique m. For example, l(2) = 2, l(π) = 4,l(−2) = −2, and l(−π) = −3. Note that for each integer m, l(m) = m, so that im l = Z.

Example 3.5: Define n : R → Z by n(x) = [x], where [x] denotes the integer that is nearest to

x. For example, n(2) = 2, n(π) = 3, n(−2) = −2, and n(−π) = −3. This n is called the nearest

integer function . But wait, you say (if you’ve been reading the section carefully): What, forexample, is the value of n(2.5)? Is it the case that n(2.5) = 2 or is n(2.5) = 3? This is a problem!If we want n to be a function with domain R, then n(2.5) must have some value; and, if we want nto be a function, then we can’t let n(2.5) have two different values. The common terminology for aproblem such as this is to say that the “function” n is not well-defined. To make n well-defined,we need a rule to insure that every real number has a unique image under n. One rule that iscommonly invoked is “break ties by rounding up;” that is, if there is a tie for the title of thenearest integer to x, then let n(x) = dxe. With this rule, for example, we have that n(2.5) = 3.Note that this rule can be made more precise as follows:

n

(

2m − 1

2

)

= m for any integer m.

Example 3.6: Define g : Z7 → Z7 by g(x) = 4x. Then g(0) = 0, g(1) = 4, g(2) = 1, g(3) = 5,

g(4) = 2, g(5) = 6, and g(6) = 3. (A remark: In (Zn, +, ·), for m ∈ Zn, mx = m · x; that is, onegets the same value whether one interprets mx as a multiple of x or as the product m · x. So wecan interpret mx in whichever way is more convenient.) Note that im g = Z7.

Example 3.7: Define h : Z6 → Z3 by h(x) = x mod 3. Then h(0) = 0, h(1) = 1, h(2) = 2,

h(3) = 3 mod 3 = 0, h(4) = 4 mod 3 = 1, and h(5) = 5 mod 3 = 2. So im h = Z3.

If f is a function whose domain and range are both subsets of the set R of real numbers, thenassociated with each ordered pair (x, y) ∈ f there is a uniquely determined point (x, y) in the xy-coordinate plane. In analytic geometry and calculus, the set of all points so determined is calledthe graph of f . No doubt you have had considerable experience with graphing functions.

Example 3.8: Sketch the graphs of the following functions.

(a) f : R → R; f(x) = 4 − 2x(b) g : (0,∞) → (0,∞); f(x) = 1/x(c) h : R → (−4,∞); h(x) = x2 − 2x − 3

140 Chapter 3 Functions

Solution: The graphs are shown in Figure 3.1.

Figure 3.1

If X and Y are subsets of R and a function f from X to Y is given, then the property that eachx ∈ X has a unique image under f can be interpreted geometrically. First of all, note that thisproperty is equivalent to the statement that the following implication holds for any x ∈ X and ally1, y2 ∈ Y :

[

(x, y1) ∈ f and (x, y2) ∈ f]

→ y1 = y2

This statement implies that every vertical line intersects the graph of f in at most one point. Thus,if we are given a set of points in the xy-coordinate plane, then we can determine whether theassociated set of ordered pairs is a function by applying this “vertical line test.”

Example 3.9: It is easy to apply the vertical line test to each of the graphs in Figure 3.1. Each

is seen to determine a function, as noted in the previous example. Figure 3.2 shows the graph ofthe subset {(x, y) | x = y2}. Note that any vertical line x = x0, where x0 > 0, intersects the graphof this subset in two points, namely, (x0,

√x0) and (x0,−

√x0). Thus, this subset fails the vertical

line test, and so it is not the graph of a function.�

3.1 Introduction 141

Figure 3.2

Exercise Set 3.1

1. Let S = {1, 2, 3, 4}. Determine which of the following subsets of S × S are functions on S, anddetermine the images of those that are.

(a) f1 = {(1, 2), (3, 4), (4, 1)} (b) f2 = {(1, 3), (2, 3), (3, 3), (4, 3)}(c) f3 = {(1, 1), (2, 2), (3, 3), (3, 4), (4, 4)} (d) f4 = {(1, 3), (2, 4), (3, 1), (4, 2)}

2. Let T denote your maternal family tree (T includes your (biological) mother, your maternalgrandmother, your maternal great-grandmother, and so on, and any children of these people).Determine which of the following subsets of T × T are functions.

(a) g1 = {(x, y) | y is the mother of x}(b) g2 = {(x, y) | x and y are sisters}(c) g3 = {(x, y) | y is an aunt of x}(d) g4 = {(x, y) | y is the eldest daughter of x’s maternal grandmother}

3. Graph each of the following subsets of R × R. Determine which are functions and find theimages of those that are.

(a) h1 = {(x, y) | 2x− y = 3} (b) h2 = {(x, y) | x2 + y = 4}(c) h3 = {(x, y) | (x − 1)2 + y2 = 9} (d) h4 = {(x, y) | y = −

√8 + 2x − x2 }

(e) h5 = {(x, y) | |x − y| = 2} (f) h6 = {(x, y) | (x2 + 1)y = 1}

4. Each part defines a function and gives a value x in the domain of the function and a value y inthe codomain of the function. You are to (1) find the image of x, (2) find the set of preimages ofy, and (3) determine the image of the function.

142 Chapter 3 Functions

(a) f : {1, 2, 3, 4, 5} → {1, 2, 3, 4}; f(1) = 2, f(2) = 4, f(3) = 1, f(4) = 4, f(5) = 2; x = 3,y = 4

(b) g : {2, 3, 4, 5, . . .} → set P of primes; g(x) =smallest prime factor of x; x = 91, y = 5(c) h1 : Z11 → Z11; h1(x) = 5x; x = 4, y = 3(d) h2 : Z12 → Z12; h2(x) = 4x; x = 4, y = 3(e) r : Z → Z5; r(x) = x mod 5; x = −12, y = 3(f) v : Z → Z; v(x) = gcd(x, 12); x = 30, y = 6

3.2 ONE-TO-ONE FUNCTIONS AND ONTO FUNCTIONS

Let f be a function from the set X to the set Y . Then each x ∈ X has a unique imagey = f(x) ∈ Y . However, it need not be the case that for each y ∈ Y there is a unique x ∈ X suchthat f(x) = y; that is, it is not necessarily true that every y ∈ Y has exactly one preimage. In fact, itmight happen that some y1 ∈ Y has no preimages, or it might happen that some y2 ∈ Y has at leasttwo preimages; that is, there could exist two distinct elements x1, x2 ∈ X with f(x1) = y2 = f(x2).For example, consider the function f : Z → Z defined by f(m) = 2m2 + 1. It is clear that f(m) isodd for all m ∈ Z; so, for instance, there is no m for which f(m) = 0. Moreover, f(−1) = 3 = f(1),and so 3 has both −1 and 1 as preimages.

Some functions f : X → Y satisfy the property that for each y ∈ Y there is at most one x ∈ Xsuch that f(x) = y ; that is, each y ∈ Y has at most one preimage under f . This condition may berephrased as follows:

For all x1, x2 ∈ X, if f(x1) = f(x2), then x1 = x2.

Definition 3.2: A function f : X → Y is called one-to-one provided that the followingimplication holds for all x1, x2 ∈ X:

f(x1) = f(x2) → x1 = x2

It is sometimes convenient to use the condition in Definition 3.2 in its contrapositive form:

For all x1, x2 ∈ X, x1 6= x2 → f(x1) 6= f(x2).

When is the function f : X → Y not one-to-one? Taking the negation of the condition inDefinition 3.2 yields the following statement:

f is not one-to-one if and only if, for some x1, x2 ∈ X, x1 6= x2 and f(x1) = f(x2)

Example 3.10: Determine which of the following functions are one-to-one.

(a) f1 : {1, 2, 3}→ {1, 2, 3, 4}; f1(1) = 2, f1(2) = 4, f1(3) = 2(b) f2 : {1, 2, 3}→ {1, 2, 3, 4}; f2(1) = 3, f2(2) = 4, f2(3) = 1(c) f : Z → Z; f(m) = m − 1(d) g1 : Z → Z; g1(m) = 3m + 1(e) h : Z → Z+; h(m) = |m|+1(f) p : Q − {1} → Q; p(x) = x/(1 − x)

3.2 One-to-One Functions and Onto Functions 143

Solution:

(a) The function f1 is not one-to-one since f1(1) = 2 = f1(3).(b) The function f2 is one-to-one since no two elements of {1, 2, 3} have the same image under

f2.(c) The function f maps each integer to its predecessor, and it is easily seen to be one-to-one.

To give a formal proof, note that, for any integers m1 and m2 ,

f(m1) = f(m2) → m1 − 1 = m2 − 1 → m1 = m2

(d) The function g1 is also one-to-one: For any integers m1 and m2,

g1(m1) = g1(m2) → 3m1 + 1 = 3m2 + 1 → 3m1 = 3m2 → m1 = m2

(e) Let’s see what happens if we try to prove that h is one-to-one. For arbitrary integers m1

and m2,h(m1) = h(m2) → |m1|+1 = |m2|+1 → |m1| = |m2|

However, the fact that |m1| = |m2| does not imply that m1 = m2, which leads us to suspect thath is not one-to-one. Indeed, if we let m1 = −1 and m2 = 1, then we see that h(−1) = 2 = h(1),which shows that h is not one-to-one.

(f) For x1, x2 ∈ Q − {1}, we have the following string of implications:

p(x1) = p(x2) →x1

1 − x1

=x2

1 − x2

→ x1(1 − x2) = x2(1 − x1)

→ x1 − x1x2 = x2 − x1x2

→ x1 = x2

This shows that p is a one-to-one function.

Suppose we have a function f : X → Y , where both the domain X and the codomain Y aresubsets of the set R of real numbers. Is there a way to determine from the graph of f whether fis one-to-one? Well, if f is not one-to-one, then there exist distinct elements x1, x2 ∈ X such thatf(x1) = f(x2). Letting y1 = f(x1), we have the two distinct points (x1, y1) and (x2, y1) that areboth on the graph of f and that are also both on the horizontal line y = y1. Conversely, if somehorizontal line intersects the graph of f in more than one point, then f is not one-to-one. Thisyields the “horizontal line test,” which is stated as follows:

f is one-to-one if and only if every horizontal line intersects the graph of f in at most one point

Example 3.11: Apply the horizontal line test to determine which of the functions defined in

Example 3.8 are one-to-one. (See Figure 3.1.)

144 Chapter 3 Functions

Solution:

(a) The function f : R → R defined by f(x) = 4− 2x is one-to-one by the horizontal line test.(b) The function g : (0,∞) → (0,∞) defined by g(x) = 1/x is also seen to be one-to-one.(c) The function h : R →

[

−4,∞) defined by h(x) = x2 − 2x − 3 fails the horizontal line test.For example, the line y = 0 (the x axis) intersects the graph in the points (−1, 0) and (3, 0). Thus,f is not one-to-one.

Please be cautioned that the horizontal line test, as well as the vertical line test mentioned inSection 3.1, apply only when both the domain and codomain of the function f under considerationare subsets of R.

Given a function f : X → Y , what can be said about im f? Having no specific informationabout f , all that can be said is that im f is a subset of Y . One extreme possibility is providedby the example g : X → Y defined by g(x) = y0, where y0 is a fixed element of Y . In this case,im f = {y0}, and g is called a constant function (the value of g is constant at y0). The otherextreme case is that of a function f : X → Y for which im f = Y .

Definition 3.3: A function f : X → Y is called onto provided im f = Y .�

Observe that a function f : X → Y is onto provided, for each y ∈ Y , there exists an x ∈ X suchthat f(x) = y. In other words, f is onto if and only if each y ∈ Y has at least one preimage underf . This condition provides a common method for proving that a given function f : X → Y is onto.We choose an arbitrary element y ∈ Y , set f(x) = y, and then attempt to solve this equation for xin terms of y. If a solution x exists and is in X, then f is onto. On the other hand, if for somey ∈ Y there is no solution x ∈ X to the equation f(x) = y, then f is not onto. This method isillustrated in the next example.

Example 3.12: Determine which of the following functions are onto.

(a) h1 : {1, 2, 3, 4}→ {1, 2, 3}; h1(1) = 2, h1(2) = 3, h1(3) = 2, h1(4) = 3(b) h2 : {1, 2, 3, 4}→ {1, 2, 3}; h2(1) = 3, h2(2) = 1, h2(3) = 2, h2(4) = 1(c) f : Z → Z; f(m) = m − 1(d) g1 : Z → Z; g1(m) = 3m + 1(e) h : Z → Z+; h(m) = |m|+1(f) p : Q − {1} → Q; p(x) = x/(1 − x)(g) g2 : Q → Q; g2(x) = 3x + 1

Solution:

(a) The function h1 is not onto since im h1 = {2, 3} 6= {1, 2, 3}.(b) The function h2 is onto since im h2 = {1, 2, 3}, the codomain of h2.(c) The function f is onto since, for any m ∈ Z,

f(m + 1) = (m + 1) − 1 = m

3.2 One-to-One Functions and Onto Functions 145

(d) Note thatim g1 = {3m + 1 | m ∈ Z} = {. . . ,−5,−2, 1, 4, 7, . . .}

Since im g1 6= Z, g1 is not onto.(e) For n ∈ Z+,

h(m) = n ↔ |m|+1 = n

↔ |m| = n − 1

↔ m = n − 1 or m = 1 − n

Thus, each n ≥ 2 is the image of two integers, namely, n − 1 and 1 − n. Also, 1 is the image of 0.This shows that h is onto.

(f) For y ∈ Q,

p(x) = y ↔ x

1− x= y

↔ x = y − xy

↔ x + xy = y

↔ x(1 + y) = y

↔ x =y

1 + y

Thus, if y 6= −1, then x = y/(1 + y) ∈ Q − {1} and p(x) = y. However, there does not existx ∈ Q − {1} such that p(x) = −1. Therefore, im p = Q − {−1}, and the function p “just misses”being onto.

(g) Note that the function g2 has the same rule as the function g1 of part (d), but the domainand codomain have been changed from Z to Q. Let’s see what happens. Let y ∈ Q; we wish tofind x ∈ Q such that g2(x) = y. Now,

g2(x) = y ↔ 3x + 1 = y ↔ x =y − 1

3

This shows that g2 is onto; for each rational number y, the image of the rational number x = (y−1)/3is y. This example illustrates the important point that whether a given function is onto dependsnot only on the defining formula of the function, but on the domain and codomain as well.

We have seen examples of functions that are one-to-one and not onto, and the reverse possibility,functions that are onto but not one-to-one. Under what conditions does the existence of onecondition imply the other? One very important case is supplied by the following theorem.

Theorem 3.1: Let X and Y be nonempty finite sets and let f be a function from X to Y .

1. If f is one-to-one, then |X| ≤ |Y |.2. If f is onto, then |X| ≥ |Y |.3. If f is one-to-one and onto, then |X| = |Y |.4. If |X| = |Y |, then f is one-to-one if and only if f is onto. (That is, if |X| = |Y |, then either

f is both one-to-one and onto, or f is neither one-to-one nor onto.)

146 Chapter 3 Functions

Proof: We prove part 4. You are asked to prove parts 1 and 2 in Exercise 14; note that part 3follows immediately from parts 1 and 2.

For part 4, let |X| = |Y | = n; assume X = {x1, x2, . . . , xn}. Under this assumption, we mustprove the following two implications:

(1) If f is one-to-one, then f is onto.(2) If f is onto, then f is one-to-one.To prove (1), assume f is one-to-one. Note that the image of f is the set

im f = {f(x) | x ∈ X} = {f(x1), f(x2), . . . , f(xn)}

Suppose f(xi) = f(xj) for some i and j. Since f is one-to-one, f(xi) = f(xj) implies that xi = xj,and hence that i = j. This shows that f(x1), f(x2), . . ., f(xn) are distinct elements of Y . Thus,we have both im f ⊆ Y and |im f | = |Y |. We may conclude that im f = Y , thus proving that f isonto.

To prove (2), assume that f is onto. Then im f = Y . Thus, {f(x1), f(x2), . . . , f(xn)} = Y and|Y | = n, so it follows that f(x1), f(x2), . . ., f(xn) are distinct elements. Hence, xi 6= xj impliesthat f(xi) 6= f(xj), which shows that f is one-to-one.

Theorem 3.1, part 3, is often applied to prove that two finite sets X and Y have the samecardinality. To show that |X| = |Y |, it suffices, by Theorem 3.1, part 3, to construct a one-to-oneand onto function from X to Y . This may seem like a rather roundabout way to do things, but itis often quite enlightening. Such a proof is called a “bijective proof,” and several examples of suchproofs are given in Chapter 5.

The following example illustrates the application of Theorem 3.1, part 4.

Example 3.13: Consider the function f : Z30 → Z30 defined by f(x) = 7x. Let x1, x2 ∈ Z30;

the following steps show that f is one-to-one:

f(x1) = f(x2) → 7x1 = 7x2

→ 7x1 mod 30 = 7x2 mod 30

→ 30 | (7x1 − 7x2) (by Theorem 2.6)

→ 30 |[

7(x1 − x2)]

→ 30 | (x1 − x2) (since gcd(7, 30) = 1)

→ x1 mod 30 = x2 mod 30 (by Theorem 2.6)

→ x1 = x2

We now obtain that f is onto with no additional work; we simply apply Theorem 3.1, part 4!�

It should be emphasized that to apply Theorem 3.1, part 4, to a function f , the domain andcodomain of f must be finite sets with the same cardinality. For example, define f and g on Z byf(m) = 2m and g(m) = bm/2c. It can then be checked that f is one-to-one but not onto, whereasg is onto but not one-to-one. (Remember, the set Z is an infinite set!)

Now let X = {x1, x2, . . . , xn} and suppose that f : X → X is a one-to-one function. Then itfollows that the n-tuple (f(x1), f(x2), . . . , f(xn)) is simply an ordered arrangement of the elements

3.2 One-to-One Functions and Onto Functions 147

of X. Indeed, in this sense any one-to-one and onto function on a set can be regarded as selectingthe elements of the set in some order, or “permuting” the elements of the set.

Definition 3.4: Let X and Y be nonempty sets. A function f : X → Y that is both one-to-oneand onto is called a bijection from X to Y . If X = Y , then f is called a permutation of X.

Example 3.14: Define the function f on {1, 2, 3, 4} by f(1) = 3, f(2) = 2, f(3) = 4, and

f(4) = 1. It is easily checked that f is one-to-one and onto, and so f is a permutation of{1, 2, 3, 4}; note that (f(1), f(2), f(3), f(4)) = (3, 2, 4, 1). Consider again the functions inExamples 3.10 and 3.12. The function f : Z → Z defined by f(m) = m − 1 is a permutation of Z.In Example 3.12, part (g), we showed that the function g2 : Q → Q defined by g2(x) = 3x + 1 isonto. It can also be shown that g2 is one-to-one. Therefore, g2 is a permutation of Q. Lastly,consider the function p of part (f); if we modify the function p by changing its codomain toQ − {−1}, that is, if we define p : Q − {1} → Q − {−1} by p(x) = x/(1− x), then p is a bijectionfrom Q − {1} to Q − {−1}.

Suppose now that f is a function from X to Y ; recall that im f = {f(x) | x ∈ X}. It seemsnatural to write im f = f(X). More generally, for any subset A of X, we define the image of Aunder f to be the set

f(A) = {f(x) | x ∈ A}Similarly, for any subset B of Y , it is helpful to be able to easily refer to the set of preimages ofelements of B. Formally, we define the preimage (or inverse image) of B under f to be theset

f−1(B) = {x ∈ X | f(x) ∈ B}Symbolically, note that, for y ∈ Y ,

y ∈ f(A) ↔ ∃x ∈ A(y = f(x))

and for x ∈ X,x ∈ f−1(B) ↔ f(x) ∈ B

Example 3.15: Define f : {1, 2, 3, 4, 5, 6, 7}→ {1, 2, 3, 4, 5} by f(1) = 2 = f(3) = f(6), f(2) = 1,

f(4) = 5 = f(7), and f(5) = 4. Let

A1 = {1, 2, 3, 4}, A2 = {2, 3, 7}, B1 = {2, 4}, B2 = {3, 4, 5}

Find each of the following:

(a) f(A1 ∪ A2) (b) f(A1) ∪ f(A2)(c) f−1(B1 ∪B2) (d) f−1(B1) ∪ f−1(B2)(e) f(A1 ∩ A2) (f) f(A1) ∩ f(A2)(g) f−1(B1 ∩ B2) (h) f−1(B1) ∩ f−1(B2)(i) f(A1 − A2) (j) f(A1) − f(A2)(k) f−1(B1 − B2) (l) f−1(B1) − f−1(B2)

148 Chapter 3 Functions

Solution: For part (a) we have the following:

f(A1 ∪ A2) = f({1, 2, 3, 4}∪ {2, 3, 7}) = f({1, 2, 3, 4, 7}) = {1, 2, 5}

And for part (b) we obtain:

f(A1) ∪ f(A2) = f({1, 2, 3, 4})∪ f({2, 3, 7}) = {1, 2, 5}∪ {1, 2, 5} = {1, 2, 5}

Note that f(A1 ∪ A2) = f(A1) ∪ f(A2).

For parts (c) and (d) we obtain the following:

f−1(B1 ∪ B2) = f−1({2, 4} ∪ {3, 4, 5}) = f−1({2, 3, 4, 5}) = {1, 3, 4, 5, 6, 7}f−1(B1) ∪ f−1(B2) = f−1({2, 4})∪ f−1({3, 4, 5}) = {1, 3, 5, 6}∪ {4, 5, 7} = {1, 3, 4, 5, 6, 7}

Note that f−1(B1 ∪ B2) = f−1(B1) ∪ f−1(B2).For parts (e) and (f) we have:

f(A1 ∩ A2) = f({1, 2, 3, 4}∩ {2, 3, 7}) = f({2, 3}) = {1, 2}f(A1) ∩ f(A2) = f({1, 2, 3, 4})∩ f({2, 3, 7}) = {1, 2, 5}∩ {1, 2, 5} = {1, 2, 5}

Here we see that f(A1 ∩A2) 6= f(A1)∩ f(A2), although it is the case that f(A1 ∩A2) is a subset off(A1) ∩ f(A2).

Computing the sets for parts (g) and (h) we find that:

f−1(B1 ∩ B2) = f−1({2, 4} ∩ {3, 4, 5}) = f−1({4}) = {5}f−1(B1) ∩ f−1(B2) = f−1({2, 4})∩ f−1({3, 4, 5}) = {1, 3, 5, 6}∩ {4, 5, 7} = {5}

Thus, we see that f−1(B1 ∩ B2) and f−1(B1) ∩ f−1(B2) are equal in this example.Next, for parts (i) and (j), observe that:

f(A1 − A2) = f({1, 2, 3, 4}− {2, 3, 7}) = f({1, 4}) = {2, 5}f(A1) − f(A2) = f({1, 2, 3, 4})− f({2, 3, 7}) = {1, 2, 5}− {1, 2, 5} = ∅

So f(A1−A2) and f(A1)−f(A2) are not equal in this example, although it is true that f(A1)−f(A2)is a subset of f(A1 − A2).

Finally, for parts (k) and (l) we find that:

f−1(B1 − B2) = f−1({2, 4} − {3, 4, 5}) = f−1({2}) = {1, 3, 6}f−1(B1) − f−1(B2) = f−1({2, 4})− f−1{3, 4, 5} = {1, 3, 5, 6}− {4, 5, 7} = {1, 3, 6}

So, it turns out that f−1(B1 − B2) = f−1(B1) − f−1(B2) in this case.

Example 3.16: Let g be the permutation of Q defined by g(x) = 3x + 1. Find the following

images and preimages.

(a) g(Z) (b) g(2Z)(c) g−1(Z+) (d) g−1(2Z)

3.2 One-to-One Functions and Onto Functions 149

Solution:

(a) For m ∈ Z, g(m) = 3m + 1. Thus,

g(Z) = {3m + 1 | m ∈ Z} = {. . . ,−5,−2, 1, 4, 7, . . .}that is, g(Z) is the set of integers that yield a remainder of 1 when divided by 3, namely, 1 + 3Z.

(b) Here we find that

y ∈ g(2Z) ↔ y = g(2m) (for some m ∈ Z)

↔ y = 3(2m) + 1

↔ y = 6m + 1

Hence, g(2Z) = {6m + 1 | m ∈ Z} = {. . . ,−11,−5, 1, 7, 13, . . .} = 1 + 6Z.(c) For this part we have that

x ∈ g−1(Z+) ↔ g(x) ∈ Z+

↔ 3x + 1 = n (for some n ∈ Z+)

↔ x =n − 1

3

It follows that

g−1(Z+) = {(n − 1)/3 | n ∈ Z+} ={

0,1

3,

2

3, 1,

4

3,

5

3, 2, . . .

}

(d) Proceeding in a similar manner for this part, we find that:

x ∈ g−1(2Z) ↔ g(x) ∈ 2Z

↔ 3x + 1 = 2m + 1 (for some m ∈ Z)

↔ x =2m

3

It follows that

g−1(2Z) = {2m/3 | m ∈ Z} =

{

. . . ,−4

3,−2

3, 0,

2

3,

4

3, . . .

}

Example 3.15 illustrates some of the general properties of images and preimages with respect tothe set operations of union, intersection, and difference. These properties, along with two others,are listed in the following theorem.

Theorem 3.2: Given f : X → Y , let A1 and A2 be subsets of X and let B1 and B2 be subsetsof Y . Then the following properties hold:

1. (a) f(A1 ∪A2) = f(A1) ∪ f(A2)(b) f−1(B1 ∪ B2) = f−1(B1) ∪ f−1(B2)

2. (a) f(A1 ∩A2) ⊆ f(A1) ∩ f(A2)(b) f−1(B1 ∩ B2) = f−1(B1) ∩ f−1(B2)

3. (a) f(A1) − f(A2) ⊆ f(A1 − A2)(b) f−1(B1) − f−1(B2) = f−1(B1 − B2)

4. (a) If A1 ⊆ A2, then f(A1) ⊆ f(A2).(b) If B1 ⊆ B2, then f−1(B1) ⊆ f−1(B2).

150 Chapter 3 Functions

Proof: We prove 1(a) and 3(b), and leave the remaining parts for you to prove in Exercise 2.

To show that f(A1 ∪ A2) = f(A1) ∪ f(A2), we show that each side is a subset of the other. Ify ∈ f(A1 ∪ A2), then there is some x ∈ A1 ∪ A2 such that y = f(x). This element x is such thatx ∈ A1 or x ∈ A2. If x ∈ A1, then y = f(x) ∈ f(A1). Similarly, if x ∈ A2, then y ∈ f(A2). Hence,y ∈ f(A1) or y ∈ f(A2), that is, y ∈ f(A1) ∪ f(A2). This shows that f(A1 ∪ A2) ⊆ f(A1) ∪ f(A2).To show the reverse inclusion, suppose y ∈ f(A1) ∪ f(A2). Then y ∈ f(A1) or y ∈ f(A2). Thismeans that y = f(x), where x ∈ A1 or x ∈ A2. Thus, x ∈ A1∪A2, which shows that y ∈ f(A1∪A2).Therefore, f(A1) ∪ f(A2) ⊆ f(A1 ∪ A2), and this completes the proof of this part.

The proof that f−1(B1)−f−1(B2) = f−1(B1 −B2) is easily done using a string of biconditionalsas follows:

x ∈ f−1(B1) − f−1(B2) ↔ x ∈ f−1(B1) and x /∈ f−1(B2)

↔ f(x) ∈ B1 and f(x) /∈ B2

↔ f(x) ∈ B1 − B2

↔ x ∈ f−1(B1 − B2)

Therefore, f−1(B1) − f−1(B2) = f−1(B1 − B2).�

Exercise Set 3.2

1. Each part gives a function; determine whether it is one-to-one.

(a) f : Z → Z+; f(m) = m2 + 1(b) g : Q → Q; g(x) = x3

(c) h : R → R; h(x) = x3 − x(d) p : Q → R; p(x) = 2x

(e) the “cardinality function” k from P({1, 2, . . . , n}) (where n is a fixed positive integer) to{0, 1, . . . , n}; k(X) = |X|

(f) the “complement function” c on P({1, 2, . . . , n}) (where n is a fixed positive integer); c(X) =X

2. Prove the remaining parts of Theorem 3.2:

(a) part 1(b) (b) part 2(a)(c) part 2(b) (d) part 3(a)(e) part 4(a) (f) part 4(b)

3. For each of the functions in Exercise 1, determine whether it is onto.

4. List all the one-to-one functions from {1, 2} to {1, 2, 3, 4}. (Note: A function with domain{1, 2, . . . , n} may be specified by giving its images in a list: (f(1), f(2), . . . , f(n)).)

5. Each part gives sets X and Y and a function from X to Y . Determine whether the function isone-to-one.

(a) X = {1, 2, 3, 4}, Y = {1, 2, 3}; f1(1) = 2, f1(2) = 3, f1(3) = 1 = f1(4)(b) X = {1, 2, 3}, Y = {1, 2, 3, 4}; f2(1) = 3, f2(2) = 2, f2(3) = 1(c) X = Y = {1, 2, 3, 4}; f3(1) = 2 = f3(3), f3(2) = 1 = f3(4)(d) X = Y = {1, 2, 3, 4}; f4(1) = 3, f4(2) = 4, f4(3) = 1, f4(4) = 2(e) X = Y = Z; f5(m) = −m

3.2 One-to-One Functions and Onto Functions 151

(f) X = Y = Z;

f6(m) =

{

3m if m < 0

2m if m ≥ 0

(g) X = Y = Z+;

f7(n) =

{

(n + 1)/2 if n is odd

n/2 if n is even

(h) X = Y = Z+;

f8(n) =

{

n + 1 if n is odd

n − 1 if n is even

6. List all the functions from {1, 2, 3, 4} onto {1, 2}.7. For each of the functions in Exercise 5, determine whether it is onto.

8. Each part gives a set; list the permutations of that set.

(a) {1}(b) {1, 2}(c) {1, 2, 3}

9. Each part gives a function; determine whether it is one-to-one.

(a) f1 : Z10 → Z10; f1(x) = 3 · x (b) f2 : Z10 → Z10; f2(x) = 5 · x(c) f3 : Z36 → Z36; f3(x) = 3 · x (d) f4 : Z36 → Z36; f4(x) = 5 · x(e) f5 : Z10 → Z10; f5(x) = x + 5 (f) f6 : Z10 → Z10; f6(x) = (3 · x) + 5(g) f7 : Z12 → Z; f7(x) = 2 · x (h) f8 : Z8 → Z12; f8(x) = 3 · x(i) f9 : Z6 → Z12; f9(x) = 2 · x (j) f0 : Z12 → Z36; f0(x) = 6 · x

10. Let n be a positive integer and let k ∈ Zn. Define f : Zn → Zn by f(x) = k · x. Give anecessary and sufficient condition on k for f to be a permutation of Zn.

11. For each of the functions in Exercise 9, determine whether it is onto.

12. Each part gives a function on Z12. You are to determine whether the function is apermutation. Also, find the image of A = {1, 5, 7, 11} and the preimage of B = {4, 8}.

(a) f1(x) = 2 · x (b) f2(x) = 4 · x(c) f3(x) = 5 · x (d) f4(x) = x + 5

13. Give an example of a function on Z+ that is:

(a) neither one-to-one nor onto (b) one-to-one but not onto(c) onto but not one-to-one (d) both one-to-one and onto

14. Prove Theorem 3.1:

(a) part 1 (b) part 2

15. Give an example of a function on (the closed interval)[

−1, 1]

that is:

(a) neither one-to-one nor onto (b) one-to-one but not onto(c) onto but not one-to-one (d) both one-to-one and onto

152 Chapter 3 Functions

16. Let X and Y be nonempty sets and let f be a function from X to Y . Complete each of thefollowing statements by inserting the correct relation: ≤, ≥, or =.

(a) f is one-to-one if and only if |f−1({y})| 1 for every y ∈ Y .(b) f is onto if and only if |f−1({y})| 1 for every y ∈ Y .(c) f is a bijection if and only if |f−1({y})| 1 for every y ∈ Y .

17. Each of the following parts refers to the function defined in the corresponding part of Exercise5. You are given a subset A of X and a subset B of Y ; find the image of A and the preimage of B.

(a) A = {1, 2} = B (b) A = {1, 3}, B = {2, 4}(c) A = {1, 3}, B = {1} (d) A = {2} = B(e) A = 2Z, B = Z+ (f) A = Z+, B = 2Z

(g) A = B = 2Z+ (h) A = B = 2Z+

3.3 INVERSE FUNCTIONS AND COMPOSITION

Let X and Y be nonempty sets and f be a function from X to Y . Suppose that f is a bijection(that is, f is both one-to-one and onto). Since f is onto, given any y ∈ Y , there is an elementx ∈ X such that f(x) = y. Moreover, since f is one-to-one, this element x is uniquely determined.Thus, for each y ∈ Y , there is exactly one x ∈ X such that y = f(x). (See Exercise 16 in ExerciseSet 3.2.) We can then define a new function g : Y → X as follows: For y ∈ Y ,

g(y) = x if and only if f(x) = y

In other words, g(y) is that unique element x ∈ X for which f(x) = y.

Definition 3.5: Let f : X → Y be a bijection. The function g : Y → X defined by

g(y) = x if and only if f(x) = y

is called the inverse function of f and is denoted by f−1 .�

The situation of a function f : X → Y and its inverse function g = f−1 : Y → X is depictedin Figure 3.3, where f(x0) = y0. In this situation, suppose that B is a subset of Y . At this pointin our discussion of functions, we have two possible interpretations for the notation f−1(B): one isthat f−1(B) denotes the preimage of B under f , and the other is that f−1(B) denotes the image ofB under f−1 . In Exercise 2, you are asked to show that these two sets are, in fact, the same, andso there is no problem. It should be pointed out, however, that if f is not a bijection, then f−1(B)can mean only the preimage of B under f .

Theorem 3.3: If f : X → Y is a bijection, then the inverse function f−1 : Y → X is also abijection.

Proof: We first show that f−1 is one-to-one. Suppose f−1(y1) = x = f−1(y2) for some y1, y2 ∈ Yand x ∈ X. Then, by definition, y1 = f(x) and y2 = f(x). Since f is a function, x has a uniqueimage under f , and it follows that y1 = y2. Thus, f−1 is one-to-one.

3.3 Inverse Functions and Composition 153

Figure 3.3 A function and its inverse

Next we show that f−1 is onto. Let x ∈ X, and let y = f(x). Then, by the definition of f−1,it follows that x = f−1(y). This shows that any x ∈ X has a preimage under f−1, and so f−1 isonto.

Corollary 3.4: Let X be a nonempty set. If f is a permutation of X, then f−1 is also a

permutation of X.�

Example 3.17: Define f : {1, 2, 3, 4, 5}→ {1, 2, 3, 4, 5} by f(1) = 3, f(2) = 4, f(3) = 5,

f(4) = 1, and f(5) = 2, that is, f is the permutation (3, 4, 5, 1, 2) of {1, 2, 3, 4, 5}. Find f−1.

Solution: Since f(1) = 3, we know that f−1(3) = 1. Similarly, f−1(4) = 2, f−1(5) = 3,f−1(1) = 4, and f−1(2) = 5. Therefore, f−1 : {1, 2, 3, 4, 5}→ {1, 2, 3, 4, 5} is defined by

f−1(1) = 4, f−1(2) = 5, f−1(3) = 1, f−1(4) = 2, f−1(5) = 3

that is, f−1 is the permutation (4, 5, 1, 2, 3) of {1, 2, 3, 4, 5}.�

If f : X → Y is a bijection, how do we find its inverse function? For example, given f : Q → Q

defined by f(x) = 3x + 1, let’s attempt to find f−1. Given y ∈ Q, we want to find x ∈ Q such thatf−1(y) = x. This means that y = f(x), so that y = 3x + 1. Solving for x we obtain x = (y − 1)/3.Thus, f−1 : Q → Q is defined by

f−1(y) =y − 1

3

154 Chapter 3 Functions

In general, given a bijection y = f(x), we solve for x in terms of y to obtain

x = f−1(y)

Example 3.18: We saw previously that the function p : Q − {1} → Q − {−1}, defined by

p(x) = x/(1 − x), is a bijection. Find p−1.

Solution: If y ∈ Q − {−1} and p−1(y) = x, where x ∈ Q − {1}, then p(x) = y. We then proceedalgebraically as follows:

x

1 − x= y ↔ x = y − xy ↔ x + xy = y ↔ x(1 + y) = y ↔ x =

y

1 + y

Therefore, p−1 : Q − {−1} → Q − {1} is given by

p−1(y) =y

1 + y

Example 3.19: We saw in Example 3.13 that the function f : Z30 → Z30 defined by f(x) = 7x

is a permutation of Z30. Find f−1.

Solution: If y ∈ Z30 and f−1(y) = x, where x ∈ Z30, then f(x) = y, that is, 7x = y. We want tosolve this equation for x. We do this by multiplying both sides of the equation by the reciprocal of7 in Z30 (since gcd(7, 30) = 1, the element 7 has a reciprocal in Z30):

7 · x = y ↔ 7−1 · (7 · x) = 7−1 · y ↔ (7−1 · 7) · x = 7−1 · y ↔ 1 · x = 7−1 · y ↔ x = 7−1 · y

Thus, f−1 : Z30 → Z30 is defined by f−1(y) = 7−1 · y. To complete the problem, we need to find7−1. Recall that this can be done by using the extended Euclidean algorithm. Using thisalgorithm, we find that

1 = 7(13) + 30t

for some integer t. Therefore, 7−1 = 13, and so f−1(y) = 13 · y.�

There are various ways in which two functions may be combined to produce a third function.One of the more common and important operations on functions is called composition. Suppose fis a function from X to Y and g is a function from Y to Z. For any x ∈ X, there is a unique y ∈ Ysuch that y = f(x). Then, for this element y, there is a unique z ∈ Z such that z = g(y) = g(f(x)).Hence, for each x ∈ X, there is associated a unique element z ∈ Z, namely, z = g(f(x)). Thisassociation allows us to define a new function h : X → Z by h(x) = g(f(x)). This situation isdepicted in Figure 3.4.

3.3 Inverse Functions and Composition 155

Figure 3.4 Composition of functions

Definition 3.6: Given f : X → Y and g : Y → Z, the composition of f followed by g (orcomposite function) is the function g ◦ f : X → Z defined by

(g ◦ f)(x) = g(f(x))

Example 3.20: Define f : Z → 2Z by f(m) = 2m, and define g : 2Z → Z+ by g(m) = |m|/2 + 1.

Then g ◦ f : Z → Z+ is given by

(g ◦ f)(m) = g(f(m)) = g(2m) =|2m|

2+ 1 = |m|+1

Example 3.21: Define f : Q − {0} → Q − {1} by f(x) = (x + 1)/x and g : Q − {1} → Q − {2}by g(x) = 3x − 1. Then g ◦ f : Q − {0} → Q − {2} is given by

(g ◦ f)(x) = g(f(x)) = g

(

x + 1

x

)

= 3

(

x + 1

x

)

− 1

=3(x + 1)

x− x

x

=2x + 3

x

156 Chapter 3 Functions

Example 3.22: Define f : Z → Z by f(m) = m + 3 and g : Z → Z by g(m) = −m. Then

f ◦ g : Z → Z is given by

(f ◦ g)(m) = f(g(m)) = f(−m) = −m + 3

whereas g ◦ f : Z → Z is given by

(g ◦ f)(m) = g(f(m)) = g(m + 3) = −(m + 3) = −m − 3

Note that f ◦ g 6= g ◦ f ; also note that f , g, f ◦ g, and g ◦ f are all permutations of Z.�

Let f and g be two functions from X to Y . When is it the case that f = g? Since f and g arefunctions, each is a subset of X × Y , and we already know when two sets are equal. Thus, we saythat f = g provided the condition

f(x) = g(x)

holds for every x ∈ X.There are several interesting results that involve composition of functions and the properties

onto and one-to-one. For example, suppose f : X → Y is a bijection; then f−1 : Y → X exists.Given x ∈ X with f(x) = y, we have that f−1(y) = x and, hence, f−1(f(x)) = x. So the compositefunction f−1 ◦f : X → X satisfies the property (f−1 ◦f)(x) = x for all x ∈ X. In a similar fashion,we can determine that f ◦ f−1 : Y → Y satisfies the condition (f ◦ f−1)(y) = y for every y ∈ Y .Note that both of f ◦ f−1 and f−1 ◦ f are functions of the type h : A → A, where h(a) = a for alla ∈ A.

Definition 3.7: For any nonempty set A, the function iA : A → A defined by

iA(a) = a

is called the identity function on A.�

In view of the preceding discussion, if f : X → Y is a bijection, then f−1 ◦ f = iX andf ◦ f−1 = iY . A very basic and easily verified property of identity functions is contained in thefollowing theorem, whose proof is left to Exercise 4.

Theorem 3.5: Let X and Y be nonempty sets. For any function f : X → Y ,

iY ◦ f = f and f ◦ iX = f

Theorem 3.6: Given f : X → Y and g : Y → Z, the following properties hold:

1. If f and g are both one-to-one, then g ◦ f is one-to-one.2. If f and g are both onto, then g ◦ f is onto.

Proof: We prove part 2; you are asked to prove part 1 in Exercise 6.

3.3 Inverse Functions and Composition 157

Assume f and g are both onto. To prove that g ◦ f is onto, we begin with an arbitrary elementz0 ∈ Z. Since g is onto, there is an element y0 ∈ Y such that g(y0) = z0. Then, since y0 ∈ Y andf is onto, there is some element x0 ∈ X such that f(x0) = y0. Thus,

(g ◦ f)(x0) = g(f(x0)) = g(y0) = z0

and it follows that g ◦ f is onto.�

Corollary 3.7: If f : X → Y and g : Y → Z are both bijections, then the function

g ◦ f : X → Z is also a bijection. In particular, if X = Y = Z so that f and g are bothpermutations of X, then g ◦ f is a permutation of X.

For each of the statements in Theorem 3.6, the converse is false (see Exercises 8 and 10). However,a partial converse does hold.

Theorem 3.8: Given f : X → Y and g : Y → Z, the following properties hold:

1. If g ◦ f is one-to-one, then f is one-to-one.2. If g ◦ f is onto, then g is onto.

Proof: We prove part 1; you are asked to prove part 2 in Exercise 12.

Assume g ◦ f is one-to-one, and suppose that f(x1) = f(x2) for some x1, x2 ∈ X. Then, sincef(x1) ∈ Y , we have g(f(x1)) = g(f(x2)), that is, (g ◦ f)(x1) = (g ◦ f)(x2). Then, since g ◦ f isone-to-one, it may be concluded that x1 = x2. Therefore, f is one-to-one.

Given functions f : A → B, g : B → C, and h : C → D, notice that h ◦ g is a function from Bto D and that g ◦ f is a function from A to C. Thus, (h ◦ g) ◦ f and h ◦ (g ◦ f) are both functionsfrom A to D. In fact, they are equal functions. In other words, the associative property holds forcomposition of functions.

Theorem 3.9: Given f : A → B, g : B → C, and h : C → D, the following property holds:

(h ◦ g) ◦ f = h ◦ (g ◦ f)

Proof: Both (h ◦ g) ◦ f and h ◦ (g ◦ f) have domain A and codomain D. Hence, to show equality,we must show that the two functions have the same value at each x ∈ A. Proceeding, we obtainthe following:

[

(h ◦ g) ◦ f]

(x) = (h ◦ g)[

f(x)]

= h(g(f(x)))

= h[

(g ◦ f)(x)]

=[

h ◦ (g ◦ f)]

(x)

158 Chapter 3 Functions

Therefore, (h ◦ g) ◦ f = h ◦ (g ◦ f).�

Exercise Set 3.3

1. Find the inverse of each of the following functions.

(a) f1 : Q → Q; f1(x) = 4x + 2(b) f2 : Q − {1} → Q − {2}; f2(x) = 2x/(x− 1)(c) f3 : Z12 → Z12; f3(x) = 5 · x(d) f4 : Z39 → Z39; f4(x) = (5 · x) + 2(e) f5 : Z → Z; f5(m) = m + 1

(f) f6 : Z → {0, 1, 2, 3, . . .}; f6(m) =

{

2m− 1 if m > 0

−2m if m ≤ 0

(g) f7 : {1, 2, 3, 4}→ {1, 2, 3, 4}; f7(1) = 4, f7(2) = 1, f7(3) = 2, f7(4) = 3(h) f8 : {1, 2, 3, 4}→ {1, 2, 3, 4}; f8(1) = 3, f8(2) = 4, f8(3) = 1, f8(4) = 2

2. Let f : X → Y be a bijection and let B be a subset of Y . Let A1 be the preimage of B underf , and let A2 be the image of B under f−1. Show that A1 = A2.

3. Find g ◦ f .

(a) f : Z → Z+; f(m) = |m|+1, g : Z+ → Q+; g(n) = 1/n(b) f : R → (0, 1); f(x) = 1/(x2 + 1), g : (0, 1) → (0, 1); g(x) = 1 − x(c) f : Q − {2} → Q − {0}; f(x) = 1/(x − 2), g : Q − {0} → Q − {0}; g(x) = 1/x(d) f : R → [1,∞); f(x) = x2 + 1, g : [1,∞) → [0,∞); g(x) =

√x − 1

(e) f : Q − {10/3} → Q − {3}; f(r) = 3r − 7, g : Q − {3} → Q − {2}; g(r) = 2r/(r − 3)(f) f : Z → Z5; f(m) = m mod 5, g : Z5 → Z5; g(m) = m + 1(g) f : Z8 → Z12; f(m) = 3 · m, g : Z12 → Z6; g(m) = 2 · m(h) f, g : {1, 2, 3, 4}→ {1, 2, 3, 4};

f(1) = 4 f(2) = 1 f(3) = 2 f(4) = 3

g(1) = 3 g(2) = 4 g(3) = 1 g(4) = 2

4. Prove Theorem 3.5.

5. Given the permutations f and g, find f−1 , g−1, f ◦ g, (f ◦ g)−1, and g−1 ◦ f−1 .

(a) f : Z → Z; f(m) = m + 1, g : Z → Z; g(m) = 2 − m(b) f : Z7 → Z7; f(m) = m + 3, g : Z7 → Z7; g(m) = 2 · m(c) f, g : {1, 2, 3, 4}→ {1, 2, 3, 4};

f(1) = 4 f(2) = 1 f(3) = 2 f(4) = 3

g(1) = 3 g(2) = 4 g(3) = 1 g(4) = 2

(d) f, g : {1, 2, 3, 4}→ {1, 2, 3, 4};

f(1) = 2 f(2) = 4 f(3) = 3 f(4) = 1

g(1) = 1 g(2) = 3 g(3) = 4 g(4) = 2

(e) f : Q → Q; f(x) = 4x, g : Q → Q; g(x) = (x − 3)/2(f) f : Q − {1} → Q − {1}; f(x) = 2x − 1, g : Q − {1} → Q − {1}; g(x) = x/(x− 1)

Chapter Problems 159

6. Prove Theorem 3.6, part 1.

7. For the permutations f and g given in Exercise 5, find g ◦ f and f−1 ◦ g−1.

8. Give an example of sets X, Y , and Z, and of functions f : X → Y and g : Y → Z, such thatg ◦ f and f are both one-to-one, but g is not one-to-one.

9. Define the functions f and g on your (maternal) family tree by f(x) = the mother of x andg(x) = the eldest child of the mother of x. Describe each of these functions.

(a) f ◦ f (b) f ◦ g(c) g ◦ f (d) g ◦ g

10. Give an example of sets X, Y , and Z, and of functions f : X → Y and g : Y → Z, such thatg ◦ f and g are both onto, but f is not onto.

11. Let f : X → Y be a bijection. Prove that (f−1)−1 = f .

12. Prove Theorem 3.8, part 2.

13. Let f : X → Y and g : Y → Z be bijections. Prove that

(g ◦ f)−1 = f−1 ◦ g−1

14. Let f : X → Y and g : Y → X be bijections. Prove: If g ◦ f = iX (or f ◦ g = iY ), theng = f−1.

CHAPTER PROBLEMS

1. Define f : R → R by f(x) = x3 + 2.

(a) Show that f is a permutation of R.(b) Find f−1.(c) Suppose the domain and codomain of f are changed from R to Q. Is f a permutation of Q?

2. Show that there are infinitely many pairs of distinct functions f and g on Q such that none off, g, nor f ◦ g is the identity function on Q and f ◦ g = g ◦ f . (Hint: Consider linear functions.)

3. Define f : R → R by f(x) = 4x + 1.

(a) Show that f is a permutation of R.(b) Find f−1.(c) Suppose the domain and codomain of f are changed from R to Q. Is f a permutation of Q?(d) Suppose the domain and codomain of f are changed from R to Z. Is f a permutation of Z?

4. Let X and Y be nonempty sets and let f : X → Y be a function. Prove that, if the condition

f(A1 ∩ A2) = f(A1) ∩ f(A2)

holds for all subsets A1 and A2 of X, then f is one-to-one, and conversely. (Hint: For necessity,by Theorem 3.2, part 2(a), it suffices to prove that, if f is one-to-one, thenf(A1) ∩ f(A2) ⊆ f(A1 ∩ A2); for sufficiency, prove the contrapositive.)

160 Chapter 3 Functions

5. Let f : X → Y , where X and Y are subsets of R. The function f is said to be increasing

provided the following condition holds for all x1, x2 ∈ X:

x1 < x2 → f(x1) < f(x2)

Similarly, f is said to be decreasing provided the following condition holds for all x1, x2 ∈ X:

x1 < x2 → f(x1) > f(x2)

If f is either increasing or decreasing, then we say that f is monotonic.

(a) Prove that a monotonic function is one-to-one.(b) Define f : (−1, 1) → R by f(x) = x/(1− x2). Apply the result of part (a) to show that f is

one-to-one.(c) Define g : R → R by g(x) = x3 + x − 2. Apply the result of part (a) to show that g is

one-to-one. (Hint: Show that g′(x) > 0 and apply a result from calculus.)

6. Let X and Y be nonempty sets and let f : X → Y be a function. Prove the following results.

(a) If the condition f(f−1(B)) = B holds for every subset B of Y , then f is onto, and conversely.(b) If the condition f−1(f(A)) = A holds for every subset A of X, then f is one-to-one, and

conversely.

(Hint: In both parts, prove necessity directly and sufficiency by contrapositive. Also, recall that toprove two sets V and W are equal, it suffices to prove that both V ⊆ W and W ⊆ V .)

7. Let f , g, and h be functions on Z defined as follows: f(m) = m + 1, g(m) = 2m, and

h(m) =

{

0 if m is even

1 if m is odd

Determine the following composite functions.

(a) f ◦ g (b) g ◦ f(c) f ◦ h (d) h ◦ f(e) g ◦ h (f) h ◦ g(g) g ◦ g (h) h ◦ f ◦ g

8. Let U be a nonempty universal set. For A ⊆ U , define the function χA : U → {0, 1} by

χA(x) =

{

0 if x /∈ A

1 if x ∈ A

The function χA is called the characteristic function of A. For A, B ∈ P(U), let C = A ∩ B,D = A ∪ B, and E = A − B. Prove that the following relations hold for all x ∈ U :

(a) χC(x) = χA(x) · χB(x) (b) χD(x) = χA(x) + χB(x) − [χA(x) · χB(x)](c) χU (x) = 1 (d) χ∅(x) = 0(e) χB(x) = 1 − χB(x) (f) χE(x) = χA(x) [1− χB(x)]

Chapter Problems 161

9. Define f : Z119 → Z119 by f(x) = 15 · x. Show that f is a permutation of Z119 and find f−1.

10. Let X be a nonempty set, let i denote the identity function on X, and let f be a function onX. Define f0 = i, f1 = f , f2 = f ◦ f , f3 = f ◦ f ◦ f , and so on. (Recursively, f0 = i andfn = f ◦ fn−1, for n ≥ 1.) In particular, take the case X = Z; give an example of a functionf : Z → Z such that:

(a) f 6= i but f2 = i(b) f2 6= i but f3 = i (Hint: Define f by f(1) = 2, f(2) = 3, f(3) = 1, and f(x) = x for

x /∈ {1, 2, 3}.)(c) Generalize parts (a) and (b); for each n > 1, give an example of a function f : Z → Z such

that f 6= i, . . ., fn−1 6= i, but fn = i.

11. Define f : Q − {1/4} → Q − {0} by f(x) = 1− 4x and g : Q − {0} → Q − {3/2} byg(x) = (3x − 1)/(2x). Determine each of these functions.

(a) g ◦ f (b) (g ◦ f)−1

(c) f−1 (d) g−1

(e) f−1 ◦ g−1

12. Let F denote the set of functions on R, let C = {f ∈ F | f is continuous}, and letD = {f ∈ F | f is differentiable}. Consider the function ∆: D → F that maps each functionf ∈ D to its derivative f ′ in F ; that is, ∆(f) = f ′.

(a) Is the function ∆ one-to-one?(b) Let f ∈ D. What is ∆−1({f ′})?(c) Show that C ⊂im ∆.

13. Give an example of a function f :[

−1, 1]

→[

0, 4]

that is:

(a) neither one-to-one nor onto (b) one-to-one but not onto(c) onto but not one-to-one (d) both one-to-one and onto

14. Let m and n be positive integers, and let A = {0, 1, . . . , m − 1}, B = {0, 1, . . . , n − 1}, andC = {0, 1, . . . , mn − 1}. Construct a bijection f : A × B → C. (Hint: First try a special case,such as m = 2 and n = 3; then try to generalize your construction.)

15. Give an example of a function f :[

0, 4]

→[

−1, 1]

that is:

(a) neither one-to-one nor onto (b) one-to-one but not onto(c) onto but not one-to-one (d) both one-to-one and onto

16. Construct a bijection:

(a) from (−1, 1) to R (b) from Z to Z+

17. Let c and d be real numbers with c < d. Construct a bijection from (0, 1) to (c, d).

18. Construct a function f : Q+ → Z+ such that f is one-to-one.

19. Given real numbers a, b, c, and d such that a < b and c < d, construct a bijection from (a, b)to (c, d).

20. For any set X, prove (by contradiction) that there does not exist a bijection from X to P(X).

162 Chapter 3 Functions

21. Construct a bijection from Z to 2Z.

22. Let A1, B1, A2, and B2 be nonempty sets such that A1 ∩ B1 = ∅ = A2 ∩B2. Given bijectionsf : A1 → A2 and g : B1 → B2 , construct a bijection h : A1 ∪ B1 → A2 ∪ B2.

23. Construct a bijection from 1 + 2Z to 3Z+.

24. Let A1, B1, A2, and B2 be nonempty sets. Given bijections f : A1 → A2 and g : B1 → B2,construct a bijection h : A1 × B1 → A2 × B2.

25. Define the function f : Z → Z by f(m) = 5m + 2.

(a) Either prove that f is one-to-one or give an example to show that f is not one-to-one.(b) Either prove that f is onto or give an example to show that f is not onto.(c) Find f(2Z).(d) Find f−1(3Z+).

26. Let X be a nonempty subset of R. Given two functions f and g from X to R, we definefunctions f + g : X → R and f · g : X → R, called the sum and product of f and g, respectively, asfollows:

(f + g)(x) = f(x) + g(x)

(f · g)(x) = f(x)g(x)

Each part gives a subset X of R and two functions f and g from X to R; find f + g and f · g.

(a) X = Z+; f(x) = x2 and g(x) = 2x − 1(b) X = Q; f(x) = x/3 and g(x) = 3x + 2(c) X = R − {0}; f(x) = (x2 + 1)/x and g(x) = x/(x2 + 1)(d) X = R; f(x) = x2 − 2x + 3 and g(x) = −x2 + 2x− 3

27. Define the function f : R →[

1,∞) by f(x) = x2 + 1.

(a) Either prove that f is one-to-one or give an example to show that f is not one-to-one.(b) Either prove that f is onto or give an example to show that f is not onto.(c) Find f(

[

0, 2]

).

(d) Find f−1([

1, 3]

).

(e) Find f−1([

2, 5]

).

28. Determine f ◦ g and g ◦ f .

(a) f : R → R; f(x) = x2 + x, g : R → R; g(x) = 3x + 4(b) f : (0,∞) → (0,∞); f(x) = x/(x2 + 1), g : (0,∞) → (0,∞); g(x) = 1/x

29. Define f : R − {1} → R − {2} by f(x) = (x3 + 7)/4 and g : R − {2} → R − {1} byg(x) = x/(x− 2). Determine these functions.

(a) g ◦ f (b) (g ◦ f)−1

(c) f ◦ g (d) (f ◦ g)−1