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.