# Lecture 13: inverse functions

• definitions: composition, identity function, left inverse, right inverse, two sided inverse
• theorems
• $$f$$ is injective if and only if it has a left inverse
• $$f$$ is surjective if and only if it has a right inverse
• $$f$$ is bijective if and only if it has a two-sided inverse

## Definitions

If $$f : A → B$$ and $$g : B → C$$ then the composition of $$g$$ and $$f$$ (written $$g \circ f$$)\$ is the function $$g \circ f : A → C$$ given by $$(g \circ f)(a) := g(f(a))$$.

Note: pay attention to the domains and codomains; with $$f$$ and $$g$$ as given, $$f \circ g$$ does not make sense, because $$g(b) ∈ C$$ so $$f(g(b))$$ is not defined.

The identity function on a set $$A$$ is the function $$id_A : A → A$$ given by $$id_A(x) := x$$. We often omit $$A$$ when it is clear from context.

If $$f : A → B$$ and $$g : B → A$$, and $$g \circ f = id_A$$ then we say $$f$$ is a right-inverse of $$g$$ and $$g$$ is a left-inverse of $$f$$. The left- and right- refer to which side of the $$\circ$$ the function goes; $$g$$ is a left-inverse of $$f$$ because when you write it on the left of $$f$$, you get the identity.

## Theorems

The following claims are true:

• $$f : A → B$$ is injective if and only if it has a left-inverse
• $$f : A → B$$ is surjective if and only if it has a right-inverse
• $$f : A → B$$ is bijective if and only if it has a two-sided inverse

Note: The way to remember (and prove) these is to draw yourself a picture of an injection (or surjection), draw the best inverse you can, and then see which way the composition works. If I don't draw a picture, I easily get left and right mixed up.

These are all good proofs to do as exercises. We did the first of them in class:

Claim: if $$f : A → B$$ is injective and $$A ≠ \emptyset$$, then $$f$$ has a left-inverse.

Proof: Suppose $$f : A → B$$ is injective. Note that since $$A \neq \emptyset$$, there exists some $$a_0 \in A$$. Let $$g : B → A$$ be defined as follows. Given $$b \in B$$, if $$b = f(a)$$ for some $$a$$ in $$A$$, then let $$g(b) := a$$. If $$b$$ is not in the image of $$f$$, then define $$g(b) := a_0$$.

I claim $$g$$ is a left-inverse of $$f$$. In other words, $$g \circ f = id$$. In other words, $$∀ a ∈ A$$, $$g(f(a)) = a$$. To see this, choose an arbitrary $$a \in A$$. Then $$f(a)$$ is in the image of $$f$$, so by definition of $$g$$, we have $$g(f(a)) = a'$$ for some $$a'$$ satisfying $$f(a') = f(a)$$. But since $$f$$ is injective, we know $$a' = a$$, which is what we wanted to prove.

Note: While writing this proof, it helps to draw yourself a picture of a simple injective function, and think about how you would construct the inverse.

Claim: Suppose $$f : A → B$$ has a left-inverse. Then $$f$$ is injective.

Proof: Let $$g$$ be a left inverse of $$f$$. Then $$g \circ f = id$$. We want to show that $$f$$ is injective, i.e. for all $$a_1, a_2 \in A$$, if $$f(a_1) = f(a_2)$$ then $$a_1 = a_2$$. Choose arbitrary $$a_1$$ and $$a_2$$ and assume that $$f(a_1) = f(a_2)$$. Applying $$g$$ to both sides of the equation gives $$g(f(a_1)) = g(f(a_2))$$. But $$g(f(a_1)) = a_1$$ (and likewise for $$a_2$$) so $$a_1 = a_2$$.

The proofs of the remaining claims are mostly straightforward and are left as exercises. The proof of one direction of the third claim is a bit tricky:

Claim: If $$f : A → B$$ is bijective, then it has a two-sided inverse.

Proof: Since $$f$$ is bijective, by the previous claims we know it has a left inverse $$g_l : B → A$$ and a right inverse $$g_r : B → A$$. I will show that $$g_l = g_r$$, which means that $$g_l$$ is a two-sided inverse.

To see this, choose an arbitrary $$b \in B$$. We want to show that $$g_l(b) = g_r(b)$$. Consider $$g_l(f(g_r(b))$$. Since $$g_l \circ f = id$$, we have $$g_l(f(g_r(b)) = g_r(b)$$. On the other hand, since $$f \circ g_r = id$$, we have $$g_l(f(g_r(b)) = g_l(b)$$. Combining these shows $$g_r(b) = g_l(b)$$ as required.