One-sided inverse of a function Is it possible to find an example of an one-sided inverse of a function?  other than matrix?
I am trying to find such an example but having no luck. Anybody got an idea about it?
 A: Examples are abundant. Some basic facts may help you find many:


*

*If $\:f\colon X\to Y$ has a left inverse $h\colon Y\to X$ ($h\circ f = id_X$), then $f$ is a injection and $h$ is a surjection.

*If $\:f\colon X\to Y$ has a right inverse $g\colon Y\to X$ ($f\circ g = id_Y$), then $f$ is a surjection and $g$ is an injection.
(Proof of 2.) $f$ is a surjection: if $y\in Y$ but $y\notin range(f)$, then $y\ne f(g(y))$, so $f\circ g \ne  id_Y$.  
$g$ is an injection: if $y_1, y_2\in Y$ and $g(y_1) = g(y_2)$; then $y_1 = f(g(y_1)) = f(g(y_2)) = y_2$.
(Proof of 1.) Given the hypothesis, $h$ has a right inverse $f$, so by 2., $h$ is a surjection and $f$ is an injection.
Note: a right inverse for $f$ is a choice function for the indexed family of nonempty sets $\{f^{-1}(y)\mid y\in Y\}$. An equivalent form of the Axiom of Choice is: Every surjection has a right inverse. By contrast, it's easy to prove in ZF that every injection on a nonempty set has a left inverse.
Now you can characterize a bijection as a function that has both one-sided inverses:


*If $f$ has a right inverse $g$ and a left inverse $h$ then $g = h = f^{-1}$ and $f$ is a bijection.
Consider: $h = h\circ id_Y = h\circ (f\circ g) = (h\circ f) \circ g = id_X \circ g = g$.

Matrix multiplication is actually a relevant analogy. 
Matrices represent functions, linear maps, and composition of linear maps corresponds to multiplication of their associated matrices. 
An $n\times m$ matrix $A$ represents a linear map, a function $T_A\colon\Bbb R^m \to \Bbb R^n$ that computes $\vec{x}\mapsto A\cdot \vec{x}$, multiplication of an m-vector by $A$, yielding an $n$-vector. Thus $T_{AB} = T_A\circ T_B$, and $T_{I_m} = id_{\Bbb R^m}$. 
When $m>n$, there are no injective linear maps $\Bbb R^m \to \Bbb R^n$, just as there are no injections from $X\to Y$ if (and only if) $card(Y)< card(X)$. (By definition, $card(X)\le card(Y)$ iff there is an injection $X\to Y$.) So if $Y$ is smaller than $X$, then given $X\stackrel{f}{\to} Y\stackrel{g}{\to} X$, $f$ isn't an injection and $g\circ f \ne id_X$. 
For matrices $A$ and $B$ of sizes $n\times m$ and $m\times n$ respectively, both products $AB$ and $BA$ are defined. Both $\operatorname{rank} A$ and $\operatorname{rank} B$ are $\le \min(n,m)$, so if $n\ne m$, then one of the matrices has to lose information — it has a nontrivial kernel, multiplying by it on the left is not 1-1 — and one of the products will not be the identity. 


*

*If $A$ is $n\times m$ and $A$ has a left inverse, then $m\le n$ and $T_A$ is an injection. Suppose $BA=I_m$ and $n<m$. Then the rank of $A$ is at most $n$, and then the rank of $BA$ is also at most $n$. But the rank of $I_m$ is $m >n$. (In fact, $\operatorname{rank} A = m$.)

*If $A$ is $n\times m$ and $A$ has a right inverse, then $n\le m$ and $T_A$ is a surjection. If $AB = I_m$, then $A$ is a left inverse of $B$, so this follows from the previous result.
A: Another classical example is the shift maps. Let $S$ be the space of real sequences $S = \{(a_0,a_1,a_2,\dots) : a_i\in\mathbb{R} \, \text{for all $i$}\}$ (which, essentially, is the space of functions $\mathbb{N}\to\mathbb{R}$).
Define the "left shift map" $f:S\to S$ as
$$
f((a_0,a_1,a_2,a_3,\dots)) = (a_1,a_2,a_3,\dots)
$$
(i.e., remove the first element from the sequence), and the "right shift map" $g:S\to S$ as
$$
g((a_0,a_1,a_2,\dots)) = (0,a_0,a_1,a_2,\dots)
$$
(i.e., add a zero at the beginning of the sequence).
Then, $f\circ g$ is the identity, but $g\circ f$ is not.
A: Think of the function $f:\{0,1\}\to \{1\}$ that is constant. It has a right inverse $g:\{1\}\to\{0,1\}$ which maps $1\mapsto 1$. This is because $f\circ g=Id_{\{1\}}$, the identity function on $\{1\}$. But it doesn't have a left inverse since it is not injective (1 to 1). 
Also you should notice that the right inverse $g$ isn't even unique.
A: Here's another example: 
Let $f:\Bbb R\to[0,\infty)$ be defined by $f(x)=x^2$, and $g:[0,\infty)\to\Bbb R$ by $g(x)=\sqrt x$.
Now,
$$(f\circ g)(x)=\sqrt x^2=x,$$
but
$$(g\circ f)(x)=\sqrt{x^2}=|x|.$$
