Here are a collection of proofs of lemmas about the relationships between function inverses and in-/sur-/bijectivity.

This document serves at least two purposes:

These proofs are good examples of what we expect when we ask you to do proofs on the homework.

These theorems are useful, so having a list of them is convenient.

It is a good exercise to try to prove these on your own as well, and to compare your proofs with those given here.

See the lecture notes for the relevant definitions.

- 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
- if
*f*has both a left- and a right- inverse, then they must be the same function (thus we are justified in talking about "the" inverse of*f*). - the composition of two injective functions is injective
- the composition of two surjective functions is surjective
- the composition of two bijections is bijective

There are two ways to come up with the proofs below:

Write down the claim, then write down the assumptions, then replace words with their definitions as necessary; the result will often just fall out immediately

Work through a few examples and try to find a common pattern.

Here are the key things to look for in these proofs and to ensure when you write your own proofs:

the claim being proved is clearly stated, and clearly separated from the beginning of the proof

each step / sentence clearly states some fact. In particular, the words, variables, symbols, and phrases that are used have all been previously defined.

the stated fact is true (in the context of the assumptions that have been made)

each step follows from the facts already stated. The reasoning behind each step is explained as much as is necessary to make it clear.

if the proof requires multiple parts, the reader is reminded what the parts are, especially when transitioning from one part to another.

In the following proofs, unless stated otherwise, *f* will denote a function from *A* to *B* and *g* will denote a function from *B* to *A*. I will also assume that *A* and *B* are non-empty; some of these claims are false when either *A* or *B* is empty (for example, a function from ∅→*B* cannot have an inverse, because there are no functions from *B*→∅).

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

**Proof:** We must ( ⇒ ) prove that if *f* is injective then it has a left inverse, and also ( ⇐ ) that if *f* has a left inverse, then it is injective.

( ⇒ ) Suppose *f* is injective. We wish to construct a function *g*: *B*→*A* such that *g* ∘ *f* = *i**d*_{A}. Choose a fixed element *c* ∈ *A* (we can do this since *A* is non-empty). We will define *g* as follows on an input *y*:

if there exists some

*x*∈*A*with*f*(*x*) =*y*, then we will let*g*(*y*) =*x*. Note that since*f*is injective, there can exist at most one such*x*.if

*y*is not in the image of*f*(i.e. if there is no*x*that maps to*y*), then we let*g*(*y*) =*c*.

I claim that for any *x*, (*g* ∘ *f*)(*x*) = *x*. Indeed, by the definition of *g*, since *y* = *f*(*x*) is in the image of *f*, *g*(*y*) is defined by the first rule to be *x*. Thus *g* ∘ *f* = *i**d*_{A}.

( ⇐ ) Suppose conversely that *f* has a left inverse, which we'll call *g*. We wish to show that *f* is injective. In other words, we wish to show that whenever *f*(*x*) = *f*(*y*), that *x* = *y*.

Well, if *f*(*x*) = *f*(*y*), then we know that *g*(*f*(*x*)) = *g*(*f*(*y*)). By definition of *g*, we have *x* = *g*(*f*(*x*)) and *g*(*f*(*y*)) = *y*. Putting this together, we have *x* = *g*(*f*(*x*)) = *g*(*f*(*y*)) = *y* as required.

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

**Proof:** As before, we must prove the implication in both directions.

( ⇒ ) Suppose *f* is surjective. We must define a function *g* such that *f* ∘ *g* = *i**d*_{B}. We define *g* as follows: on a given input *y*, we know that there is at least one *x* with *f*(*x*) = *y* (since *f* is surjective). We choose one such *x* and define *g*(*y*) = *x*.

With this definition, it is clear that (*f* ∘ *g*)(*y*) = *y*, so *g* is a right inverse of *f*, as required.

( ⇐ ) Suppose that *f* has a right inverse, and let's call it *g*. We must show that *f* is onto, that is, for any *y* ∈ *B*, there is some *x* ∈ *A* with *f*(*x*) = *y*.

Indeed, if we choose *x* = *g*(*y*), then since *g* is a right inverse of *f*, we have *f*(*x*) = *f*(*g*(*y*)) = *y*, as required.

**Claim:** *f* is bijective if and only if it has a two-sided inverse.

**Invalid Proof ( ⇒ ):** Suppose *f* is bijective. By above, we know that *f* has a left inverse and a right inverse. Therefore it has a two-sided inverse.

This proof is invalid, because just because it has a left- and a right inverse does not imply that they are actually the same function.

**Valid Proof ( ⇒ ):** Suppose *f* is bijective. By above, we know that *f* has a left inverse and a right inverse. I will prove below that this implies that they must be the same function, and therefore that function is a two-sided inverse of *f*. (Note: this proof is dangerous, because we have to be very careful that we don't use the fact we're currently proving in the proof below, otherwise the logic would be circular!)

**Proof ( ⇐ ):** Suppose *f* has a two-sided inverse *g*. Since *g* is a left-inverse of *f*, *f* must be injective. Since *g* is also a right-inverse of *f*, *f* must also be surjective. Since it is both surjective and injective, it is bijective (by definition).

**Claim:** if *f* has a left inverse (*g*) and a right inverse (*g*ʹ) then *g* = *g*ʹ.

**Proof:** Choose an arbitrary *y* ∈ *B*. We must show that *g*(*y*) = *g*ʹ(*y*).

Since *g*ʹ is a right inverse of *f*, we know that *y* = *f*(*g*ʹ(*y*)). Applying *g* to both sides of this equation, we see that *g*(*y*) = *g*(*f*(*g*ʹ(*y*))). But for any *x*, *g*(*f*(*x*)) = *x*. In particular, if we choose *x* = *g*ʹ(*y*), we see that

*g*(*y*) = *g*(*f*(*g*ʹ(*y*))) = *g*(*f*(*x*)) = *x* = *g*ʹ(*y*)

as required.

**Claim:** The composition of two injective functions *f*: *B*→*C* and *g*: *A*→*B* is injective.

**Proof:** We must show that for any *x* and *y*, if (*f* ∘ *g*)(*x*) = (*f* ∘ *g*)(*y*) then *x* = *y*.

If *f*(*g*(*x*)) = *f*(*g*(*y*)), then since *f* is injective, we conclude that *g*(*x*) = *g*(*y*). Then, since *g* is injective, we conclude that *x* = *y*, as required.

**Claim:** The composition of two surjections *f*: *B*→*C* and *g*: *A*→*B* is surjective.

**Proof:** We must show that for any *c* ∈ *C*, there exists some *a* in *A* with *f*(*g*(*a*)) = *c*.

Since *f* is surjective, we know there is some *b* ∈ *B* with *f*(*b*) = *c*. Since *g* is surjective, there must be some *a* in *A* with *g*(*a*) = *b*. Thus *f*(*g*(*a*)) = *f*(*b*) = *c* as required.

**Claim:** The composition of two bijections *f* and *g* is a bijection.

**Proof:** Since *f* and *g* are both bijections, they are both surjections. By above, this implies that *f* ∘ *g* is a surjection. Similarly, *f* ∘ *g* is an injection. Therefore *f* ∘ *g* is a bijection.

We are using the axiom of choice all over the place in the above proofs. In particular, every time we say "since *X* is non-empty, we can choose some *x* ∈ *X*"