## What is the inverse of a function?

If we consider a function $f$ defined from a set $A$ to another set $B$, then the **inverse of the function**$f$, denoted by $f^{-1}$, is a function defined from the set $B$ to the set $A$, such that for every element $a\in A$, $f^{-1}(f(a))=a$. Moreover, a function whose inverse exists is called an **invertible function**.

In general, a function can be or not be invertible. Hence, it is natural to seek, when a function is invertible.

### When is a function invertible?

A function is invertible if and only if it is a *one-to-one* correspondence. We must present an argument for both sides to see why this statement is correct. Let’s see both sides one by one.

First, we must show that if a function $f: A\to B$ is invertible, then it is a one-to-one correspondence. Moreover, because $f$ is an invertible function, $f^{-1}$ exists. If the function $f$ is not one-to-one, that means $a_1$ and $a_2$ are distinct elements in $A$ and $b\in B$ such that $f(a_1)=f(a_2) = b$. In that case, what is $f^{-1}(b)$? This is a contradiction because we started with the assumption that $f$ is invertible hence $f^{-1}$ is well-defined. Therefore, $f$ is a one-to-one function. If the function $f$ is not surjective, then there is an element $b\in B$ which is not an image of any element of $A$ under the function $f$. In that case, what is $f^{-1}(b)$? This is also a contradiction because we started with the assumption that $f$ is invertible hence $f^{-1}$is well-defined. Therefore, $f$ is an surjective function. As a result, $f$ is a one-to-one correspondence.

Now, we must show that if a function $f: A\to B$ is a one-to-one correspondence, then it is invertible. Because $f$ is a one-to-one correspondence, every element of the domain has a unique image in the codomain, and every element of the codomain has a preimage in the domain. We can define a function $f^{-1}:B\to A$ such that for $a\in A$ and $b\in B$, if $f(a) = b$, $f^{-1}(b) = a$. To see that $f^{-1}$ is a well-defined inverse function, we can notice that every element of $B$ is an image of some element of $A$ under the function $f$. So, $f^{-1}$ is defined for every element of $B$. In addition, because$f$ is one-to-one, $f^{-1}$ does not map any element of $B$ to more than one element of $A$. This makes $f^{-1}$ a well-defined inverse function of $f$. With this, we’ve concluded our proof.

### The inverse of a function is invertible

Let’s suppose there is a function $f:A\to B$ and its inverse is $f^{-1}:B\to A$. We can tell that the $f^{-1}$ function is injective because no two elements of $B$ are mapped by $f^{-1}$ to a single element of $A$ because $f$ is a function. Because every element of $A$ has an image under $f$, it follows that $f^{-1}$ is surjective. Therefore, if a function $f$ is invertible, then its inverse, $f^{-1}$, is also an invertible function.

### Composition of a function and its inverse

We learned that a function on a set $A$ that maps every element to itself is called an identity** **function of $A$ and is denoted by $I_A$. If we look at the composition of a function $f:A\to B$ and its inverse $f^{-1}:B\to A$, we always get the identity function. If $f(a) = b$ for any $a\in A$ and $b\in B$, then by definition $f^{-1}(b) =a$. Therefore, $f^{-1}\circ f(a) = f^{-1}(f(a)) = f^{-1}(b) = a$ from which follows that$f^{-1}\circ f = I_A$. Similarly, $f(f^{-1}(b)) = f(a) = b$. As a result, $f\circ f^{-1} = I_B$.

### Examples

Let’s consider the following sets: