# Invertibility of a function and left/right inverses

I am new to writing proofs, as a result even when i may know an answer i sometimes doubt if i know how to write the proof. So here is the problem which should be an easy one. In fact i think the proof is harder to write because it is too simple.

Let $f$ be a function. If there exists a function $g$ such that $g \circ f = \text{Id}_{\text{Dom}(f)}$ then $f$ is invertible and $f^{-1} = g$ restricted to $\text{range}(f)$. If there exists a function $h$ such that $f \circ h = \text{Id}_{\text{Range}(f)}$ then $f$ may fail to be invertible.

Some scratch work

Clearly in the left inverse case we start from our function $f$'s domain go to $f$'s range and then using the g restricted to range of $f$ get back to $f$'s domain. Hence we can see a one-to-one correspondance.

In case of the right inverse we start from domain of some function $h$ and end up with range of $h$ which also happens to restrict f's domain, using f we get to range of $f$. In this case we have only observed for each x in domain of f there exists a $y$ in range of $f$, but we haven't seen that for each $y$ there exists a unique $x$ to establish the one-to-one correspondence needed for invertibility.

My Proof attempt

g o f = Id(dom f) the f is invertible and $f^{-1} = g$ restricted to $\text{Range}(f)$. If $g \circ f = \text{Id}_{\text{Dom}(f)}$ then $g(f(x)) = \text{Id}_{\text{Dom}(f)}$.

So for all $x$ such that $x$ belongs to $\text{Dom}(f)$ there exists a $y$ such that y belong to $\text{Range}(f)$ and by definition of function composition $y$ also belongs to domain of $g$ and $g(y) = x$. Hence $g$ restricted to range of $f = f^{-1}$ and $f$ is invertible.

Not so sure how to write the proof of the right inverse case.

Any help would be highly appreciated.

-

## 2 Answers

The first statement you give is not correct, so you cannot prove it. The point is that being invertible not only involves being injective (sending distinct elements to distinct images), but also being surjective: every element of the codomain of $f$ (i.e., the set $Y$ if $f$ is defined to be a function $X\to Y$) must appear in $\mathrm{range}(f)=\{ f(x)\mid x\in X\}$. This is a subtle point, which comes from the fact that the inverse of a function $X\to Y$ is required to be a function $Y\to X$, defined on all of $Y$ and not on a subset; therefore the restriction of $g$ you mention is not a true inverse of $f$. It is the inverse of the function $\tilde f:X\to\mathrm{range}(f)$ that is like $f$ in every aspect except that its codomain is taken to be $\mathrm{range}(f)$ rather than $Y$ (this variant of $f$ does not have a standard name; one could call it "$f$ with restricted codomain".)

Your proof attempt shows that you are not accustomed to writing proofs (as you indicate), so here are some comments. Your first sentence states what you will set out to prove; make sure you indicate this intention clearly, for otherwise it could be taken as jumping to the conclusion prematurely and without sufficient motivation, which is a common mistake. The second sentence has an imprecise formula: you mean "if $g\circ f=\mathrm{Id}_{\mathrm{dom}(f)}$ then $g(f(x))=x$ for all $x\in\mathrm{dom}(f)$." Note that this implies $g'(\tilde f(x))=x$ for all $x\in\mathrm{dom}(f)$, where $g'$ is the restriction of $g$ to $\mathrm{range}(f)$, since $\tilde f(x)=f(x)\in\mathrm{range}(f)$ for all $x\in\mathrm{dom}(f)$, and $g'(y)=g(y)$ for all $y\in\mathrm{range}(f)$. For the rest of the proof, it would be clearer if you start with mentioning explicitly what is missing in order to conclude that $g'$ is the inverse of $\tilde f$, namely the equation $\tilde f\circ g'=\mathrm{Id}_{\mathrm{range}(f)}$, which means $\tilde f(g'(y))=y$ for all $y\in\mathrm{range}(f)$.

Once you realise this, you will be led to start "assume that $y\in\mathrm{range}(f)$". Then by definition of $\mathrm{range}(f)$ there exists $x\in X$ with $f(x)=y$ and one also has $f(x)=\tilde f(x)$. Now apply what you already know about $g'$, which will lead you to conclude $g'(y)=x$, and then apply $\tilde f$ on both sides to reach the conclusion you are after.

As for the right inverse case, you are asked to prove that some statement fails, and this is relatively easy: you just need to provide one example where the statement does not hold. Here is a hint: take an example where all values of $f$ are equal.

-

First of all, I think we need to get some definitions straight. If $f: X \to Y$ is a function (with $X$ and $Y$ sets), then $f$ is said to be invertible if there exists a function $g: Y \to X$ such that $g \circ f = \operatorname{id}_{X}$ and $f \circ g = \operatorname{id}_{Y}$. If the first identity is satisfied, $f$ is said to be left invertible, and if the other one is satisfied $f$ is right invertible.

I have never heard of left invertible functions being referred to as invertible, and there are easy counterexamples: let $X = \{1\}, Y = \{1,2\}$ and define $f: X \to Y$ by $f(1) = 1$. Then the function $g: Y \to X$ defined by $g(1) = g(2) = 1$ is a left inverse of $f$, since $g(f(1)) = 1$. But $f(g(2)) = 1 \neq 2$, so $g$ is not a right inverse (and it is easy to see that no such function can exist, since the range of $f$ is a one point set, while $Y$ is a two-point set, so any left inverse must necessarily identify two points). Also note that $g$ is a right invertible function without a left inverse for the same reasons.

You can, however (as you appear to say), make a left invertible function invertible by restricting the range. In other words, if $f: X \to Y$ is left invertible with left inverse $g$, then writing $Z = f(X)$ (i.e. $Z$ is the range or image of $f$),we have that $f: X \to Z$ is invertible. This is easy to show; we already have left invertibility, so all we need to show is that $f \circ g|_{Z} = \operatorname{id}_{Z}$. Consider $z \in Z$. Then $z = f(x)$ for some (in fact, a unique) $x \in X$, so we have $$f \circ g|_{Z}(z) = (f \circ g) (f(x)) = f ( g\circ f(x) ) = f(x) = z,$$ since $g \circ f = \operatorname{id}_{X}$ (left invertibility). Hence $f: X \to Z$ is invertible.

For the other question, let $f: X \to Y$ again be an arbitrary function, and suppose there exists an $h: Y \to X$ such that $f \circ h = \operatorname{id}_{Y}$ (I'm unsure if you mean codomain or range in this case, so I'll do both). Here we get an inverse by restricting $f$ to $h(Y)$; the proof is the same as above - we may as well consider the problem of making a given left inverse of $h$, namely $f$, into a right inverse by restricting the range of $h$. You can do something similar if we only have $f \circ h = \operatorname{id}_{f(X)}$, first by restricting the codomain of $f$ to the range of $f$, and proceeding as above.

-