If $f(g(x))=x$ is $f$ an injective function?

Recall the definition of $\arctan$:

$\arctan$ is the only continuous function $\Bbb R\to \left(-\frac\pi2,\frac\pi2\right)$ such that $\tan\arctan x=x$ for all $x\in\Bbb R$.

Now, it is clear that $\tan$ can be extended to a function $\Bbb R\to\Bbb R$ by assigning arbitrary values to $x=k\pi+\frac\pi2$. Would such an extension be injective?


It is injective on the range of $g$, but not necessarily otherwise.

To see that it is injective on this set, suppose $a\neq b$ are two elements in the range of $g$. There exist $x\neq y$ such that $a=g(x)$ and $b=g(y)$. Then $f(a)=f(g(x))=x$ and $f(b)=f(g(y))=y\neq f(a).$

The problem is that $g$ might not be surjective. If it isn't then the relationship you have tells you nothing at all about the behaviour of $f$ on values that you can't get by applying $g$, so in this case there is no reason for injectivity. As I was writing, G. Sassatelli has given an example of this :)


Your proof is flawed as comments point out, but more fundamentally it's flawed because the statement is false.

$f$ need only be injective over the range of $g$.

For example, consider $g(x) = e^x$ and define $f$ as

\begin{equation} f(x) = \begin{cases} \ln(x)& \mathrm{if}\, x > 0 \\ 0 & \mathrm{otherwise} \end{cases} \end{equation}