Here's the original question, prove or disprove.
For any nonempty set A and for any function $f\colon A \to A$, if there exists a function $g\colon A \to A$ such that $g \circ f$ is bijective, then $f$ is bijective.
I believe that the solution is true as if $g \circ f$ is bijective, then $g$ must be bijective, but as the two functions both map from $A\to A$, $g \circ f$ being bijective means that there must be the same number of $f(x)$ outcomes to put into $g$, which shows $f$ is also bijective. However, I'm not sure exactly how to represent it mathematically, or if this is a valid proof at all.
Define $f:\mathbb{N}\to\mathbb{N}$ by $f(n)=2n$. Define $g:\mathbb{N}\to\mathbb{N}$ by $g(2n)=g(2n+1)=n$.
Then $g\circ f$ is bijective, but neither $f$ nor $g$ are bijective.