Chapter 2 — Functions and Dynamic Relations¶
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 \(f\), is there another one that exactly undoes what \(f\) 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¶
Definition. A function \(f : A \to B\) is injective, or one-to-one, if distinct elements of the domain always correspond to distinct values:
An equivalent form, and almost always a more convenient one, is the contrapositive: \(f(x_1) = f(x_2) \implies x_1 = x_2\). The contrapositive of an implication "if \(P\), then \(Q\)" is "if not \(Q\), then not \(P\)", and it says exactly the same thing. Both forms express that no value of \(B\) 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 \(f\) is injective if and only if each horizontal line \(y = b\) meets \(\operatorname{Gr}(f)\) in at most one point.
Proof. That the line \(y = b\) meets \(\operatorname{Gr}(f)\) in two distinct points means that there are \(x_1 \neq x_2\) with \(f(x_1) = b = f(x_2)\), which is exactly the negation of injectivity. Therefore \(f\) 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 \(x\) have a single \(y\). The horizontal line checks a condition on the image: that each \(y\) reached be reached by a single \(x\). It is the same question of uniqueness, posed on different axes.
A frequent source of injectivity is the monotonicity of §2.3.
Proposition. If \(f\) is increasing or decreasing on its domain, which is an interval, then \(f\) is injective.
Proof. Let \(x_1 \neq x_2\) be in the domain; we may assume \(x_1 < x_2\). If \(f\) is increasing, \(f(x_1) < f(x_2)\), and if it is decreasing, \(f(x_1) > f(x_2)\). In both cases, \(f(x_1) \neq f(x_2)\). \(\blacksquare\)
Examples. The function \(f(x) = x^3\) is injective, because it is increasing on \(\mathbb{R}\) (§2.4). On the other hand, \(f(x) = x^2\) is not: \(f(-2) = f(2) = 4\), and on the graph, the horizontal line \(y = 4\) meets the parabola in two points. The converse of the proposition is false: \(\frac{1}{x}\) is injective, because \(\frac{1}{x_1} = \frac{1}{x_2}\) implies \(x_1 = x_2\), but it is not monotonic on its domain, as we saw in §2.4.
Reminder. Injective: \(f(x_1) = f(x_2) \implies x_1 = x_2\). The horizontal line test is to injectivity what the vertical line test is to the definition of function. Every function that is increasing or decreasing on an interval is injective.
§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 \to B\) is surjective if \(\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 : \mathbb{R} \to \mathbb{R}\), \(f(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 : \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 \(x\). In general, every function becomes surjective if its image is taken as the codomain.
Reminder. Surjective: \(\operatorname{Img}(f) = B\). Bijective: injective and surjective. Surjectivity depends on the declared codomain, not only on the formula.
§3. The inverse function¶
With these two notions we can specify when a function can be undone.
Definition. Let \(f : A \to B\) be bijective. The inverse function of \(f\), denoted \(f^{-1} : B \to A\), is the function that assigns to each \(b \in B\) the unique \(a \in A\) such that \(f(a) = b\).
The exponent \(-1\) is only a notation: \(f^{-1}(x)\) does not mean \(\frac{1}{f(x)}\). That \(f^{-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 \in B\) there is at least one \(a\) with \(f(a) = b\); without it, some \(b\) would be left without an image and existence would fail. Injectivity guarantees that there is at most one; without it, some \(b\) would have two preimages and \(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 \(A\), \(\operatorname{id}_A : A \to A\), defined by \(\operatorname{id}_A(x) = x\).
Proposition. Let \(f : A \to B\) be bijective. Then \(f^{-1} \circ f = \operatorname{id}_A\) and \(f \circ f^{-1} = \operatorname{id}_B\). Conversely, if \(g : B \to A\) satisfies \(g \circ f = \operatorname{id}_A\) and \(f \circ g = \operatorname{id}_B\), then \(g = f^{-1}\).
Proof. Let \(x \in A\) and write \(b = f(x)\). By definition, \(f^{-1}(b)\) is the unique element of \(A\) whose image is \(b\), and that element is \(x\); therefore \(f^{-1}(f(x)) = x\). Now let \(y \in B\); by definition, \(f^{-1}(y)\) is an element whose image is \(y\), so \(f(f^{-1}(y)) = y\). For the converse, let \(y \in B\). Since \(f(g(y)) = y\), the element \(g(y)\) is a preimage of \(y\), and since \(f\) is injective, it is the only one; therefore \(g(y) = f^{-1}(y)\). The functions \(g\) and \(f^{-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^{-1}\) from a formula, one starts from \(y = f(x)\), solves for \(x\) in terms of \(y\) with the techniques of §1.5, and finally swaps the names of the variables, by custom, so as to write \(f^{-1}\) in terms of \(x\) as well. If the equation has a unique solution for each \(y\) in the codomain, that proves at once that \(f\) is bijective and gives the formula of its inverse.
Example. Let \(f : \mathbb{R} \to \mathbb{R}\), \(f(x) = 2x + 3\). For each \(y \in \mathbb{R}\), the equation \(y = 2x + 3\) has the unique solution \(x = \frac{y - 3}{2}\) (§1.5). Therefore \(f\) is bijective, and renaming the variables, \(f^{-1}(x) = \frac{x - 3}{2}\). Let us check the proposition: \(f^{-1}(f(x)) = \frac{(2x + 3) - 3}{2} = x\) and \(f(f^{-1}(x)) = 2 \cdot \frac{x - 3}{2} + 3 = x\).
§4. Restricting in order to invert¶
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 \(x^2\) is not injective on \(\mathbb{R}\), but it is increasing on \([0, \infty)\) (§2.3) and, by §1, injective there. Consider then \(f : [0, \infty) \to [0, \infty)\), \(f(x) = x^2\). It is injective, and it is surjective because every \(y \ge 0\) is the square of \(\sqrt{y}\) (§1.2). Its inverse assigns to each \(y \ge 0\) the unique \(x \ge 0\) with \(x^2 = y\), which is precisely \(\sqrt{y}\). Thus \(f^{-1}(x) = \sqrt{x}\): the square root is the inverse of squaring restricted to the nonnegatives. Had the interval \((-\infty, 0]\) been chosen, the inverse would be \(-\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.
Reminder. If \(f\) is not injective, its domain can be restricted to an interval where it is, taking as codomain the image of that restriction. The square root is the inverse of \(x^2\) restricted to \([0, \infty)\).
§5. Domain, image and symmetry of the inverse¶
A mirror relation between \(f\) and \(f^{-1}\) follows from the definition. Since \(f : A \to B\) is bijective, \(\operatorname{Img}(f) = B\), and \(f^{-1}\) goes from \(B\) to \(A\) and reaches all of \(A\), because each \(a \in A\) is \(f^{-1}(f(a))\). Therefore
Domain and image are swapped.
This swap has a geometric translation. If \((a, b) \in \operatorname{Gr}(f)\), then \(f(a) = b\), therefore \(f^{-1}(b) = a\), and \((b, a) \in \operatorname{Gr}(f^{-1})\). The graph of \(f^{-1}\) consists of the points of the graph of \(f\) with their coordinates swapped. And the points \((a, b)\) and \((b, a)\) are symmetric with respect to the line \(y = x\): if \(a \neq b\), the midpoint of the segment joining them, \(\left(\frac{a + b}{2}, \frac{a + b}{2}\right)\), lies on that line (§1.8), and the segment has slope \(\frac{a - b}{b - a} = -1\), so it is perpendicular to the line \(y = x\), of slope \(1\), because \((-1) \cdot 1 = -1\) (§1.10). That is why \(\operatorname{Gr}(f^{-1})\) is always the reflection of \(\operatorname{Gr}(f)\) in the line \(y = x\). It is a reflection different from those of §2.5: not in a coordinate axis, but in the diagonal.
Figure 2.5 — \(f(x)=2x+3\) and \(f^{-1}(x)=(x-3)/2\), from the example of §3, reflected in \(y=x\). The point \((1,5)\in\operatorname{Gr}(f)\) corresponds to \((5,1)\in\operatorname{Gr}(f^{-1})\).
Reminder. \(\operatorname{Dom}(f^{-1}) = \operatorname{Img}(f)\) and \(\operatorname{Img}(f^{-1}) = \operatorname{Dom}(f)\). The graph of \(f^{-1}\) is the reflection of that of \(f\) in the line \(y = x\).
The reversibility studied in this section can be read as a question about information. If \(f\) describes a process that transforms a cause \(x\) into an effect \(f(x)\), the existence of \(f^{-1}\) asks whether the effect retains enough information to reconstruct the cause. When \(f\) is not injective, like \(x^2\), which treats \(2\) and \(-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^{-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.