On compositions $g \circ f$ and whether $f$ is surjective \begin{align} f: X \longrightarrow Y \\ g: Y \longrightarrow Z \\
g \circ f: X \longrightarrow Z \tag{is bijective} \end{align}
The bijective conditions only applies to $ g \circ f$. I already managed to show that in this case $f$ must be injective too, I did it the following way (maybe you can check if I did it correct):
Suppose: $f$ is not injective, then $x, x' \in X$ such that $f(x)=f(x') , \ x\neq x'$. 
For the composition this means that $(g \circ f) (x) = (g \circ f)(x') \implies x=x'$ because the composition is by definition a bijection and this statement would lead to a contradiction. Thus $f$ is a injection. 
I am content so far with this proof, however if I want to analyze the properties of $f$ whether it's also surjective or not I get stuck.
Question: is $f$ surjective?
I assume that $f$ is also surjective and therefore a bijection. This means that $\forall y \in Y \exists x \in X : f(x)=y$, I also know that the composition is surjective, because it's bijective, this means that $\forall z \in Z \exists x \in X: g(f(x))=z$
So I can say that $g(f(x))=z=g(y)$ Is this a contradiction I should notice here? Because I have read (also from other posts on here) that $f$ must not necessarily be surjective, but I couldn't come up with a complete proof on my own so far.
Edits: Improved formatting as suggested by @Thomas Andrews, corrected a mathematical false statement as suggested by @Michael Albanese
 A: Assuming $f$ is a surjective map will not lead to a contradiction because it is possible for $f$ to be both injective and surjective if $g \circ f$ is a bijection. An example of this is where $g$ is the identity map. If $f$ is surjective, then $f$ is a bijection so $f^{-1}$ exists and is itself a bijection. As compositions of bijections are bijections, $g = (g\circ f)\circ f^{-1}$ is a bijection.
The point is that $f$ doesn't have to be surjective (so $g$ doesn't have to be a bijection); there are examples where $f$ is not surjective but $g\circ f$ is a bijection. One such example is $f: \{0\} \to \{0, 1\}$, $f(0) = 0$, is not surjective but for $g : \{0, 1\} \to \{0\}$, $g(0) = g(1) = 0$, the composition $g \circ f : \{0\} \to \{0\}$, $(g\circ f)(0) = 0$ is a bijection.
A useful exercise in trying to understand the situation is to determine what restrictions are imposed on $f$ and $g$ by requiring $g\circ f$ to be a bijection. You've already determined one of them, namely that $f$ has to be injective, but this alone does not guarantee $g\circ f$ will be a bijection.
