Skip to content

Chapter 2 — Functions

2.7 — Injectivity, Reversibility and the Inverse Function

Every function goes from cause to effect; only some also allow one to return from effect to cause.


The composition of §2.6 chained the output of one function to the input of another. This section studies a related question: given a function ff, is there another one that exactly undoes what ff did? Not every function allows it, and specifying when it does requires returning, with more care, to the codomain and the image of §2.1.

§1. Injectivity and the horizontal line test

Section titled “§1. Injectivity and the horizontal line test”

Definition. A function f:A→Bf : A \to B is injective, or one-to-one, if distinct elements of the domain always correspond to distinct values:

x1,x2∈A,x1≠x2  ⟹  f(x1)≠f(x2)x_1, x_2 \in A, \quad x_1 \neq x_2 \implies f(x_1) \neq f(x_2)

An equivalent form, and almost always a more convenient one, is the contrapositive: f(x1)=f(x2)  ⟹  x1=x2f(x_1) = f(x_2) \implies x_1 = x_2. The contrapositive of an implication “if PP, then QQ” is “if not QQ, then not PP”, and it says exactly the same thing. Both forms express that no value of BB is reached more than once, but the second starts from an equality, which is easier to compute with.

Just as the uniqueness of §2.1 was translated into the vertical line test of §2.3, injectivity has an analogous translation on the other axis.

Proposition (horizontal line test). A function ff is injective if and only if each horizontal line y=by = b meets Gr⁡(f)\operatorname{Gr}(f) in at most one point.

Proof. That the line y=by = b meets Gr⁡(f)\operatorname{Gr}(f) in two distinct points means that there are x1≠x2x_1 \neq x_2 with f(x1)=b=f(x2)f(x_1) = b = f(x_2), which is exactly the negation of injectivity. Therefore ff is injective if and only if no horizontal line meets the graph in two or more points. ■\blacksquare

The parallel with §2.3 is no accident. The vertical line checked a condition on the domain: that each xx have a single yy. The horizontal line checks a condition on the image: that each yy reached be reached by a single xx. It is the same question of uniqueness, posed on different axes.

A frequent source of injectivity is the monotonicity of §2.3.

Proposition. If ff is increasing or decreasing on its domain, which is an interval, then ff is injective.

Proof. Let x1≠x2x_1 \neq x_2 be in the domain; we may assume x1<x2x_1 < x_2. If ff is increasing, f(x1)<f(x2)f(x_1) < f(x_2), and if it is decreasing, f(x1)>f(x2)f(x_1) > f(x_2). In both cases, f(x1)≠f(x2)f(x_1) \neq f(x_2). ■\blacksquare

Examples. The function f(x)=x3f(x) = x^3 is injective, because it is increasing on R\mathbb{R} (§2.4). On the other hand, f(x)=x2f(x) = x^2 is not: f(−2)=f(2)=4f(-2) = f(2) = 4, and on the graph, the horizontal line y=4y = 4 meets the parabola in two points. The converse of the proposition is false: 1x\frac{1}{x} is injective, because 1x1=1x2\frac{1}{x_1} = \frac{1}{x_2} implies x1=x2x_1 = x_2, but it is not monotonic on its domain, as we saw in §2.4.


§2. Surjectivity, bijectivity and the codomain

Section titled “§2. Surjectivity, bijectivity and the codomain”

Injectivity alone is not enough for what we are looking for. It is also necessary for the declared codomain to fit what the function actually reaches.

Definition. A function f:A→Bf : A \to B is surjective if Img⁡(f)=B\operatorname{Img}(f) = B, that is, if every element of the codomain is reached by some element of the domain. It is bijective if it is both injective and surjective.

Surjectivity, unlike injectivity, does not depend only on the rule: it depends on the declared codomain. The function f:R→Rf : \mathbb{R} \to \mathbb{R}, f(x)=x2f(x) = x^2, is not surjective, because no negative number is reached, as the example of §2.1 showed. But the same rule, declared as f:R→[0,∞)f : \mathbb{R} \to [0, \infty), is surjective, because now the codomain coincides with the image. It is the first concrete consequence of the convention of §2.1 according to which two functions with the same rule and different codomains are different: one is surjective and the other is not, even though they do the same thing with each xx. In general, every function becomes surjective if its image is taken as the codomain.


With these two notions we can specify when a function can be undone.

Definition. Let f:A→Bf : A \to B be bijective. The inverse function of ff, denoted f−1:B→Af^{-1} : B \to A, is the function that assigns to each b∈Bb \in B the unique a∈Aa \in A such that f(a)=bf(a) = b.

The exponent −1-1 is only a notation: f−1(x)f^{-1}(x) does not mean 1f(x)\frac{1}{f(x)}. That f−1f^{-1} is actually a function, with the existence and uniqueness of §2.1, depends on both properties at once. Surjectivity guarantees that for each b∈Bb \in B there is at least one aa with f(a)=bf(a) = b; without it, some bb would be left without an image and existence would fail. Injectivity guarantees that there is at most one; without it, some bb would have two preimages and f−1(b)f^{-1}(b) would be ambiguous. Each property settles one of the two requirements that define a function.

To express precisely what “undoing” means, we use the identity function of a set AA, id⁡A:A→A\operatorname{id}_A : A \to A, defined by id⁡A(x)=x\operatorname{id}_A(x) = x.

Proposition. Let f:A→Bf : A \to B be bijective. Then f−1∘f=id⁡Af^{-1} \circ f = \operatorname{id}_A and f∘f−1=id⁡Bf \circ f^{-1} = \operatorname{id}_B. Conversely, if g:B→Ag : B \to A satisfies g∘f=id⁡Ag \circ f = \operatorname{id}_A and f∘g=id⁡Bf \circ g = \operatorname{id}_B, then g=f−1g = f^{-1}.

Proof. Let x∈Ax \in A and write b=f(x)b = f(x). By definition, f−1(b)f^{-1}(b) is the unique element of AA whose image is bb, and that element is xx; therefore f−1(f(x))=xf^{-1}(f(x)) = x. Now let y∈By \in B; by definition, f−1(y)f^{-1}(y) is an element whose image is yy, so f(f−1(y))=yf(f^{-1}(y)) = y. For the converse, let y∈By \in B. Since f(g(y))=yf(g(y)) = y, the element g(y)g(y) is a preimage of yy, and since ff is injective, it is the only one; therefore g(y)=f−1(y)g(y) = f^{-1}(y). The functions gg and f−1f^{-1} have the same domain, the same codomain and the same values, so they are equal (§2.2). ■\blacksquare

Method of computation. To find f−1f^{-1} from a formula, one starts from y=f(x)y = f(x), solves for xx in terms of yy with the techniques of §1.5, and finally swaps the names of the variables, by custom, so as to write f−1f^{-1} in terms of xx as well. If the equation has a unique solution for each yy in the codomain, that proves at once that ff is bijective and gives the formula of its inverse.

Example. Let f:R→Rf : \mathbb{R} \to \mathbb{R}, f(x)=2x+3f(x) = 2x + 3. For each y∈Ry \in \mathbb{R}, the equation y=2x+3y = 2x + 3 has the unique solution x=y−32x = \frac{y - 3}{2} (§1.5). Therefore ff is bijective, and renaming the variables, f−1(x)=x−32f^{-1}(x) = \frac{x - 3}{2}. Let us check the proposition: f−1(f(x))=(2x+3)−32=xf^{-1}(f(x)) = \frac{(2x + 3) - 3}{2} = x and f(f−1(x))=2⋅x−32+3=xf(f^{-1}(x)) = 2 \cdot \frac{x - 3}{2} + 3 = x.


Many functions are not injective on their whole domain, but are on part of it. In that case one can invert their restriction, in the sense of §2.2.

Example. The function x2x^2 is not injective on R\mathbb{R}, but it is increasing on [0,∞)[0, \infty) (§2.3) and, by §1, injective there. Consider then f:[0,∞)→[0,∞)f : [0, \infty) \to [0, \infty), f(x)=x2f(x) = x^2. It is injective, and it is surjective because every y≥0y \ge 0 is the square of y\sqrt{y} (§1.2). Its inverse assigns to each y≥0y \ge 0 the unique x≥0x \ge 0 with x2=yx^2 = y, which is precisely y\sqrt{y}. Thus f−1(x)=xf^{-1}(x) = \sqrt{x}: the square root is the inverse of squaring restricted to the nonnegatives. Had the interval (−∞,0](-\infty, 0] been chosen, the inverse would be −x-\sqrt{x}.

The choice of restriction is not unique, and that is why it must be declared. This procedure will reappear each time the book needs to invert a function that is not injective on its whole domain.


§5. Domain, image and symmetry of the inverse

Section titled “§5. Domain, image and symmetry of the inverse”

A mirror relation between ff and f−1f^{-1} follows from the definition. Since f:A→Bf : A \to B is bijective, Img⁡(f)=B\operatorname{Img}(f) = B, and f−1f^{-1} goes from BB to AA and reaches all of AA, because each a∈Aa \in A is f−1(f(a))f^{-1}(f(a)). Therefore

Dom⁡(f−1)=Img⁡(f)Img⁡(f−1)=Dom⁡(f)\operatorname{Dom}(f^{-1}) = \operatorname{Img}(f) \qquad\qquad \operatorname{Img}(f^{-1}) = \operatorname{Dom}(f)

Domain and image are swapped.

This swap has a geometric translation. If (a,b)∈Gr⁡(f)(a, b) \in \operatorname{Gr}(f), then f(a)=bf(a) = b, therefore f−1(b)=af^{-1}(b) = a, and (b,a)∈Gr⁡(f−1)(b, a) \in \operatorname{Gr}(f^{-1}). The graph of f−1f^{-1} consists of the points of the graph of ff with their coordinates swapped. And the points (a,b)(a, b) and (b,a)(b, a) are symmetric with respect to the line y=xy = x: if a≠ba \neq b, the midpoint of the segment joining them, (a+b2,a+b2)\left(\frac{a + b}{2}, \frac{a + b}{2}\right), lies on that line (§1.8), and the segment has slope a−bb−a=−1\frac{a - b}{b - a} = -1, so it is perpendicular to the line y=xy = x, of slope 11, because (−1)⋅1=−1(-1) \cdot 1 = -1 (§1.10). That is why Gr⁡(f−1)\operatorname{Gr}(f^{-1}) is always the reflection of Gr⁡(f)\operatorname{Gr}(f) in the line y=xy = x. It is a reflection different from those of §2.5: not in a coordinate axis, but in the diagonal.

The line f(x)=2x+3 and its inverse f⁻¹(x)=(x-3)/2, symmetric with respect to the dotted line y=x, with the points (1,5) and (5,1) reflected into each other

Figure 2.5 — f(x)=2x+3f(x)=2x+3 and f−1(x)=(x−3)/2f^{-1}(x)=(x-3)/2, from the example of §3, reflected in y=xy=x. The point (1,5)∈Gr⁡(f)(1,5)\in\operatorname{Gr}(f) corresponds to (5,1)∈Gr⁡(f−1)(5,1)\in\operatorname{Gr}(f^{-1}).


The reversibility studied in this section can be read as a question about information. If ff describes a process that transforms a cause xx into an effect f(x)f(x), the existence of f−1f^{-1} asks whether the effect retains enough information to reconstruct the cause. When ff is not injective, like x2x^2, which treats 22 and −2-2 the same, the effect has irrecoverably lost the sign: two different causes led to the same effect, and no procedure can afterwards tell which one occurred. Injectivity is not, then, merely a technical condition for defining f−1f^{-1}: it is the statement that the process discards no information along the way. A question remains open: whether this idea, that of processes that preserve all the information of their input as opposed to processes that degrade it irreversibly, reaches other kinds of transformation, mathematical or not.

With reversibility made precise, the chapter turns to one last question about the behavior of a function: no longer whether it can be undone, but where it reaches its highest or lowest values. That is the topic of the next section.