# MAT 112 Integers and Modern Applications for the Uninitiated

## Section7.5Inverse Functions

Sometimes it is possible to “undo” the effect of a function. In these cases, we can define a function that reverses the effects of another function. A function that we can “undo” is called invertible.
In the video in Figure 7.46 we introduce inverse functions and give examples.
We give the formal definition of an invertible function and of the inverse of an invertible function.

### Definition7.47.

Let $$A$$ and $$B$$ be non-empty sets. We say that a function $$f:A\to B$$ is invertible if for every $$b\in B$$ there is exactly one $$a\in A$$ such that $$f(a)=b\text{.}$$ The inverse of an invertible function $$f:A\to B\text{,}$$ denoted by $$f^{-1}\text{,}$$ is the function $$f^{-1}:B \to A$$ that assigns to each element $$b \in B$$ the unique element $$a \in A$$ such that $$f(a) = b\text{.}$$
In other words, a function $$f:A\to B$$ is invertible if every $$b\in B$$ has exactly one preimage $$a\in A\text{.}$$ So if $$f(a) = b\text{,}$$ then $$f^{-1}(b) = a\text{.}$$
Confirm your understanding of the definition by completing it in the exercise.

### Checkpoint7.48.Definition of invertible function.

Complete the following:
Definition. Let $$f : A \rightarrow B$$ be a function. We say $$f$$ is invertible if
• select
• for every
• there is exactly one
• for one
element
• select
• a in A
• b in B
,
• select
• for every
• there is exactly one
• for one
element
• select
• a in A
• b in B
such that
• select
• f(a)=b
• f(b)=a
• f(a)=1
.
Definition. The inverse function $$f^{-1}:$$
• select
• A -> B
• B -> A
of an invertible function $$f: A \to B$$ is the function that assigns to each element
• select
• a in A
• b in B
the unique element
• select
• a in A
• b in B
such that
• select
• f(a)=b
• f(b)=a
• f(a)=1
.
Theorem. If a function $$f:$$
• select
• A -> B
• B -> A
is invertible and $$f^{-1}: B\to A$$ is its inverse, then $$f$$ is the inverse of $$f^{-1}$$ .
Theorem. Let $$f : A \rightarrow B$$ be a function and let $$f^{-1}:$$
• select
• A -> B
• B -> A
be its inverse, The function $$f \circ f^{-1}$$ is the
• select
• identity function on A
• identity function on B
. The function $$f^{-1}\circ f$$ is the
• select
• identity function on A
• identity function on B
.
Figure 7.49
We investigate whether the two functions $$\mathrm{studentid}$$ and $$\mathrm{grade}$$ are invertible.

### Example7.50.Are $$\mathrm{studentid}$$ and $$\mathrm{grade}$$ invertible ?

We use the functions $$\mathrm{studentid} \colon N \to I$$ and $$\mathrm{grade} \colon I \to G$$ from Example 7.5 and Example 7.7 given by the tables in Figure 7.4 and Figure 7.6 respectively.
The function $$\mathrm{studentid} \colon N \to I$$ where $$I$$ is the set of student identification numbers and $$N$$ is the set of student names is invertible as long as every student has a different name. The function $$\mathrm{studentid}^{-1}: I \to N$$ is the function that tells us the student’s name for a given identification number. With the table in Figure 7.4 we get
\begin{equation*} \mathrm{studentid} (\mathsf{ Alice } ) = 1001, \text{ so } \mathrm{studentid}^{-1}(0001) = \mathsf{ Alice } \text{.} \end{equation*}
Recall the function grade from Example 7.7. The function $$\mathrm{grade} \colon I \to G$$ where $$I$$ is the set of identification numbers and $$G$$ is the set of grades is not invertible since many students may earn the same grade in a class. Both the students with the identification number 1007 and 1008 earn an A in MAT 112. We have $$\mathrm{grade} ({ 1007 } ) =\text{A}$$ and $$\mathrm{grade} ({ 1008 } ) = \mathsf{A}\text{,}$$ and we would not be able to uniquely define $$\mathrm{grade}^{-1}(A)\text{.}$$
In Figure 7.51 we give an example of an invertible function from $$\Z_5$$ to $$\Z_5$$ and its inverse. The function $$e$$ in Figure 7.57 illustrates that for an invertible function the domain and codomain do not have to be the same.
We investigate whether some given functions are invertible.

### Problem7.52.Is $$g:\{-1,0,1\}\to \{0,1,2\}\text{,}$$ $$g(x) := x^2$$ invertible ?

Let $$g:\{-1,0,1\}\to \{0,1,2\}$$ be given by $$g(x) := x^2$$ (compare Problem 7.34). Determine whether $$g$$ invertible.
Solution.
The function $$g$$ is not invertible since $$2\in\{0,1,2\}$$ has no preimage in $$\{-1,0,1\}\text{.}$$ (Note that $$g$$ fails to be invertible for multiple reasons, since $$g(-1) =1$$ and $$g(1) = 1\text{.}$$)

### Problem7.53.Is $$h:\{0,1,2\}\to \{2,3,4\}\text{,}$$ $$h(y) := y+2$$ invertible ?

Let $$h:\{0,1,2\}\to \{2,3,4\}$$ be given by $$h(y) := y+2$$ (compare Problem 7.34). Determine whether $$h$$ invertible.
Solution.
The function $$h$$ is invertible since each element in the domain is assigned to a distinct element in the codomain. We have $$h^{-1}:\{2,3,4\}\to\{0,1,2\}$$ defined by $$h^{-1}(z)=z-2\text{.}$$ In particular, $$h^{-1}(2)=0\text{,}$$ $$h^{-1}(3)=1\text{,}$$ and $$h^{-1}(4)=2\text{.}$$
We give an example of an invertible function whose domain is a Cartesian product.

### Example7.54.An invertible function from $$\Z_2\times\Z_2$$ to $$\Z_4$$.

Consider the function $$b:\Z_4\to\Z_2\times\Z_2$$ given by $$b(0):=(0,0)\text{,}$$ $$b(1):=(0,1)\text{,}$$ $$b(2):=(1,0)\text{,}$$ and $$b(3):=(1,1)\text{.}$$ Since every element in $$\Z_2\times\Z_2$$ has exactly one preimage in $$\Z_4$$ under $$b\text{,}$$ the function $$b$$ is invertible. The inverse $$b^{-1}:\Z_2\times\Z_2 \to\Z_4$$ of the function $$b$$ is given by $$b^{-1}\left((0,0)\right):=0\text{,}$$ $$b^{-1}\left((0,1)\right):=1\text{,}$$ $$b^{-1}\left((1,0)\right):=2\text{,}$$ and $$b^{-1}\left((1,1)\right):=3\text{.}$$
Now determine yourself whether a given function is invertible.

### Checkpoint7.55.Is this function invertible ?

Let $$f:\mathbb{Z}_{3}\to \mathbb{Z}_{3}\text{,}$$ $$f(x)=(2x+x)\bmod 3\text{.}$$
Evaluate $$f$$ at all elements of its domain.
$$f(0) =$$
$$f(1) =$$
$$f(2) =$$
Thus the function $$f$$
• select
• is invertible
• is not invertible
.
Suppose that $$f:A\to B$$ is invertible, and let $$f^{-1} :B \to A$$ be its inverse. If $$f(a) = b\text{,}$$ then $$f^{-1}(b)=a\text{.}$$ Thus for the composition functions $$f^{-1}\circ f$$ and $$f \circ f^{-1}\text{,}$$ we have
\begin{equation*} (f^{-1}\circ f)(a)=f^{-1}(f(a))=f^{-1}(b)=a\text{.} \end{equation*}
Hence $$f^{-1}\circ f=\id_A$$ where $$\id_A$$ denotes the identity function on $$A\text{.}$$ Similarly
\begin{equation*} (f\circ f^{-1})(b)=f(f^{-1}(b))=f(a)=b \end{equation*}
and so $$f\circ f^{-1}=\id_B\text{.}$$
For $$f^{-1}:B\to A$$ the inverse is the function $$\left(f^{-1}\right)^{-1}:A\to B$$ that assigns to $$a\in A$$ the element $$b\in B$$ such that $$f^{-1}(b)=a\text{.}$$ This element $$b$$ is equal to $$f(a)\text{.}$$ Thus $$\left(f^{-1}\right)^{-1}(a)=f(a)\text{.}$$ Therefore $$\left(f^{-1}\right)^{-1}=f\text{.}$$ So $$f$$ is the inverse of $$f^{-1}\text{.}$$
Assume that $$f:A\to B$$ is a function and there is a function $$g:B\to A$$ such that $$g\circ f=\id_A\text{.}$$ Let $$a\in A$$ and $$b=f(a)\text{.}$$ Now
\begin{equation*} g(b)=g(f(a))=(g\circ f)(a)=\id_A(a)=a. \end{equation*}
This assignment $$g(b)=a$$ is unique, as $$g$$ is a function. So $$g$$ is the inverse of $$f\text{.}$$ We have proven:
Already in Section 7.4 we have encountered two invertible functions and their inverses. In Example 7.44 we checked whether the composite of two functions is the identity function. By Theorem 7.58 this means that they are each others inverses. In Example 7.45 we encountered a functions that is its own inverse.
Let $$f:A\to B$$ be a function and let
\begin{equation*} G:=\left\{\left(x,f(x)\right) \mid x\in A\right\} \end{equation*}
be its graph. We obtain the graph of $$f^{-1}$$ by swapping the order of elements in the pairs in the graph of $$f\text{.}$$ Thus the graph of $$f^{-1}$$ is $$\{ (y,x)\mid (x,y)\in G\}\text{.}$$ This is illustrated in Example 7.59.

### Example7.59.

Let $$f:\Z_7\to\Z_7$$ be given by $$f(x)=3(x+1) \bmod 7\text{.}$$ We have
\begin{align*} f(0)\amp=3(0+1)\bmod 7 = 3\bmod 7 =3\\ f(1)\amp=3(1+1)\bmod 7 = 6\bmod 7 =6\\ f(2)\amp=3(2+1)\bmod 7 = 9\bmod 7 =2\\ f(3)\amp=3(3+1)\bmod 7 = 12\bmod 7 =5\\ f(4)\amp=3(4+1)\bmod 7 = 15\bmod 7 =1\\ f(5)\amp=3(5+1)\bmod 7 = 18\bmod 7 =4\\ f(6)\amp=3(6+1)\bmod 7 = 21\bmod 7 =0 \end{align*}
Thus $$f(\Z_7)=\Z_7$$ and no element in the codomain has the same preimage. Hence the function $$f$$ is invertible.
The graph of $$f$$ is
\begin{equation*} \{(x,f(x))\mid x\in\Z_7\} = \{(0,3),(1,6),(2,2),(3,5),(4,1),(5,4),(6,0)\} \end{equation*}
and its graphical representation where the elements of the set are represented by black pixels is:
We obtain the graph of the inverse $$f^{-1}$$ by swapping the order of the numbers in the ordered pairs in the graph of $$f\text{.}$$ Thus the graph of $$f^{-1}$$ is
\begin{equation*} \{(3,0),(6,1),(2,2),(5,3),(1,4),(4,5),(0,6)\} \end{equation*}
and its graphical representation is:
In Example 7.60 observe how changing the plot of the graph of a function changes its graph and the properties of the function.