2 Sets and functions

2.9 Conditions for invertibility

Here is the connexion between function properties and invertibility.

Theorem 2.9.1.

Let f:XY be a function between nonempty sets.

  1. 1.

    f has a left inverse if and only if it is injective.

  2. 2.

    f has a right inverse if and only if it is surjective.

  3. 3.

    f has a two sided inverse if and only if it is bijective.

Proof.
  1. 1.
    • ONLY IF. Let g be a left inverse to f, so gf=idX. 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 x0 in the domain of f. Define g:YX 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)=x0. Clearly gf=idX.

  2. 2.
    • IF. Suppose f is surjective. Let yY. Then y is in the image of f, so we can choose an element g(y)X such that f(g(y))=y. This defines a function g:YX which is evidently a right inverse to f.

    • ONLY IF. Suppose f has a right inverse g, so fg=idY. If yY then f(g(y))=idY(y)=y, so yim(f). Every element of Y is therefore in the image of f, so f is onto.

  3. 3.

    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:YX and a right inverse h:YX by part 1 and part 2 again. We will now show g=h, so that g is a two sided inverse to f.

    g =gidY Proposition 2.6.1
    =g(fh) as fh=idY
    =(gf)h associativity
    =idXh as gf=idX
    =h

    so g=h is a two sided inverse of f. ∎

Figure 2.11: A diagram illustrating the construction, in part 1 of the theorem, of the left inverse to an injective function f:XY where X={x,y,z}, Y={a,b,c,d,e}, and f(x)=c,f(y)=b,f(z)=a. Left-to-right arrows show where f sends elements of X and right-to-left arrows show where g sends elements of Y. The elements d and e of Y which are not in the image of f are all sent to the element x of X.

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.

Definition 2.9.1.

If f:XY is invertible, we write f1 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.

2.9.1 Inverse of a composition

Theorem 2.9.2.

If f:XY and g:YZ are invertible then so is gf, and (gf)1=f1g1.

Proof.

f1g1 is a left inverse to gf, because

(f1g1)(gf) =f1(g1g)f associativity
=f1idYf
=f1f
=idX.

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 gf is not normally g1f1, 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 hk to your feet. The inverse of this is taking off your shoes, then taking off your socks: k1h1. 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 g1f1 in the context of the theorem above.33 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 f1,f2,,fn are invertible and if the composition

f1fn

makes sense, it is also invertible and its inverse is

fn1f11.