Is it possible that $(f\circ g)(x)=x$ and $(g\circ f)(x)\ne x$?

173 Views Asked by At

Is it possible that $(f\circ g)(x)=x$ and $(g\circ f)(x)\ne x$

In other words, To show $f$ and $g$ are inverse, is it enough to show $(f\text{ o }g)(x)=x$?

I have never witnessed a case in which the other composition is not $x$, if one of them equals $x$.

EDIT : So this is not always true, but what are the conditions under which this is true. I think this is more interesting !

5

There are 5 best solutions below

5
On

Yes, take $g:\mathbb{N}\rightarrow \mathbb{N}$ be defined by $g(n)=n+1$ and $f:\mathbb{N}\rightarrow \mathbb{N}$ be defined by $$f(n) = \begin{cases} 0 & n=0 \\ n-1 & n>0 \end{cases}$$ Then $f\circ g=\mathrm{id}_\mathbb{N}$ but $g\circ f\neq \mathrm{id}_\mathbb{N}$ because $g(f(0))=1$.

In general, if $f:A\rightarrow B$ is injective but not surjective, there exist a left inverse, i.e. a function $g:B\rightarrow A$ such that $g\circ f=\mathrm{id}_A$, but $g$ will not be an inverse because $f$ is not surjective. Likewise, if $f:A\rightarrow B$ is surjective but not injective, there exists a right inverse, i.e. a function $g: B\rightarrow A$ such that $f\circ g=\mathrm{id}_B$, but again, $g$ will not be an inverse because $f$ is not injective. (Note that I am using the fact that $f$ has an inverse if and only if $f$ is bijective.)

Adding the hypothesis of continuity doesn't change any of this: consider $x\mapsto e^x$, which is injective but not surjective (on $\mathbb{R}$, since $e^x$ is always positive). Its left-inverse is given by $x\mapsto \ln |x|$ for $x\neq 0$ (and defined to be whatever you want at $x=0$).

2
On

Yes, it is possible. For a familiar example, consider $\tan(x)$ and $\arctan(x)$, as they're usually defined.

$\tan(\arctan(x)) = x$, but the range of $y = \arctan(\tan(x))$ is still just $(-\pi/2,\pi/2)$

2
On

Consider $f:\Bbb R\to\Bbb R_{\ge 0}$ and $g:\Bbb R_{\ge 0}\to\Bbb R_{\ge 0}$ given by $f(x)=x^2$ and $g(x)=\sqrt x.$

If we had restricted $f$ to $\Bbb R_{\ge 0}$, we would have that $g\circ f=f\circ g.$ However, this is not the case when defined as above.

2
On

I'll set all this in the general context of set theory;

Let $f\colon E\to F$ be a map between non-empty sets. Then:

(i) $\,f$ is surjective if and only if there exists $g\colon F\to E$ such that $f\circ g=\operatorname{id}_F$.

(ii) $\,f$ is injective if and only if there exists $g\colon F\to E$ such that $g\circ f=\operatorname{id}_E$.

It is clear that none of (i), (ii) implies the other, in other words, an injective/surjective map is not necessarily bijective.

This remains true if $\,E=F=\mathbf R$.

0
On

There is a canonical example in linear algebra that can be transplanted. If $F$ is any field then the shift operator $(x_0,x_1,x_2,\cdots)\mapsto (0,x_0,x_1,\cdots)$ on the direct sum $\bigoplus_{\Bbb N}F$ has a left inverse given by shifting back $(y_0,y_1,y_2,\cdots)\mapsto(y_1,y_2,y_3,\cdots)$. Of course the left inverse is not injective since it deletes the first coordinate, so it is not a right inverse. And the original shift map fails to be surjective since it always puts a $0$ in the first coordinate.

Now consider $\Bbb R$. According to Zorn's Lemma / the Axiom of Choice every vector space has a basis, so the reals have a vector space basis over $\Bbb Q$ and so we can write $\Bbb R\cong\bigoplus_c\Bbb Q$ for some uncountable indexing set $c$. Again according to Zorn's / Choice, every set can be well-ordered, so without loss of generality we can well-order $c$ and then we can define a shift operator.

Note this "shifting" idea is present in the construction in Hayden's answer too.