# Why abstractly do left and right inverses coincide when $f$ is bijective?

I was reading Munkres Topology, one of the questions asks to show that if we have a function $$f$$ that has both a left and right inverse to show that $$f$$ is bijective and that the left and right inverse are both equal, call it $$f^{-1}$$.

So it's relatively easy to show that $$f$$ must be injective for a left inverse to exist and surjective for a right inverse to exist. Therefore, $$f$$ is clearly a bijection. Additional useful information is that a left inverse must be surjective and the right inverse must be injective.

Now what i'm stuck on is showing that $$f$$ has a unique inverse and that the left and right inverses are equal to this inverse. Here is a sketch below:

If $$f$$ is a bijection between sets $$A,B$$ then we can create directed graph consisting of pairs of nodes, with one node in $$A$$, another node in $$B$$ and an arrow from $$A$$ to $$B$$ to represent $$f$$.

Because $$f$$ is a bijecton if we reverse the direction of all the arrows then we will never end up with more than one arrow pointing to a node in $$A$$ and every node in $$B$$ will have exactly one arrow leaving from it, so the function represented by this graph is well defined and has the property (call it $$f^{-1}$$) that $$f(f^{-1}) = \text{identity}_B$$ $$f^{-1}(f) = \text{identity}_A$$

Now my problem is showing the existence of this inverse function doesn't truly guarantee it is unique and therefore that the original left and right inverses must be equal to this $$f^{-1}$$

The simple algebraic reason is that anything with a left inverse $$L$$ and a right inverse $$R$$ has $$L=R.$$

If left and right inverses are $$f^L$$ and $$f^R$$ then apply the associative rule to $$f^L\circ f \circ f^R.$$

A bijection is, intuitively, a pairing of the elements of $$X$$ with the elements $$Y$$ - every element of $$Y$$ is paired with exactly one $$x\in X$$ and visa versa.

Every $$y\in Y$$ is of the form $$y=f(x)$$ for exactly one $$x.$$

A left inverse $$f^L$$ must have $$x=f^L\circ f(x)=f^L(y).$$

The right inverse needs $$f(x)=y=f\circ f^R(y)$$ but $$f(x)=f(z)$$ means that $$x=z$$, so $$x=f^R(y)$$ and we get the same $$f^R(y)=f^L(y)=x.$$

Think of a bijection as a set $$P\subseteq X\times Y$$ of pairs where each $$x\in X$$ has exactly on $$y\in Y$$ such that $$(x,y)\in P,$$ and visa versa.

For $$x\in X$$, $$f(x)$$ is the uniqu element of $$y\in Y$$ is paired with $$(x,y)\in P.$$

And we get that $$f^R(y)$$ and $$f^L(y)$$ must both be the unique element $$x\in X$$ such that $$(x,y)\in P.$$

If $$f : X \to Y$$ is a function, $$\ell : Y \to X$$ is a left inverse for $$f$$ and $$r : Y \to X$$ is a right inverse for $$f$$, then $$\ell = \ell \circ \mathrm{id}_Y = \ell \circ (f \circ r) = (\ell \circ f) \circ r = \mathrm{id}_X \circ r = r$$

There is some intuition behind why the left and right inverses should be the same when $$f$$ is a bijection.

• The left inverse $$\ell : Y \to X$$ exists only if $$f$$ is injective. It looks at each element $$y \in Y$$ and, if it is in the image of $$f$$, returns the (unique) value $$x \in X$$ for which $$f(x)=y$$.
• The right inverse $$r : Y \to X$$ exists only if $$f$$ is surjective. It looks at each element $$y \in Y$$ and picks out one of the (possibly many) values $$x \in X$$ for which $$f(x)=y$$.

When $$f$$ is bijective, every element of $$Y$$ is in the image of $$f$$ (by surjectivity), and is a value of $$f$$ at a unique element of $$X$$ (by injectivity), and so the left and right inverses are forced to return the same value on each input.