# Condition for inverse function.

I found this line about the condition of inverse function at Inverse function.Here is the line.

In the verification step we technically really do need to check that both $$\left( {{f} \circ f^{-1}} \right)\left( x \right) = x$$ and $$\left( {{f^{ - 1}} \circ f} \right)\left( x \right) = x$$ are true. For all the functions that we are going to be looking at in this course if one is true then the other will also be true. However, there are functions (they are beyond the scope of this course however) for which it is possible for only one of these to be true. This is brought up because in all the problems here we will be just checking one of them. We just need to always remember that technically we should check both.

Can someone give me an example of such a function?

• I don't understand why some people want to close this question. The question makes perfectly sense, in my opinion, and there is also a nice answer given by @CSquared. Jun 6, 2021 at 7:17

Consider $$f:\mathbb{R}\to\mathbb{R}$$ given by $$f(x) = x+1$$ for $$x\geq 0$$ and $$f(x)=x-1$$ for $$x<0$$

Now consider $$g:\mathbb{R}\to\mathbb{R}$$ given by $$g(x)=x-1$$ for $$x\in[1,\infty)$$, $$g(x)=x+1$$ for $$x\in (-\infty,-1)$$ and $$g(x)=1$$ otherwise.

I suggest you graph these functions.

Then $$(g\circ f)(x)=x$$ for all $$x\in\mathbb{R}$$ but $$(f\circ g)(0)=f(1)=2$$.

Indeed, $$\tan(\tan^{-1} x)=x$$ is true for all real $$x$$, but $$\tan^{-1}(\tan x)=x$$ is only true for $$x\in(-\frac {\pi}{2}, \frac {\pi}{2})$$. In general, both the conditions will simultaneously hold only in the intersection of the principal domain of $$f(x)$$ where it is bijective, with the domain of $$f^{-1}(x)$$.

One might say a similar thing for $$f(x)=e^x$$ and $$g(x)=f^{-1}(x)=\ln x$$.

$$g(f(x))=x$$ is true for all real $$x$$, but $$f(g(x))=x$$ holds only for $$x\in (0,\infty)$$.

• I think domain of $\tan(\tan^{-1} x)$ is the same as the domain of $\tan^{-1}x$ so it is $(-\frac{\pi}2,\frac{\pi}2)$ so $\tan(\tan^{-1}x)=x$ is only true for $x\in(-\frac{\pi}2,\frac{\pi}2)$ and vise versa. Am I right? Jun 4, 2021 at 15:56
• No, domain of $\tan (\tan^{-1}x)$, which is all real $x$, is not the same as $\tan^{-1} x$. Rather it is domain of $\tan x$ which is restricted in this case, and considered to be $(-\frac {\pi}{2}, \frac {\pi}{2})$. This is the interval where $\tan x$ would be a bijective function. Jun 4, 2021 at 16:35
• Ok thanks! I messed up in fact domain of $\ tan^{-1}x$ is $\mathbb{R}$ not $(-\frac{\pi}2,\frac{\pi}2)$ Jun 4, 2021 at 18:02
• @Ritam_Dasgupta - In my opinion, your examples are not relevant to the question in the OP. A function $f \colon A \to B$ is inverstible if there is a function $g \colon B \to A$ (called the inverse of $f$) such that $f \circ g = id_B$ and $g \circ f = id_A$. In this sense, $\tan^{-1} \colon \mathbb{R} \to (-\pi/2, \pi/2)$ is perfectly the inverse of $\tan \colon (-\pi/2, \pi/2) \to \mathbb{R}$, and $\ln \colon (0,\infty)\to\mathbb{R}$ is perfectly the inverse of $e \colon \mathbb{R} \to (0,\infty)$. The answer given by C Squared, instead, is a correct example of what the OP is asking for. Jun 5, 2021 at 8:09
• @Ritam_Dasgupta - It's true that $\tan^{-1}(\tan(\pi)) = 0$, but then you're not considering $\tan$ as a function from $(-\frac{\pi}{2}, \frac{\pi}{2})$ to $\mathbb{R}$, but as a function from $\bigcup_{k \in \mathbb{Z}} (\frac{(2k-1)\pi}{2}, \frac{(2k+1)\pi}{2})$ to $\mathbb{R}$, and this function is not injective, hence it is not invertible. Using the same symbol $\tan$ for two different functions is misleading and can lead to wrong conclusions, as in your example. When defining a function, it is important to make explicit his domain and codomain. Jun 6, 2021 at 7:12

In general, we have:

$$f:X \to Y$$ is injective if and only if exists $$g:Y \to X$$ such that $$g(f(x))=x$$. That is $$f$$ has a left inverse .

$$f:X \to Y$$ is surjective if and only if exists $$g:Y \to X$$ such that $$f(g(x))=x$$. That is $$g$$ has a right inverse.

For a function to have an inverse you need it to be bijective, that is, injective and surjective. So in order to find the examples you are looking for you need to find functions that are injective but not surjective or surjective but not injective.

Take for example, $$f:\Bbb R\to\Bbb R^{\ge0}, f(x)=x^2$$. It is surjective but not injective. The function $$g:\Bbb R^{\ge 0}\to \Bbb R, g(x)=\sqrt{x}$$ satisfies $$f(g(x))=x$$ for all $$x$$ in the domain of $$g$$, but $$g(f(x))=\sqrt{x^2}=|x|\ne x$$ for $$x<0$$. So $$f$$ has a right inverse, but not a left one.

Notice that this is also gives and example in the other direction: $$g$$ is injective but not surjective. So $$g$$ has a left inverse but not a right one.

Notice that the domain and codomain of the functions are very important. If we change the domain of $$f$$ and codomain of $$g$$ to be $$\Bbb R^{\ge0}$$, then $$f$$ and $$g$$ becomes bijective and are inverses of each other.

One cool example could be taken from functions that takes other functions as an argument. This is not an example from functions of a real value, so it might not be really what you’re expecting - but I do think it’s interesting!

Let $$D: C_{\infty}(\mathbb{R}, \mathbb{R}) \rightarrow C_{\infty}(\mathbb{R}, \mathbb{R})$$ and $$I: C_{\infty}(\mathbb{R}, \mathbb{R}) \rightarrow C_{\infty}(\mathbb{R}, \mathbb{R})$$ such that:

$$\forall f \in C_{\infty}(\mathbb{R}, \mathbb{R}), D(f)=f’$$ $$\forall f \in C_{\infty}(\mathbb{R}, \mathbb{R}), I(f)=\int_0^x f(t)dt$$

Note here that D and I are respectively the derivative and the antiderivative operators. Now, we could expect that one is the other’s reciprocical. But... let’s take any $$f \in C_{\infty}(\mathbb{R}, \mathbb{R})$$, and $$F$$ a primitive of $$f$$. We have:

$$D \circ I (f)=D(\int_0^x f(t)dt)=D(F(x)-F(0))=f$$

We see here that $$D \circ I = Id$$. However:

$$I \circ D (f)=I(f’)=\int_0^x f’(t)dt=f(x)-f(0)$$

So, if $$f(0) \neq 0$$, we don’t have $$I \circ D (f)=f$$ - which explains why antiderivatives are only defined within a constant!

• you need the space to be $C_{\infty}(\mathbb{R},\mathbb{R})$ for everything to work out nicely without putting silly restrictions on domains and codomains, since, e.g., $f(x)=|x|$ is continuous but not differentiable on the reals. otherwise, nice answer Jun 4, 2021 at 11:44
• Oops, that’s right. I’ll edit my answer Jun 4, 2021 at 12:16

$$f,f'$$ can be swapped.

A reflection about $$x=y$$ when reflected for second time about $$=y$$ gets back $$x$$.