I have the following statement:
Determine if is true that if $g: \mathbb{R} \to \mathbb{R}, f: \mathbb{R} \to \mathbb{R}$ and $ (g\circ f)(x) = x$ therefore $g = f^{-1}$
My attempt was:
$i)$ Since $g \circ f$ is injective then $f$ is injective.
$ii)$ Since $g\circ f$ is surjective then $g$ is surjective.
I couldn't found a counterexample function, so I think this is true. So I will try to show that $f$ is bijective and then use the property $(f^{-1}\circ f)(x)=x$ that is $x = (g \circ f)(x)$
But i could not prove that $f$ will be surjective to determine that $f$ is bijective. So any hint is appreciated.
Thanks in advanced.
Hint: $f$ must be injective (if $f(x)$ lost information about $x$, then $g$ could not recover $x$ from $f(x)$). However, the value of $g(x)$ is irrelevant for $x$ outside the range of $f$. So try taking $f$ to be an injection of $\Bbb{R}$ into a proper subset of $\Bbb{R}$. E.g., take $f(x) = \arctan(x)$.