If $f(g(x))=x$ is $f$ an injective function? 
Let $ f:\mathbb R\to \mathbb R $ . If $f(g(x))=x$ then is $f$  an injective function?

Well, I proved it to be true. But honestly I have a strong feeling that my proof is wrong.
Here's my proof:
Assume $f(a_1)=f(a_2) = x$ and we want to prove that $a_1 = a_2$ .
if $f(a_1)=f(a_2) = x,$  then $a_1 = g(x)$  and   $a_2 = g(x) $. meaning $a_1 = a_2$.
Therefor f is injective. 
Is my proof wrong? I assume that not only that my proof is wrong but also that this isn't true at all. But I'm having a hard time to find a contradicting example.

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?
