Here is the connexion between function properties and invertibility.
Let $f\mathrm{:}X\mathrm{\to}Y$ be a function between nonempty sets.
$f$ has a left inverse if and only if it is injective.
$f$ has a right inverse if and only if it is surjective.
$f$ has a two sided inverse if and only if it is bijective.
ONLY IF. Let $g$ be a left inverse to $f$, so $g\circ f={\mathrm{id}}_{X}$. Suppose $f(a)=f(b)$. Then applying $g$ to both sides, $g(f(a))=g(f(b))$, so $a=b$.
IF. Let $f$ be injective. Choose any ${x}_{0}$ in the domain of $f$. Define $g:Y\to X$ as follows. Each $y$ in $Y$ is either in the image of $f$ or not. If $y$ is in the image of $f$, it equals $f(x)$ for a unique $x$ in $X$ (uniqueness is because of the injectivity of $f$), so define $g(y)=x$. If $y$ is not in the image of $f$, define $g(y)={x}_{0}$. Clearly $g\circ f={\mathrm{id}}_{X}$.
IF. Suppose $f$ is surjective. Let $y\in Y$. Then $y$ is in the image of $f$, so we can choose an element $g(y)\in X$ such that $f(g(y))=y$. This defines a function $g:Y\to X$ which is evidently a right inverse to $f$.
ONLY IF. Suppose $f$ has a right inverse $g$, so $f\circ g={\mathrm{id}}_{Y}$. If $y\in Y$ then $f(g(y))={\mathrm{id}}_{Y}(y)=y$, so $y\in \mathrm{im}(f)$. Every element of $Y$ is therefore in the image of $f$, so $f$ is onto.
If $f$ has a left inverse and a right inverse, it is injective (by part 1 of this theorem) and surjective (by part 2), so is a bijection. Conversely if $f$ is a bijection it has a left inverse $g:Y\to X$ and a right inverse $h:Y\to X$ by part 1 and part 2 again. We will now show $g=h$, so that $g$ is a two sided inverse to $f$.
$g$ | $=g\circ {\mathrm{id}}_{Y}$ | Proposition 2.6.1 | ||
$=g\circ (f\circ h)$ | $\text{as}f\circ h={\mathrm{id}}_{Y}$ | |||
$=(g\circ f)\circ h$ | associativity | |||
$={\mathrm{id}}_{X}\circ h$ | $\text{as}g\circ f={\mathrm{id}}_{X}$ | |||
$=h$ |
so $g=h$ is a two sided inverse of $f$. ∎
Figure 2.11 illustrates the construction in part 1 of the theorem. Arrows from left to right show where $f$ sends each element of $X$. Arrows from right to left show where the left inverse $g$ we have constructed sends each element of $Y$.
If $f:X\to Y$ is invertible, we write ${f}^{-1}$ for the two sided inverse of $f$.
It makes sense to talk about the two sided inverse to $f$ because there really is only one: if $g$ and $h$ are two sided inverses of $f$ then certainly $g$ is a left inverse and $h$ is a right inverse, so the argument in the proof of part 3 of the theorem above shows $g=h$.
If $f\mathrm{:}X\mathrm{\to}Y$ and $g\mathrm{:}Y\mathrm{\to}Z$ are invertible then so is $g\mathrm{\circ}f$, and ${\mathrm{(}g\mathrm{\circ}f\mathrm{)}}^{\mathrm{-}\mathrm{1}}\mathrm{=}{f}^{\mathrm{-}\mathrm{1}}\mathrm{\circ}{g}^{\mathrm{-}\mathrm{1}}$.
${f}^{-1}\circ {g}^{-1}$ is a left inverse to $g\circ f$, because
$({f}^{-1}\circ {g}^{-1})\circ (g\circ f)$ | $={f}^{-1}\circ ({g}^{-1}\circ g)\circ f$ | associativity | ||
$={f}^{-1}\circ {\mathrm{id}}_{Y}\circ f$ | ||||
$={f}^{-1}\circ f$ | ||||
$={\mathrm{id}}_{X}.$ |
A similar calculation shows that it is a right inverse as well. ∎
It is important to get this the right way round. The inverse of $g\circ f$ is not normally ${g}^{-1}\circ {f}^{-1}$, indeed this composition may not even make sense. The correct result is easy to remember when you think about getting dressed. Each morning you put on your socks, then you put on your shoes: if $k$ is the put-on-socks function and $h$ is the put-on-shoes function then you apply the function $h\circ k$ to your feet. The inverse of this is taking off your shoes, then taking off your socks: ${k}^{-1}\circ {h}^{-1}$. Not the other way round — it’s not even (normally) possible to take off your socks, then take off your shoes, just as it is not normally possible to form the composition ${g}^{-1}\circ {f}^{-1}$ in the context of the theorem above.^{3}^{3} 3 The shoes and socks illustration comes from Gilbert Strang’s famous 18.06 linear algebra course.
A similar result applies when you compose more than two invertible functions: if ${f}_{1},{f}_{2},\mathrm{\dots},{f}_{n}$ are invertible and if the composition
$${f}_{1}\circ \mathrm{\cdots}\circ {f}_{n}$$ |
makes sense, it is also invertible and its inverse is
$${f}_{n}^{-1}\circ \mathrm{\cdots}\circ {f}_{1}^{-1}.$$ |